Arch Linux Grub2 Update-grub
Adding archlinux to dualboot without messing up grub. Can I just run update-grub to fix everything? Or do I have to setup Arch's grub before. Home; Packages. I tried Grub2 but could not make it work by chainloading. That update-grub is a Debian thing. In Arch it is not needed as the.
Contents. Preface A is the first software program that runs when a computer starts. It is responsible for selecting, loading and transferring control to an operating system kernel. The kernel, in turn, initializes the rest of the operating system.
The name GRUB officially refers to version 2 of the software. If you are looking for the article on the legacy version, see.
GRUB has a few root file system-specific limitations:. is not supported If your root partition is on an unsupported file system, you must create a separate /boot partition with a supported file system. In some cases, the development version of GRUB AUR has native support. BIOS systems GUID Partition Table (GPT) specific instructions On a BIOS/ configuration, a is required. GRUB embeds its core.img into this partition.
Note:. Before attempting this method keep in mind that not all systems will be able to support this partitioning scheme. Read more on.
This additional partition is only needed on a GRUB, BIOS/GPT partitioning scheme. Previously, for a GRUB, BIOS/MBR partitioning scheme, GRUB used the Post-MBR gap for the embedding the core.img). GRUB for GPT, however, does not use the Post-GPT gap to conform to GPT specifications that require 1megabyte/2048sector disk boundaries. For systems this extra partition is not required, since no embedding of boot sectors takes place in that case. However, UEFI systems still require an.
Create a mebibyte partition ( +1M with or ) on the disk with no file system and with partition type BIOS boot. Select BIOS boot and partition type number 4 for fdisk, ef02 for gdisk, and biosgrub for parted. This partition can be in any position order but has to be on the first 2 TiB of the disk. This partition needs to be created before GRUB installation.
When the partition is ready, install the bootloader as per the instructions below. The post-GPT gap can also be used as the BIOS boot partition though it will be out of GPT alignment specification. Since the partition will not be regularly accessed performance issues can be disregarded, though some disk utilities will display a warning about it.
In fdisk or gdisk create a new partition starting at sector 34 and spanning to 2047 and set the type. To have the viewable partitions begin at the base consider adding this partition last. Master Boot Record (MBR) specific instructions Usually the post- gap (after the 512 byte MBR region and before the start of the first partition) in many MBR (or 'msdos' disklabel) partitioned systems is 31 KiB when DOS compatibility cylinder alignment issues are satisfied in the partition table.
However a post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB's core.img. It is advisable to use a partitioning tool that supports 1 MiB partition alignment to obtain this space as well as to satisfy other non-512 byte sector issues (which are unrelated to embedding of core.img). Installation the package.
It will replace AUR, where already installed. Then do: # grub-install -target=i386-pc /dev/sd x where /dev/sd x is the disk where grub is to be installed. Now you must. If you use for your /boot, you can install GRUB on multiple physical disks.
Note:. It is recommended to read and understand the, and pages.
When installing to use UEFI it is important to start the install with your machine in UEFI mode. The Arch Linux install media must be UEFI bootable. Check if you have GPT and an ESP An (ESP) is needed on every disk you want to boot using EFI. GPT is not strictly necessary, but it is highly recommended and is the only method currently supported in this article. If you are installing Arch Linux on an EFI-capable computer with an already-working operating system, like Windows 8 for example, it is very likely that you already have an ESP. To check for GPT and for an ESP, use parted as root to print the partition table of the disk you want to boot from.
# parted /dev/sd x print For GPT, you are looking for 'Partition Table: gpt'. For EFI, you are looking for a small (512 MiB or less) partition with a vfat/fat32 file system and the boot flag enabled. On it, there should be a directory named 'EFI'. If these criteria are met, this is your ESP. Make note of the partition number. You will need to know which one it is, so you can mount it later on while installing GRUB to it.
In the following of this section esp must be substituted by it in commands. If you do not have an ESP, you will need to create one.
Note: UEFI firmware are not implemented consistently by hardware manufacturers. The installation examples provided are intended to work on the widest range of UEFI systems possible. Those experiencing problems despite applying these methods are encouraged to share detailed information for their hardware-specific cases, especially where solving these problems. A article has been provided for such cases.
Devexpress 15.1.7. This section assumes you are installing GRUB for x8664 systems (x8664-efi). For 32-bit EFI systems (not to be confused with 32-bit CPUs), replace x8664-efi with i386-efi where appropriate. Make sure you are in a shell. The packages and. GRUB is the bootloader, efibootmgr creates bootable.efi stub entries used by the GRUB installation script.
The following steps install the GRUB UEFI application to esp/EFI/grub, install its modules to /boot/grub/x8664-efi, and place the bootable grubx64.efi stub in esp/EFI/grub. First, tell GRUB to use UEFI, set the boot directory and set the bootloader ID.
Mount the ESP partition to e.g. /boot or /boot/efi and in the following change espmount to that mount point (usually /boot): # grub-install -target=x8664-efi -efi-directory= espmount -bootloader-id= grub The -bootloader-id is what appears in the boot options to identify the GRUB EFI boot option; make sure this is something you will recognize later. The install will create a directory of the same name under esp/EFI/ where the EFI binary bootloader will be placed. Tip: If you use the option -removable then GRUB will be installed to esp/EFI/BOOT/BOOTX64.EFI and you will have the additional ability of being able to boot from the drive in case EFI variables are reset or you move the drive to another computer.
Usually you can do this by selecting the drive itself similar to how you would using BIOS. If dual booting with Windows, be aware Windows usually has a folder called boot inside the EFI folder of the EFI partition, but the only purpose this serves is to recreate the EFI boot option for Windows. After the above install finished the main GRUB directory is located at /boot/grub/. Remember to after finalizing.
Note:. While some distributions require a /boot/efi or /boot/EFI directory, Arch does not.efi-directory and -bootloader-id are specific to GRUB UEFI.efi-directory specifies the mountpoint of the ESP. It replaces -root-directory, which is deprecated. You might note the absence of a option (e.g.: /dev/sda) in the grub-install command.
In fact any provided will be ignored by the GRUB install script, as UEFI bootloaders do not use a MBR or partition boot sector at all. See in case of problems. Additionally see.
Generate the main configuration file After the installation, the main configuration file grub.cfg needs to be generated. The generation process can be influenced by a variety of options in /etc/default/grub and scripts in /etc/grub.d/; see.
If you have not done additional configuration, the automatic generation will determine the root filesystem of the system to boot for the configuration file. For that to succeed it is important that the system is either booted or chrooted into.
Note:. The default file path is /boot/grub/grub.cfg, not /boot/grub/i386-pc/grub.cfg.
The package includes a sample /boot/grub/grub.cfg; ensure your intended changes are written to this file. If you are trying to run grub-mkconfig in a chroot or systemd-nspawn container, you might notice that it does not work, complaining that grub-probe cannot get the 'canonical path of /dev/sdaX'. In this case, try using arch-chroot as described in the. Configuration This section only covers editing the /etc/default/grub configuration file.
See for more information. Remember to always after making changes to /etc/default/grub. Additional arguments To pass custom additional arguments to the Linux image, you can set the GRUBCMDLINELINUX + GRUBCMDLINELINUXDEFAULT variables in /etc/default/grub. The two are appended to each other and passed to kernel when generating regular boot entries. For the recovery boot entry, only GRUBCMDLINELINUX is used in the generation.
It is not necessary to use both, but can be useful. For example, you could use GRUBCMDLINELINUXDEFAULT='resume=/dev/sdaX quiet' where sda X is your swap partition to enable resume after hibernation.
This would generate a recovery boot entry without the resume and without quiet suppressing kernel messages during a boot from that menu entry. Though, the other (regular) menu entries would have them as options. By default grub-mkconfig determines the of the root filesystem for the configuration. To disable this, uncomment GRUBDISABLELINUXUUID=true. For generating the GRUB recovery entry you have to ensure that GRUBDISABLERECOVERY is not set to true in /etc/default/grub. You can also use GRUBCMDLINELINUX='resume=UUID=uuid-of-swap-partition' See for more info. Warning: It is the system partition that has /bootmgr, not your 'real' Windows partition (usually C:).
In blkid output, the system partition is the one with LABEL='SYSTEM RESERVED' or LABEL='SYSTEM' and is only about 100 to 200 MB in size (much like the boot partition for Arch). See for more info. Throughout this section, it is assumed your Windows partition is /dev/sda1. A different partition will change every instance of hd0,msdos1. Add the below code to /etc/grub.d/40custom or /boot/grub/custom.cfg and regenerate grub.cfg with grub-mkconfig as explained above to boot Windows (XP, Vista, 7, 8 or 10) installed in BIOS-MBR mode. Note: In some cases, GRUB may be installed without a clean Windows 8, in which case you cannot boot Windows without having an error with boot bcd (error code 0xc000000f). You can fix it by going to Windows Recovery Console (cmd from install disk) and executing: x: 'bootrec.exe /fixboot' x: 'bootrec.exe /RebuildBcd'.
Do not use bootrec.exe /Fixmbr because it will wipe GRUB out. Or you can use Boot Repair function in the Troubleshooting menu - it will not wipe out GRUB but will fix most errors. Also you would better keep plugged in both the target hard drive and your bootable device ONLY. Windows usually fails to repair boot information if any other devices are connected. /etc/grub.d/40custom can be used as a template to create /etc/grub.d/nncustom.
Where nn defines the precendence, indicating the order the script is executed. The order scripts are executed determine the placement in the grub boot menu. Note: nn should be greater than 06 to ensure necessary scripts are executed first. LVM If you use for your /boot or / root partition, make sure that the lvm module is preloaded: /etc/default/grub GRUBPRELOADMODULES='lvm' RAID GRUB provides convenient handling of RAID volumes. You need to add insmod mdraid09 or mdraid1x which allows you to address the volume natively.
For example, /dev/md0 becomes: set root=(md/0) whereas a partitioned RAID volume (e.g. /dev/md0p1) becomes: set root=(md/0,1) To install grub when using RAID1 as the /boot partition (or using /boot housed on a RAID1 root partition), on devices with GPT ef02/'BIOS boot partition', simply run grub-install on both of the drives, such as: # grub-install -target=i386-pc -debug /dev/sda # grub-install -target=i386-pc -debug /dev/sdb Where the RAID 1 array housing /boot is housed on /dev/sda and /dev/sdb.
Note: GRUB currently (Sep 2015) supports booting from RAID 0/1/10, but not RAID 5/6. You may use for RAID 5/6, which is supported by GRUB. Multiple entries For tips on managing multiple GRUB entries, for example when using both and kernels, see. Encryption Root partition To encrypt a root filesystem to be used with GRUB, add the encrypt hook or the sd-encrypt hook (if using systemd hooks) to.
See for details, and for alternative encryption hooks. If using the encrypt hook, add the cryptdevice parameter to /etc/default/grub. In the example below, the sda2 partition has been encrypted as /dev/mapper/cryptroot: /etc/default/grub GRUBCMDLINELINUX='cryptdevice=/dev/sda2:cryptroot' If using the sd-encrypt hook, add luks.uuid: /etc/default/grub GRUBCMDLINELINUX='luks.uuid= UUID' where UUID is the UUID of the LUKS-encrypted device. Be sure to when done. For further information about bootloader configuration for encrypted devices, see. Warning: GRUB does not support LUKS2 headers.
Make sure you do not specify luks2 for the type parameter when creating the encrypted partition using cryptsetup luksFormat. To enable this feature encrypt the partition with /boot residing on it using as normal. Then add the following option to /etc/default/grub: /etc/default/grub GRUBENABLECRYPTODISK=y Be sure to while the partition containing /boot is mounted. Without further changes you will be prompted twice for a passhrase: the first for GRUB to unlock the /boot mount point in early boot, the second to unlock the root filesystem itself as described in. You can use a to avoid this. Note: With a separate boot partition, omit /boot from the path (i.e.
Type set prefix=(hdX,Y)/grub). To expand console capabilities, insert the linux module: grub rescue insmod i386-pc/linux.mod or simply grub rescue insmod linux This introduces the linux and initrd commands, which should be familiar. An example, booting Arch Linux: set root=(hd0,5) linux /boot/vmlinuz-linux root=/dev/sda5 initrd /boot/initramfs-linux.img boot With a separate boot partition (e.g. When using EFI), again change the lines accordingly.
Note: If you experienced error: premature end of file /YOURKERNELNAME during execution of linux command, you can try linux16 instead. After successfully booting the Arch Linux installation, users can correct grub.cfg as needed and then reinstall GRUB.
To reinstall GRUB and fix the problem completely, changing /dev/sda if needed. See for details. Troubleshooting Intel BIOS not booting GPT MBR Some Intel BIOS's require at least one bootable MBR partition to be present at boot, causing GPT-partitioned boot setups to be unbootable. This can be circumvented by using (for instance) fdisk to mark one of the GPT partitions (preferably the 1007 KiB partition you have created for GRUB already) bootable in the MBR. This can be achieved, using fdisk, by the following commands: Start fdisk against the disk you are installing, for instance fdisk /dev/sda, then press a and select the partition you wish to mark as bootable (probably #1) by pressing the corresponding number, finally press w to write the changes to the MBR. Note: The bootable-marking must be done in fdisk or similar, not in GParted or others, as they will not set the bootable flag in the MBR. With cfdisk, the steps are similar, just cfdisk /dev/sda, choose bootable (at the left) in the desired hard disk, and quit saving.
With recent version of parted, you can use disktoggle pmbrboot option. Afterwards verify that Disk Flags show pmbrboot. # parted /dev/sd x disktoggle pmbrboot # parted /dev/sd x print More information is available EFI path Some UEFI firmwares require a bootable file at a known location before they will show UEFI NVRAM boot entries. If this is the case, grub-install will claim efibootmgr has added an entry to boot GRUB, however the entry will not show up in the VisualBIOS boot order selector. The solution is to place a file at one of the known locations.
Grub2 Configuration
Assuming the EFI partition is at /boot/efi/ this will work: mkdir /boot/efi/EFI/boot cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi This solution worked for an Intel DH87MC motherboard with firmware dated Jan 2014. Enable debug messages.
I am trying to install. I installed it correctly but I have some troubles with grub. At the moment I am unable to boot because grub has some errors. I can only access the files via liveCD. I also have no access to pacman via terminal. It tells me that it can not find the db.
My hope is that I can just copy some files to get it working. I have 3 visible partitions.
/, /home and /boot. It is strange that the boot partition is empty. In the root partition is a folder called boot which is empty too. But in the root folder is a folder called /etc/ which contains grub.d Could you give me some pointers? I don't see a reason why you should need to start over, but there are two things you definitely need: a kernel to boot from and the grub configuration folder in /boot. I've not installed Arch for at least 279 days (the current uptime on my home fileserver), and I know things have changed since then so I'm a bit rusty on specifics.
But what you need to do is boot the system from a Live CD/USB and chroot into the Arch system you've built. Not sure if Arch has good documentation on how specifically to chroot into a fresh install. If not check the 'chrooting into the system' section of the Gentoo Handbook.
Should be similar. Once you've chrooted into the real system, you need to use pacman to install the kernel you'd like to use. This /should/ copy the kernel (and any other needed things such as an initramfs) to /boot. (Or does it?) Make sure you have /boot mounted.
If the kernel is not copied over by the pacman install, check for it in /usr/src/linux. (Or check the Arch docs. Again it's been a while.) (Unless of course you're on a EFI system. In which case things could be done much differently, and without grub or any bootloader.) Once you've got the kernel straightened out, use pacman to reinstall grub. Follow the Arch instructions if you're using Grub2 - I've found them to be very well written. There should be a /boot/grub folder once grub is installed and configured properly.
Arch Linux Grub 2
If using Grub2 this will require a grub-mkconfig and possibly some extra steps depending on your hardware. (If using EFI things can be weirder.) If all that fails, only then should you consider starting over.