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)

Why to move from /boot to /boot/esp/EFI/arch ?

I do not well know the boot process, but if I understand, in the Alternative ESP Mount Points, it is write to move or copy kernel and initramfs from /boot/vmlinuz-linux to /boot/esp/EFI/arch/vmlinuz-linux. Isn't possible to simply put in mkinitcpi.d/linux.preset something like


and to get rid of the copy/move part ?

—This unsigned comment is by Ryuta (talk) 07:06, 2017 July 8‎. Please sign your posts with ~~~~!

That looks like a much better solution to me. If you have confirmed that such a setup works, I would go ahead and replace the currently suggested methods. Silverhammermba (talk) 20:59, 8 July 2017 (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

[Moved to Talk:EFI System Partition#ESP mount points. -- nl6720 (talk) 09:44, 11 December 2017 (UTC)]