grub-btrfsd not working with systemd on Debian
Schievel1 opened this issue · comments
_Sorry to derail this PR slightly but can I just ask if @lmmarsano has got auto-updating of the GRUB menu working using systemd (under Ubuntu)? If so, how? Did the README instructions work for you?
Here's how I currently have it configured under Debian #270
Ideally the grub menu would get updated every time a snapshot is created or removed, unlike my current solution of updating GRUB at shutdown or reboot, which at least works reliably but I'd prefer the GRUB menu got updated instantly._
Originally posted by @danboid in #250 (comment)
Ok, let me clarify a few things first. The architecture of this whole grub-btrfs thing is a follows:
- There is
[41_snapshots-btrfs](https://github.com/Antynea/grub-btrfs/blob/master/41_snapshots-btrfs)
which uses the output of btrfs-progs' snapshot list to create a snapshots submenu. It is either run manually or duringgrub-mkconf
. It is completely independent from systemd, openrc and also grub-btrfsd. It depends on btrfs-progs output, though, which was kind of unstable lately - Then there is
[grub-btrfsd](https://github.com/Antynea/grub-btrfs/blob/master/grub-btrfsd)
which is a script that watches a directory for changes. (usually the directory where your snapshots are) and triggers41_snapshots-btrfs
orgrub-mkconf
if there is a change in that directory. (which usually means there is a new snapshot or a snapshot was deleted) - Neither
grub-btrfsd
nor41_snapshots-btrfs
are connected to systemd or openrc in any way. This is what[grub-btrfsd.service](https://github.com/Antynea/grub-btrfs/blob/master/grub-btrfsd.service)
(for systemd) and[grub-btrfsd.initd/confd](https://github.com/Antynea/grub-btrfs/blob/master/grub-btrfsd.initd)
are for. They tell their respective init systems how and when to run grub-btrfsd. (usually at system startup) This is the only connection, in fact a user could also run/usr/bin/grub-btrfsd
at every system startup, and it would have the same effect.
So, when you posted your problem with snapshot menu creation in that other issue, it was a problem with 41_snapshots-btrfs
and its dependency on btrfs-progs. Your problem with snapshots not being created automatically are with grub-btrfsd
, the grub-btrfsd.service
-file and with systemd. So lets figure that out here.
Let's check first if grub-btrfsd is runnig ok. If you run it as a systemd service, it usually outputs to syslog (when its started with --syslog
in the .service file), so start watching the syslog witch journalctl -f
, in another terminal add --verbose
after syslog in your grub-btrfsd.service
-file, then restart grub-btrfsd with systemctl restart grub-btrfsd
and watch the output in the other terminal. This should give you a hint why grub-btrfsd is failing.
Hi @Schievel1
Here's what I did to install grub-btrfs under Debian 11:
Install timeshift and inotify-tools, configure timeshift, created some snapshots then:
git clone https://github.com/Antynea/grub-btrfs.git
cd grub-btrfs
sudo make install
sudo systemctl edit --full grub-btrfsd
edit the ExecStart command to be like:
ExecStart=/usr/bin/grub-btrfsd --syslog --verbose --timeshift-auto
Then if I restart the grub-btrfsd service I get the following output:
I've not read through the source of grub-btrfsd yet but it seems that by default timeshift under Debian 11 (v20.11.1) stores snapshots under /run/timeshift/backup
instead of /run/timeshift/$PID
so should snapshots in /run/timeshift/backup
get detected by --timeshift-auto
? Looks like the snapshot directories var is undefined here.
I had two timeshift snapshots created when I restarted grub-btrfsd but nothing got detected or added to GRUB.
Yes, timeshift in Debian 11 is on version 20.11. They introduced storing snapshots under the $PID in 22.06.
Can you try with ExecStart=/usr/bin/grub-btrfsd --syslog --verbose --timeshift-auto --timeshift-old
?
Hey, I just noticed that I messed up timeshift support when I updated grub-btrfd to take multiple directories. I fixed it and timeshift is working for me again. Do you mint to try with the latest commit?
Hey, I just noticed that I messed up timeshift support when I updated grub-btrfd to take multiple directories. I fixed it and timeshift is working for me again. Do you mint to try with the latest commit?
Yesterday I attempted to setup grub-btrfs with timeshift 22.11.2 on Debian 12 but snapshots were never found. I Just did a pull and it once again works as it should. I'd say your fix worked.
Hey, I just noticed that I messed up timeshift support when I updated grub-btrfd to take multiple directories. I fixed it and timeshift is working for me again. Do you mint to try with the latest commit?
Yesterday I attempted to setup grub-btrfs with timeshift 22.11.2 on Debian 12 but snapshots were never found. I Just did a pull and it once again works as it should. I'd say your fix worked.
Thanks, but what you experienced is rather this issue here: #273
What we have here is rather about the daemon that automatically triggers the update of the snapshots menu refusing to run with timeshift.
Yes this issue seems to be fixed with the latest updates.