You are not logged in.

#1 2013-07-09 23:46:59

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Timing issues with systemd units auto-updating rEFInd on ESP

Aim: I wanted to use systemd to auto-update the following files and directories in EFI/arch_refind/:

drivers_x64/ext4_x64.efi  fonts/  icons/   refind_x64.efi

Initially, I tried to do this with a single .path and .service pair but although it worked initially, I had problems with things respawning too quickly. As a result I ended up with nothingness on the ESP. I figured that the problem might be that because I had different changed-path conditions in the .path file, the .service file was getting run multiple times as pacman updated the refind package. In an attempt to address this, I split the files into four pairs with each one handling a specific change.

For updating the .efi itself:

# /etc/systemd/system/refind-update-efi.path

[Unit]
Description=Copy rEFInd EFI to UEFISYS Partition

[Path]
PathChanged=/usr/lib/refind/refind_x64.efi

[Install]
WantedBy=multi-user.target

and:

# /etc/systemd/system/refind-update-efi.service

[Unit]
Description=Copy rEFInd EFI to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/usr/bin/cp -f /usr/lib/refind/refind_x64.efi /boot/efi/EFI/arch_refind/refind_x64.efi 

For updating the file system driver:

# /etc/systemd/system/refind-update-ext4.path

[Unit]
Description=Copy rEFInd ext4 driver to UEFISYS Partition

[Path]
PathChanged=/usr/lib/refind/drivers_x64/ext4_x64.efi

[Install]
WantedBy=multi-user.target

and:

# /etc/systemd/system/refind-update-ext4.service

[Unit]
Description=Copy rEFInd ext4 driver to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/usr/bin/mkdir -p /boot/efi/EFI/arch_refind/drivers_x64
ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/ext4_x64.efi /boot/efi/EFI/arch_refind/drivers_x64/ext4_x64.efi

For the fonts directory:

# /etc/systemd/system/refind-update-fonts.path

[Unit]
Description=Copy rEFInd fonts to UEFISYS Partition

[Path]
PathChanged=/usr/share/refind/fonts

[Install]
WantedBy=multi-user.target

and:

# /etc/systemd/system/refind-update-fonts.service

[Unit]
Description=Copy rEFInd fonts to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/fonts
ExecStart=/usr/bin/cp -pr /usr/share/refind/fonts /boot/efi/EFI/arch_refind/fonts 

For the icons directory:

# /etc/systemd/system/refind-update-icons.path

[Unit]
Description=Copy rEFInd icons to UEFISYS Partition

[Path]
PathChanged=/usr/share/refind/icons

[Install]
WantedBy=multi-user.target

and:

# /etc/systemd/system/refind-update-icons.service

[Unit]
Description=Copy rEFInd icons to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/icons
ExecStart=/usr/bin/cp -pr /usr/share/refind/icons /boot/efi/EFI/arch_refind/icons 

However, I am still getting errors:

Gor 09 01:40:58 MyComputer systemd[1]: Stopping Copy rEFInd fonts to UEFISYS Partition.
Gor 09 01:42:25 MyComputer systemd[1]: Starting Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopping Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopped Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopping Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopped Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopping Copy rEFInd EFI to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopped Copy rEFInd EFI to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopping Copy rEFInd icons to UEFISYS Partition.
Gor 09 02:25:21 MyComputer systemd[1]: Stopped Copy rEFInd icons to UEFISYS Partition.
Gor 09 02:26:13 MyComputer systemd[1]: Starting Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopping Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopped Copy rEFInd fonts to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopping Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopped Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopping Copy rEFInd EFI to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopped Copy rEFInd EFI to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopping Copy rEFInd icons to UEFISYS Partition.
Gor 09 02:29:47 MyComputer systemd[1]: Stopped Copy rEFInd icons to UEFISYS Partition.
<refind is upgraded at 22:24 according to pacman's log>
Gor 09 22:24:47 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd fonts to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd EFI to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd ext4 driver to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd fonts to UEFISYS Partition.
Gor 09 22:24:48 MyComputer cp[13179]: /usr/bin/cp: cannot stat ‘/usr/lib/refind/drivers_x64/ext4_x64.efi’: No such file or directory
Gor 09 22:24:48 MyComputer cp[13174]: /usr/bin/cp: cannot stat ‘/usr/lib/refind/refind_x64.efi’: No such file or directory
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-efi.service: main process exited, code=exited, status=1/FAILURE
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd EFI to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Unit refind-update-efi.service entered failed state.
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-ext4.service: main process exited, code=exited, status=1/FAILURE
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Unit refind-update-ext4.service entered failed state.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd EFI to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd EFI to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd ext4 driver to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Unit refind-update-icons.service entered failed state.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd icons to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: refind-update-icons.service start request repeated too quickly, refusing to start.
Gor 09 22:24:48 MyComputer systemd[1]: Failed to start Copy rEFInd icons to UEFISYS Partition.
Gor 09 22:24:48 MyComputer systemd[1]: Starting Copy rEFInd fonts to UEFISYS Partition...
Gor 09 22:24:48 MyComputer systemd[1]: Started Copy rEFInd fonts to UEFISYS Partition.
<reboot to test kernel>
Gor 10 00:05:41 MyComputer systemd[1]: Stopping Copy rEFInd fonts to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopped Copy rEFInd fonts to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopping Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopped Copy rEFInd ext4 driver to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopping Copy rEFInd EFI to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopped Copy rEFInd EFI to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopping Copy rEFInd icons to UEFISYS Partition.
Gor 10 00:05:41 MyComputer systemd[1]: Stopped Copy rEFInd icons to UEFISYS Partition.
Gor 10 00:07:22 MyComputer systemd[1]: Starting Copy rEFInd fonts to UEFISYS Partition.

