_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 during grub-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 triggers 41_snapshots-btrfs or grub-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 nor 41_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.
_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:
[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[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-btrfsorgrub-mkconfif there is a change in that directory. (which usually means there is a new snapshot or a snapshot was deleted)grub-btrfsdnor41_snapshots-btrfsare 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-btrfsdat 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-btrfsand its dependency on btrfs-progs. Your problem with snapshots not being created automatically are withgrub-btrfsd, thegrub-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
--syslogin the .service file), so start watching the syslog witchjournalctl -f, in another terminal add--verboseafter syslog in yourgrub-btrfsd.service-file, then restart grub-btrfsd withsystemctl restart grub-btrfsdand watch the output in the other terminal. This should give you a hint why grub-btrfsd is failing.