From ArchWiki
Jump to: navigation, search

Why so overly complicated?

Why not just use the EFI system partition as /boot? This makes setting up direct boot via efistub as easy as efibootmgr -c -l /vmlinuz-linux -u "$(cat /proc/cmdline)" (assuming the ESP is on /dev/sda1). Creshal (talk) 16:44, 17 August 2013 (UTC)

This would be great if it worked reliably. Unfortunately there are too many consumer boards at market right now with NVRAM issues, and I think efibootmgr has rather famously bricked boards in the past. UEFI just isn't that reliable yet. On the other hand, direct firmware boot-loading is nice, and rEFInd is tiny and pretty, so I think it's a good compromise. Also, most Linux users are used to a configurable bootloader so it fits.
Also, your solution, as elegant as it is, doesn't allow for much organization of multiple installs, and you neglected to mention the obligatory /etc/fstab entry.
Still, I think you're right. I've never understood the need for special scripts and services either. /etc/fstab is proven, simple, and portable and can easily handle transparently mounting our /boot for us. And of course, UEFI has already imposed the esp on us so we might as well use it, right?
Yesterday I added the /etc/fstab bind mount section under Sync EFISTUB Kernel. It assumes a separate bootloader, and specifically mentions rEFInd in examples, but requires only an initial configuration and is afterwards managed the same as any other installation would be.
In a nut shell:
$ mkdir -p /esp; mount -L {,/}esp
$ mkdir -p /esp/EFI/boot/new_system/; mv /boot/* $_; mount --bind $_ /boot
$ cat <<'EOF' >/etc/fstab
LABEL=new_rootfs / fstype defaults 0 0
LABEL=esp /esp vfat defaults 0 0
/esp/EFI/boot/new_system /boot none defaults,bind 0 0
$ sed -ri 's/root=[^ ]*/root=LABEL=new_rootfs/g' /boot/refind_linux.conf
Probably that code works. Anyway, it's as simple as mounting your ESP somewhere on your filesystem, creating a separate folder on your ESP for the current install, then bind mounting that folder to /boot. Reflect the config in /etc/fstab and your bootloader.conf and you're done. For good.
Mikeserv (talk) 06:50, 30 September 2013 (UTC)

Issue with the Systemd Automation script