It seems that systemd is too quick. It notices that something has changed e.g. that /usr/lib/refind/refind_x64.efi has been removed, triggers the service and then finds there is no /usr/lib/refind/refind_x64.efi to copy because the new version has not yet been installed. In the case of the .efi files, the service always seems to somehow manage to get everything into place but in the case of the fonts and icons (icons shown above), it often does not.

I'm not sure why this happens because I based this on the service file I found the wiki for keeping the kernel and initramfs synced to the ESP. So I would think it should work for at least the single file cases, if not the directories. Indeed my EFI update service syncs the kernel and initramfsx2 to the ESP flawlessly (up to now) even though the .path unit for that includes 3 triggering conditions and the .service and .path files are set up just the same.

I've read the manual pages for systemd.{path,service,unit} and couldn't see anything obviously helpful although I'm curious about timer units so I looked at the information on those but I guess they are for rather more sophisticated services than mine. I also looked at the wiki for systemd but it does not say anything about this kind of issue.

Intuitively, I wondered if there is not a clean way of telling systemd to wait until changes to the path have completed before running the service. Obviously I can think of ways to force the service to wait just by using sleep or something but I am sure that that is not the correct way to do it. So I'm pretty sure there is something wrong about the way I've set these up but I am just not seeing what it is. Any hints would be appreciated!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#2 2013-07-10 01:15:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

How exactly does pacman update files?  Does it first remove the files from the old package before writing the new ones to disk?  I really have no idea, but if that is the case, it is understandable why it would be failing.  The path changes from existing to not existing (before the new version is written) and it is at this point that systemd tries to copy the files.  But again, I am not sure if this is correct.

Just as a simple test, can you see if adding and "ExecStartPre=/usr/bin/sleep 10" changes things?  I do not think that you need that much of a timeout since the package is not very big.  But I figure 10 seconds will definitely ensure that the package is fully installed before proceeding. 

I guess in the service file, you could have a ConditionPathExists, but I don't think that would actually wait for the file to come into existence, so much as just fail because the path doesn't exist.

The only other thing I can think of would be to have one systemd.path with PathChanged launch another systemd.path with PathExists, which in turn launched the oneshot service.  But that just seems waaaaayyyy hacky.

Offline

#3 2013-07-10 01:24:12

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Timing issues with systemd units auto-updating rEFInd on ESP

It seems to me that telling systemd to scan for changes to the copy of rEFInd in /usr/lib/refind is the wrong way to achieve your goal, which seems to be to upgrade rEFInd on your ESP whenever the Arch package is updated. A better approach is to include rEFInd's install.sh script in the Arch package and execute that script when the package is installed. Some extra logic (or another Arch-specific script) could be included to determine what options to pass to install.sh, or perhaps whether or not it should be run at all. As rEFInd's maintainer, I'd be happy to discuss changes to install.sh to help make it more friendly to distributions' needs, so long as any changes aren't too distribution-specific. The last I heard, though, the Arch package for rEFInd omitted install.sh, as well as two other support scripts, mkrlconf.sh and mvrefind.sh. Thus, my suggestion would require some updating of the Arch rEFInd package.

Offline

#4 2013-07-10 02:19:46

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

I think a feature request is in order here.  Though I think that it would be better coming from someone who at least uses rEFInd as their main boot manager.  I fail to understand why that script is not included in the first place.  It would seem like more fitting of The Arch Way to leave the package as is, or as close to how Rod intended it to be.

Offline

#5 2013-07-10 22:39:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

