You are not logged in.
Hi!
I am using snapper to create btrfs snapshots of / and because /boot has fat32 filesystem, /boot snapshots aren't included.
Therefore I've turned to the ArchWiki and found the section Snapshots and /boot partition. However, I've got a problem with this setup.
Directory /.bootbackup gets created, however, it is incomplete as inside /.bootbackup/boot there is only:
$ ls -lA /.bootbackup/boot
total 4596
drwxr-xr-x 1 root root 8 Jan 1 16:21 EFI
drwxr-xr-x 1 root root 84 Feb 3 19:59 grub
-rwxr-xr-x 1 root root 4706304 Feb 8 22:07 intel-ucode.imgWhile inside /boot there is:
$ ls -lA /boot
total 86788
drwxr-xr-x 3 root root 4096 Jan 1 16:21 EFI
drwxr-xr-x 6 root root 4096 Feb 3 19:59 grub
-rwxr-xr-x 1 root root 49316328 Mar 2 17:18 initramfs-linux-fallback.img
-rwxr-xr-x 1 root root 24356061 Mar 2 17:18 initramfs-linux.img
-rwxr-xr-x 1 root root 4706304 Feb 8 22:07 intel-ucode.img
-rwxr-xr-x 1 root root 10477568 Mar 2 17:18 vmlinuz-linuxI used the pacman hook exactly as stated on the Wiki which creates incomplete backups. However, when I ran rsync manually to test it, backups were complete. So the pacman hook must somehow interrupt the rsync process.
I am definitely not an expert on systemd, but in order to daemonize the process I created:
# /etc/pacman.d/hooks/50-bootbackup.hook
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Path
Target = usr/lib/modules/*/vmlinuz
[Action]
Depends = rsync
Description = Backing up /boot...
When = PostTransaction
Exec = /usr/bin/systemctl restart bootbackup.service# /etc/systemd/system/bootbackup.service
[Unit]
Description=Backup /boot into /.bootbackup
[Service]
TimeoutStartSec=600
ExecStartPre=/usr/bin/sleep 180
ExecStart=/usr/bin/rsync -a --delete /boot /.bootbackupMy idea was for the service to wait 3 minutes (enough time for the linux upgrade to finish) and then launch. But that doesn't work as it just waits 3 minutes during the time pacman runs and creates an incomplete backup again.
I am out of ideas. Do you have any? Thanks!
Last edited by goldmund (2022-03-05 13:05:54)
Offline
My idea was for the service to wait 3 minutes (enough time for the linux upgrade to finish)
If by this you mean 90-mkinitcpio-install.hook, couldn't you change the 50 to something > 90 so your hook runs after mkinitcpio?
But that doesn't work as it just waits 3 minutes during the time pacman runs
ExecStartPre is part of the start-up phase and systemctl waits for start-up to complete unless you use --no-block.
Offline
goldmund wrote:My idea was for the service to wait 3 minutes (enough time for the linux upgrade to finish)
If by this you mean 90-mkinitcpio-install.hook, couldn't you change the 50 to something > 90 so your hook runs after mkinitcpio?
But that doesn't work as it just waits 3 minutes during the time pacman runs
ExecStartPre is part of the start-up phase and systemctl waits for start-up to complete unless you use --no-block.
Thanks, both of your suggestions helped me solve the issue. Complete backups are now being created.
Should the ArchWiki be changed to include a systemd service which daemonizes the rsync process or which increases the number inside filename (/etc/pacman.d/hooks/50-bootbackup.hook) > 90? The current setup doesn't seem to be working.
Will mark as solved if there are no answers within a day.
Last edited by goldmund (2022-03-05 10:18:08)
Offline
Just tested this and changing the filename to 95-bootbackup.hook does the job, no need for a systemd service.
I've never changed the Wiki, would you advise changing:
/etc/pacman.d/hooks/50-bootbackup.hook > /etc/pacman.d/hooks/95-bootbackup.hook
?
Last edited by goldmund (2022-03-05 11:00:35)
Offline
Sure, it seems broken right now, so you could at least make a minimal edit to get something that works. It might be good to explicitly mention the reason for the 95.
Offline
Sure, it seems broken right now, so you could at least make a minimal edit to get something that works. It might be good to explicitly mention the reason for the 95.
Will do. Thanks! Marking as solved.
Offline