Beta990 has some reason questioning the Systemd Automation script's line:

 cp -r /usr/{share/refind/*,lib/refind/*$arch*} $refind_dir/  && ## update bin and dirs

As it is on the wiki, it just prints this when launched:

 /usr/lib/systemd/scripts/refind_name_patchv2: ligne31: « update-efi-dir » : identifiant non valable

[in English: unvalid identifier]. Unfortunately editing that single line as follow changes nothing:

 cp -r /usr/{share/refind/*,lib/refind/refind_*$arch*.efi} $refind_dir/ && ## update bin and dirs

Next in the wiki, there might be a typo at the end of the systemctl command (see the « ; »):

 Tip: Enable the systemd path unit by running :
 # systemctl enable refind_update.path;

kozaki (talk) 23:31, 3 February 2013 (UTC)

There are at least 2 further issues with these instructions. First, the unit files should really not be installed in /usr. The systemd unit files, for example, should go in /etc/systemd/system/. Second, this won't work any more now rEFInd is entirely in /usr/share/refind rather than split with /usr/lib. Since I don't use any of this, I'm reluctant to change it, though. (I do use systemd units but not the ones here and not with any script.) Could somebody who uses it go through and update it and then test the result? --cfr (talk) 02:25, 25 July 2013 (UTC)
Why not adding refind-install as a (root) cronjob? This checks if an installation exists, and updates it. No need for 'complicated' systemd scripts anymore, right? :)
I use the refind-install method a couple of times, so far no problems.
Could someone please check if this is a better solution?
Thanks. -- Beta990 (talk) 20:56, 11 February 2014 (UTC)

MKinitcpio update hook not working

The mkinitcpio auto-update hook does not work. I get the following output: "Synced to /boot/efi/EFI/arch", along with some cp errors. Obviously, the parameters are not passed.

If i replace the script with the static cp commands from incron, i get the following output, indicating that the image is copied BEFORE the new one is written:

     -> Running build hook: [efistub-update]
   Synced new kernel and initrd to EFIStub.
   ==> Generating module dependencies
   ==> Creating gzip initcpio image: /boot/initramfs-linux.img
   ==> Image generation successful

As a result, my scripts now look as follows:


   build() {
       /usr/local/sbin/efistub-update &
   help() {
       cat <<HELPEOF
   This hook simply waits for mkinitcpio to finish and copies the finished ramdisk and kernel to UEFI



   while [ [ -d "/proc/$PPID" ]]; do
       sleep 1
   /bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/EFIStub/vmlinuz-arch.efi
   /bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/EFIStub/initramfs-arch.img
   /bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/EFIStub/initramfs-arch-fallback.img
   echo "Synced new kernel and initrd to EFIStub."

Also, the does not get chmod +x'ed in the existing example.

--Denoyse (talk) 16:08, 15 February 2013 (UTC)

I think the potential race condition (files being copied before update is done) could also be avoided by changing the watched path to simply /boot. Systemd might be smart enough to only run the service once all changes to the path are complete (i.e. all boot files have been updated). Can a brave user with their ESP not at /boot try this out?
Silverhammermba (talk) 20:46, 7 August 2014 (UTC)
I updated the scripts reflecting Denoyse's suggestions, but the scripts still copy all of the files twice: first after building the regular image and again after building the fallback image. Is there a way to make it only run once, or to have different hooks for each image?
Silverhammermba (talk) 04:14, 1 March 2013 (UTC)

Sync EFISTUB Kernel scripts need to be updated because of the move to /usr/bin

Hi everyone,

I think the sync EFISTUB Kernel scripts should be updated. All of them point to /bin/cp, but since the move to /usr/bin they should be pointing to /usr/bin/cp.

I can do it but I was just wondering if it would be agood idea to add a warning somewhere to tell people to update their scripts.

Cheers Femtomatic (talk) 19:32, 15 June 2013 (UTC)

+1 for a note about the change. -- Fengchao (talk) 03:02, 21 June 2013 (UTC)

fix paths on direct boot script

vmlinux and initramfs files path on direct boot script are not the same as on the other scripts on the page, I think it's better to change the direct boot script as follow

# mount -t efivarfs efivarfs /sys/firmware/efi/efivars              # ignore if already mounted
# efibootmgr -d /dev/sdX -p Y -c -L "Arch Linux" -l '\EFI\arch\vmlinuz-linux' -u "root=/dev/sda2 rw initrd=/EFI/arch/initramfs-linux.img"

Lejenome (talk) 14:43, 10 May 2014 (UTC)

ESP mount points

EFISTUB#Alternative ESP Mount Points complicates things for no good reason. I don't think we should document various weird ways to put kernel and initramfs on ESP. I propose removing EFISTUB#Setting up EFISTUB and adjusting EFI System Partition#Mount the partition to contain only two options:

  • ESP mounted as /boot
  • ESP mounted as /boot/efi and using a bootloader with filesystem drivers (e.g. GRUB, rEFInd, etc.)

-- nl6720 (talk) 09:51, 8 January 2017 (UTC)

Agree, if you don't read the article (scanning) it looks like it is needed to perform the actions.
Don't know about removing them, maybe they should be placed under an Advanced Configuration section.
Francoism (talk) 16:33, 8 January 2017 (UTC)
I am against removing the information entirely since it is necessary for certain boot setups. However I am fine with having it lower in the article and placing more emphasis on the simpler alternatives you mention. Silverhammermba (talk) 16:24, 9 January 2017 (UTC)
Which certain boot setups require it and isn't using EFI System Partition#Using bind mount much simpler? -- nl6720 (talk) 12:45, 10 January 2017 (UTC)
For systems not using /boot as mount point. My previous setup did use a separate /boot and /boot/efi. The instructions show that you can use a different partition, HDD and even an USB (although not recommended). It may also help on tablets that require a specific kind of layout(?). The bind option is not an option when using a non FAT32 filesystem. Francoism (talk) 13:36, 10 January 2017 (UTC)
So you used a /boot with a filesystem which your bootloader (or firmware itself) didn't support and were forced to copy the kernel & initramfs to ESP to work around it. Is there a reason to not use ESP as /boot in such situations, or am I missing something?
Anyway, looks like there's no support for removing EFISTUB#Alternative ESP Mount Points. As the merge template states that section applies to more than EFISTUB, so lets move it to EFI System Partition#Tips and tricks. I'd also like to remove "Using incron" section, incron is not installed by default and systemd path provides the same functionality. -- nl6720 (talk) 11:14, 13 January 2017 (UTC)
You're correct, but there are always reasons why users are forced into this kind of setup.
I'm against the removal to be honest, the user should have a choice, and a valid point is some users use the Arch Wiki as reference for other distro's that don't always support systemd. That's also what makes the ArchWiki strong, although it is focused on Arch, most config work perfectly (with minor modification) OK on let's say Ubuntu.
Francoism (talk) 11:46, 13 January 2017 (UTC)