@WonderWoofy,
Thanks. I guess it is not just me missing something, then. But I wonder why it works for kernel packages but not rEFInd...

I think part of the problem is that the path changes too much too quickly and I'm not sure that sleeping will address that though it will probably (I guess) get the thing to work despite errors. At least, need to test...

This can't be that odd of a thing to want to do, can it? I don't mean with packages specifically but watching a path and taking action where the path is likely to undergo several changes in rapid succession. I'm surprised, in a sense, systemd cannot accommodate it in some way - just because it seems to have thought of virtually everything else!

@srs5694/WonderWoofy,
I thought that this suggestion had been raised before and that the answer was "no" though I cannot remember the details. Perhaps I'm wrong about this? Does anybody know the reason for not including those scripts? Given that Arch prefers to install vanilla packages unless all hell will break lose by doing so, I would expect there to be at least a reasonable case for not shipping rEFInd as is?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#6 2013-07-11 00:36:44

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

I just came across this while searching for something else. Since I've obviously been there before, this may even have been what gave me the idea in the first place and I just forgot the origin.

What I cannot see is why it works for the.ridikulus.rat but not me! Or what is relevantly different in that setup...


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#7 2013-07-11 01:02:12

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Maybe because he has so many matches in that systemd.path, that it is potentially being run over and over again?  Then, instead of separating out all the pieces and parts, he has a monolithic oneshot that just takes care of everything.

Offline

#8 2013-07-11 01:50:04

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

That's what I tried first of all, though - a whole bunch of conditions in the .path file and then everything it needed to do in the .service file.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2013-07-11 02:21:22

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Hmmm... I'm not sure then.  I've never tried with anything but the kernel, and the way I have that set up, it actually moves the file instead of simply copying it (it would be on the ESP twice otherwise since I mount at /boot).  So the only time the PathExistsGlob=/boot/vmlinux-* is satisfied is when the package actually writes the update to disk. So it is executed at a properly sane time.

Offline

#10 2013-07-11 02:28:00

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

It works fine for me with the kernel even though it is copying it.

# /etc/systemd/system/efistub-update.path
# ref: https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Sync_EFISTUB_Kernel_in_UEFISYS_partition_using_Systemd

[Unit]
Description=Copy EFISTUB Kernel to UEFISYS Partition

[Path]
PathChanged=/boot/vmlinuz-linux
PathChanged=/boot/initramfs-linux.img
PathChanged=/boot/initramfs-linux-fallback.img

[Install]
WantedBy=multi-user.target
# /etc/systemd/system/efistub-update.service
# ref: https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Sync_EFISTUB_Kernel_in_UEFISYS_partition_using_Systemd

[Unit]
Description=Copy EFISTUB Kernel to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/bin/cp -f /boot/vmlinuz-linux /boot/efi/EFI/arch/vmlinuz-linux.efi
ExecStart=/bin/cp -f /boot/initramfs-linux.img /boot/efi/EFI/arch/initramfs-linux.img
ExecStart=/bin/cp -f /boot/initramfs-linux-fallback.img /boot/efi/EFI/arch/initramfs-linux-fallback.img

Not that I actually need this but it does work flawlessly. (Doesn't boot, naturally, but not because it is misplaced!)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#11 2013-07-11 03:38:18

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Well that is quite odd then... honestly, I don't really know what to tell you about the rEFInd one.

Offline

#12 2013-07-11 13:56:09

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: Timing issues with systemd units auto-updating rEFInd on ESP

I have actually modified the refind path/service units somewhat, but it still works flawlessly for me. I usually wait for 2-5 min after pkg updates so that all the changes are synced to EFISYS before I reboot. There are the ones I use currently:

refind-efi_copy.path

[Unit]
Description=Copy rEFInd files to EFI System Partition

[Path]
PathChanged=/usr/lib/refind/refind_x64.efi

PathChanged=/usr/lib/refind/drivers_x64/ext4_x64.efi
PathChanged=/usr/lib/refind/drivers_x64/btrfs_x64.efi
PathChanged=/usr/lib/refind/drivers_x64/reiserfs_x64.efi
PathChanged=/usr/lib/refind/drivers_x64/iso9660_x64.efi
PathChanged=/usr/lib/refind/drivers_x64/hfs_x64.efi

PathChanged=/mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi.conf
PathChanged=/mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_linux.conf
PathChanged=/mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_linux_boot.conf
PathChanged=/mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_archboot.conf

Unit=refind-efi_copy.service

[Install]
WantedBy=multi-user.target

refind-efi_copy.service

[Unit]
Description=Copy rEFInd files to EFI System Partition
# Requires=efisys.mount

[Service]
Type=oneshot

ExecStart=/usr/bin/cp -f /usr/lib/refind/refind_x64.efi /efisys/EFI/refind/refind_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/refind/refind_x64.efi /usr/lib/refind/refind_x64.efi


ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/ext4_x64.efi /efisys/EFI/tools/drivers_x64/ext4_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/tools/drivers_x64/ext4_x64.efi /usr/lib/refind/drivers_x64/ext4_x64.efi

ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/btrfs_x64.efi /efisys/EFI/tools/drivers_x64/btrfs_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/tools/drivers_x64/btrfs_x64.efi /usr/lib/refind/drivers_x64/btrfs_x64.efi

ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/reiserfs_x64.efi /efisys/EFI/tools/drivers_x64/reiserfs_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/tools/drivers_x64/reiserfs_x64.efi /usr/lib/refind/drivers_x64/reiserfs_x64.efi

ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/iso9660_x64.efi /efisys/EFI/tools/drivers_x64/iso9660_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/tools/drivers_x64/iso9660_x64.efi /usr/lib/refind/drivers_x64/iso9660_x64.efi

ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/hfs_x64.efi /efisys/EFI/tools/drivers_x64/hfs_x64.efi
ExecStart=/usr/bin/sbsign --key /efisys/EFI/tools/efitools/db.key --cert /efisys/EFI/tools/efitools/db.crt --output /efisys/EFI/tools/drivers_x64/hfs_x64.efi /usr/lib/refind/drivers_x64/hfs_x64.efi


ExecStart=/usr/bin/cp -f /mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi.conf /efisys/EFI/refind/refind.conf
ExecStart=/usr/bin/cp -f /mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi.conf /efisys/EFI/boot/refind.conf

ExecStart=/usr/bin/cp -f /mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_linux.conf /efisys/EFI/arch/core/refind_linux.conf
ExecStart=/usr/bin/cp -f /mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_linux.conf /efisys/EFI/arch/mainline/refind_linux.conf

ExecStart=/usr/bin/cp -f /mnt/Source_Codes_Partition/Source_Codes/My_Files/Bootloader_Config_Files/refind_uefi/refind_uefi_linux_boot.conf /boot/refind_linux.conf


ExecStart=/usr/bin/rm -rf /efisys/EFI/refind/icons
ExecStart=/usr/bin/cp -rf /usr/share/refind/icons /efisys/EFI/refind/icons

ExecStart=/usr/bin/rm -rf /efisys/EFI/refind/fonts
ExecStart=/usr/bin/cp -rf /usr/share/refind/fonts /efisys/EFI/refind/fonts

Last edited by the.ridikulus.rat (2013-07-11 15:16:18)

Offline

#13 2013-07-11 14:53:10

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Is this modified at all the.ridikulus.rat?  Or do you really mount your ESP at a self made /efisys directory?

Offline

#14 2013-07-11 14:55:07

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Yes, I mount my ESP at /efisys. I do not want pacman or any other efi related tool to touch my ESP, so no /boot or /boot/efi .

Offline

#15 2013-07-11 20:54:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

Maybe I shouldn't be using PathChanged for directories but just monitor the specific files? Though I do get errors even for the .efi copy service - but I've never ended up with the .efi being updated.

EDIT: This should have said "I've never ended up with the .efi not being updated"!

Last edited by cfr (2013-07-14 20:17:07)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#16 2013-07-14 20:23:35

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

So I tried the following, reverting to a single path/service pair:

# /etc/systemd/system/refind-update.path

[Unit]
Description=Copy rEFInd to UEFISYS Partition

[Path]
PathChanged=/usr/lib/refind/refind_x64.efi
PathChanged=/usr/lib/refind/drivers_x64/ext4_x64.efi

[Install]
WantedBy=multi-user.target
# /etc/systemd/system/refind-update.service

[Unit]
Description=Copy rEFInd to UEFISYS Partition

[Service]
Type=oneshot
ExecStart=/usr/bin/cp -f /usr/lib/refind/refind_x64.efi /boot/efi/EFI/arch_refind/refind_x64.efi 
ExecStart=/usr/bin/mkdir -p /boot/efi/EFI/arch_refind/drivers_x64
ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/ext4_x64.efi /boot/efi/EFI/arch_refind/drivers_x64/ext4_x64.efi
ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/fonts
ExecStart=/usr/bin/cp -pr /usr/share/refind/fonts /boot/efi/EFI/arch_refind/fonts 
ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/icons
ExecStart=/usr/bin/cp -pr /usr/share/refind/icons /boot/efi/EFI/arch_refind/icons 

And I waited for an update which just happened. Unfortunately, it doesn't seem to have helped. Although I now get no errors, something is definitely not right.

systemctl status yields:

refind-update.path - Copy rEFInd to UEFISYS Partition
   Loaded: loaded (/etc/systemd/system/refind-update.path; enabled)
   Active: active (waiting) since Sad 2013-07-13 23:02:18 BST; 22h ago

refind-update.service - Copy rEFInd to UEFISYS Partition
   Loaded: loaded (/etc/systemd/system/refind-update.service; static)
   Active: inactive (dead) since Sul 2013-07-14 20:58:16 BST; 22min ago
  Process: 27931 ExecStart=/usr/bin/cp -pr /usr/share/refind/icons /boot/efi/EFI/arch_refind/icons (code=exited, status=0/SUCCESS)
  Process: 27929 ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/icons (code=exited, status=0/SUCCESS)
  Process: 27927 ExecStart=/usr/bin/cp -pr /usr/share/refind/fonts /boot/efi/EFI/arch_refind/fonts (code=exited, status=0/SUCCESS)
  Process: 27924 ExecStart=/usr/bin/rm -rf /boot/efi/EFI/arch_refind/fonts (code=exited, status=0/SUCCESS)
  Process: 27923 ExecStart=/usr/bin/cp -f /usr/lib/refind/drivers_x64/ext4_x64.efi /boot/efi/EFI/arch_refind/drivers_x64/ext4_x64.efi (code=exited, status=0/SUCCESS)
  Process: 27922 ExecStart=/usr/bin/mkdir -p /boot/efi/EFI/arch_refind/drivers_x64 (code=exited, status=0/SUCCESS)
  Process: 27920 ExecStart=/usr/bin/cp -f /usr/lib/refind/refind_x64.efi /boot/efi/EFI/arch_refind/refind_x64.efi (code=exited, status=0/SUCCESS)

Gor 14 20:58:16 <MyComputer> systemd[1]: Started Copy rEFInd to UEFISYS Partition.

As before, the main .efi and the ext4 driver are updated just fine. Moreover, the old fonts and icons get deleted. However, I end up with /boot/efi/EFI/arch_refind/{fonts,icons} being entirely empty which is not what I had hoped!

Can anybody see what I'm doing wrong? If it works for other people, it should work on my machine, too, if I can just avoid idiocy!

Last edited by cfr (2013-07-14 20:26:50)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#17 2013-07-14 20:55:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,168

Re: Timing issues with systemd units auto-updating rEFInd on ESP

I created a feature request for the upstream scripts to be included in Arch's package.

See https://bugs.archlinux.org/task/36151. Please comment or vote as you see fit. I think that a direct comment from upstream might be more effective than the link I have created back to the comment in this thread, but obviously it us up to readers of this thread to respond as they think fit.

EDIT: Apologies but I think I pasted a link which may have automatically got you to vote. I did not intend this and I apologise if I caused WonderWoofy to vote inadvertently. (This applies to at most WonderWoofy but I certainly apologise to him. You can obviously remove your vote using the removal link if desired.) For others, I think I have secured the link for democracy now.

Last edited by cfr (2013-07-14 23:10:38)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#18 2013-07-15 02:53:55

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: Timing issues with systemd units auto-updating rEFInd on ESP

cfr wrote:

I created a feature request for the upstream scripts to be included in Arch's package.

See https://bugs.archlinux.org/task/36151. Please comment or vote as you see fit. I think that a direct comment from upstream might be more effective than the link I have created back to the comment in this thread, but obviously it us up to readers of this thread to respond as they think fit.

I've added my comment as the upstream provider, along with some further suggestions.

EDIT: Apologies but I think I pasted a link which may have automatically got you to vote. I did not intend this and I apologise if I caused WonderWoofy to vote inadvertently. (This applies to at most WonderWoofy but I certainly apologise to him. You can obviously remove your vote using the removal link if desired.) For others, I think I have secured the link for democracy now.

When I clicked it did not automatically vote, but I've added my vote.

Offline

#19 2013-07-15 04:33:14

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Timing issues with systemd units auto-updating rEFInd on ESP

I intended to vote when I got to the page anyway, so it resulted in what I planned to do.

@srs5694, just so you know, /usr/sbin is now a symlink to /usr/bin.  I am not sure if you are currently running Arch, but we just switched to a unified /usr/bin (/bin, /sbin, and /usr/sbin all point to /usr/bin).  Also, the keys are in fact provided now.  I think that they started adding this when the prebootloader was added to the repos... but I can't be entirely sure without checking.  That is when I noticed them anyway.

Offline

Board footer

Powered by FluxBB