You are not logged in.

#1 2024-12-07 18:12:17

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

grub-btrfs: no update for grub menu upon snapshot creation or deletion

I had managed to set up "grub-btrfs" for it to work with "inotify-tools", "timeshift" and "timeshift-autosnap" However at some point the grub menu stopped refreshing. Despite creation or deletion of snapshots it remains the same. I can't figure out what is the problem. Please help me

I didn't forget to change the .service file of grub-btrfsd from "ExecStart=/usr/bin/grub-btrfsd /.snapshots --syslog" to "ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto"

This is the output of "journalctl -f" when i create and delete a snapshot in Timeshift:

<pre>дек 07 20:55:33 ArchPC systemd[542]: Started dbus-:1.2-org.xfce.Xfconf@2.service.
дек 07 20:58:24 ArchPC sudo[3748]: <b>  andrew : TTY=pts/2 ; PWD=/home/andrew ; USER=root ; COMMAND=/usr/bin/grub-mkconfig -o /boot/grub/grub.cfg</b>
дек 07 20:58:24 ArchPC sudo[3748]: pam_unix(sudo:session): session opened for user root(uid=0) by andrew(uid=1000)
дек 07 20:58:25 ArchPC systemd[1]: tmp-grub\x2dbtrfs.D0cFPKSBoQ.mount: Deactivated successfully.
дек 07 20:58:25 ArchPC sudo[3748]: pam_unix(sudo:session): session closed for user root
дек 07 21:00:00 ArchPC CROND[4315]: (root) CMD (timeshift --check --scripted)
дек 07 21:00:00 ArchPC CROND[4314]: (root) CMDOUT (Another instance of this application is running (PID=1207))
дек 07 21:00:00 ArchPC CROND[4314]: (root) CMDEND (timeshift --check --scripted)
дек 07 21:01:00 ArchPC CROND[4349]: (root) CMD (run-parts /etc/cron.hourly)
дек 07 21:01:00 ArchPC CROND[4348]: (root) CMDEND (run-parts /etc/cron.hourly)
дек 07 21:02:56 ArchPC grub-btrfsd[4381]: <b>465: Detected snapshot creation/ deletion, recreating Grub menu</b>
дек 07 21:03:03 ArchPC systemd[1]: tmp-grub\x2dbtrfs.rPPWcL8v2n.mount: Deactivated successfully.
дек 07 21:03:03 ArchPC grub-btrfsd[4992]: <b>Grub menu recreated</b>
дек 07 21:03:16 ArchPC grub-btrfsd[4999]: <b>465: Detected snapshot creation/ deletion, recreating Grub menu</b>
дек 07 21:03:22 ArchPC systemd[1]: tmp-grub\x2dbtrfs.2j3mjD8t8F.mount: Deactivated successfully.
дек 07 21:03:22 ArchPC grub-btrfsd[5562]: <b>Grub menu recreated</b>
</pre>

I also tried to manually generate grub snapshot entries with "sudo /etc/grub.d/41_snapshots-btrfs"

<pre>Detecting snapshots ...
Found snapshot: 2024-12-07 20:17:01 | timeshift-btrfs/snapshots/2024-12-07_20-17-01/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-07 00:22:17 | timeshift-btrfs/snapshots/2024-12-07_00-22-17/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-12-07 00:21:42 | timeshift-btrfs/snapshots/2024-12-07_00-21-42/@ | ondemand daily | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-12-05 16:05:54 | timeshift-btrfs/snapshots/2024-12-05_16-05-54/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-05 03:02:11 | timeshift-btrfs/snapshots/2024-12-05_03-02-11/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-05 02:36:28 | timeshift-btrfs/snapshots/2024-12-05_02-36-28/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-11-17 19:23:47 | timeshift-btrfs/snapshots/2024-12-04_01-16-58/@ | ondemand       | Before restoring &apos;2024-12-04 01:00:42&apos;        |
Found snapshot: 2024-11-14 23:32:58 | timeshift-btrfs/snapshots/2024-11-14_23-32-58/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
if [ ! -e &quot;${prefix}/grub-btrfs.cfg&quot; ]; then
echo &quot;&quot;
else
submenu &apos;Arch Linux snapshots&apos; {
    configfile &quot;${prefix}/grub-btrfs.cfg&quot;
}
fi
Found 8 snapshot(s)
Unmount /tmp/grub-btrfs.jB44mNYnTX .. Success
</pre>

Also

<pre>[andrew@ArchPC ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2024-12-07 20:17:01 | timeshift-btrfs/snapshots/2024-12-07_20-17-01/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-07 00:22:17 | timeshift-btrfs/snapshots/2024-12-07_00-22-17/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-12-07 00:21:42 | timeshift-btrfs/snapshots/2024-12-07_00-21-42/@ | ondemand daily | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-12-05 16:05:54 | timeshift-btrfs/snapshots/2024-12-05_16-05-54/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-05 03:02:11 | timeshift-btrfs/snapshots/2024-12-05_03-02-11/@ | ondemand       | N/A                                           |
Found snapshot: 2024-12-05 02:36:28 | timeshift-btrfs/snapshots/2024-12-05_02-36-28/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
Found snapshot: 2024-11-17 19:23:47 | timeshift-btrfs/snapshots/2024-12-04_01-16-58/@ | ondemand       | Before restoring &apos;2024-12-04 01:00:42&apos;        |
Found snapshot: 2024-11-14 23:32:58 | timeshift-btrfs/snapshots/2024-11-14_23-32-58/@ | ondemand       | {timeshift-autosnap} {created before upgrade} |
Found 8 snapshot(s)
Unmount /tmp/grub-btrfs.D0cFPKSBoQ .. Success
done
</pre>

I also tried reinstalling "grub-btrfs" "inotify-tools", "timeshift" and "timeshift-autosnap" with no success

Last edited by Foolish★smug( ° ʖ °) (2024-12-07 23:16:48)

Offline

#2 2024-12-07 18:31:12

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

Foolish★smug( ° ʖ °) wrote:

I didn't forget to change the .service file of grub-btrfsd from "ExecStart=/usr/bin/grub-btrfsd /.snapshots --syslog" to "ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto"

How did you change that, exactly? If you didn't use an override file then the change might have been lost after an update.

EDIT: use this to check the current configuration of the unit file:

systemctl cat grub-btrfsd

Last edited by Head_on_a_Stick (2024-12-07 18:33:04)


Para todos todo, para nosotros nada

Offline

#3 2024-12-07 18:46:16

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

I used "sudo systemctl edit --full grub-btrfsd"

[andrew@ArchPC ~]$ systemctl cat grub-btrfsd
# /etc/systemd/system/grub-btrfsd.service
[Unit]
Description=Regenerate grub-btrfs.cfg

[Service]
Type=simple
LogLevelMax=notice
# Set the possible paths for `grub-mkconfig`
Environment="PATH=/sbin:/bin:/usr/sbin:/usr/bin"
# Load environment variables from the configuration
EnvironmentFile=/etc/default/grub-btrfs/config
# Start the daemon, usage of it is:
# grub-btrfsd [-h, --help] [-t, --timeshift-auto] [-l, --log-file LOG_FILE] SNAPSHOTS_DIRS
# SNAPSHOTS_DIRS         Snapshot directories to watch, without effect when --timeshift-auto
# Optional arguments:
# -t, --timeshift-auto  Automatically detect Timeshifts snapshot directory
# -o, --timeshift-old   Activate for timeshift versions <22.06
# -l, --log-file        Specify a logfile to write to
# -v, --verbose         Let the log of the daemon be more verbose
# -s, --syslog          Write to syslog
ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto

[Install]
WantedBy=multi-user.target

Last edited by Foolish★smug( ° ʖ °) (2024-12-07 23:17:17)

Offline

#4 2024-12-07 22:03:04

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

Is the service enabled? Does the journal show anything relevant?

Please edit your posts to use code tags instead of quote tags when sharing terminal output, it greatly improves readability. Thanks.


Para todos todo, para nosotros nada

Offline

#5 2024-12-07 23:37:07

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

I ran the commands:

sudo systemctl enable grub-btrfsd
sudo systemctl start grub-btrfsd

also created a snapshot in timeshift

[andrew@ArchPC ~]$ journalctl -f
дек 08 02:26:56 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:56 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:57 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:57 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:57 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:57 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:58 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:58 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:58 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:26:58 ArchPC rtkit-daemon[641]: Supervising 7 threads of 4 processes of 1 users.
дек 08 02:27:09 ArchPC systemd-timesyncd[457]: Contacted time server 162.159.200.123:123 (2.arch.pool.ntp.org).
дек 08 02:27:09 ArchPC systemd-timesyncd[457]: Initial clock synchronization to Sun 2024-12-08 02:27:09.164172 MSK.
дек 08 02:27:09 ArchPC systemd[1]: systemd-hostnamed.service: Deactivated successfully.
дек 08 02:27:22 ArchPC systemd[1]: systemd-timedated.service: Deactivated successfully.
дек 08 02:27:30 ArchPC sudo[1259]:   andrew : TTY=pts/0 ; PWD=/home/andrew ; USER=root ; COMMAND=/usr/bin/systemctl start grub-btrfsd
дек 08 02:27:30 ArchPC sudo[1259]: pam_unix(sudo:session): session opened for user root(uid=0) by andrew(uid=1000)
дек 08 02:27:30 ArchPC sudo[1259]: pam_unix(sudo:session): session closed for user root
дек 08 02:28:13 ArchPC sudo[1269]:   andrew : TTY=pts/0 ; PWD=/home/andrew ; USER=root ; COMMAND=/usr/bin/timeshift-launcher
дек 08 02:28:13 ArchPC sudo[1269]: pam_unix(sudo:session): session opened for user root(uid=0) by andrew(uid=1000)
дек 08 02:28:15 ArchPC grub-btrfsd[1313]: 468: detected Timeshift startup, PID is: 1274
дек 08 02:28:16 ArchPC systemd[1]: tmp-grub\x2dbtrfs.VNZSyO0DzT.mount: Deactivated successfully.
дек 08 02:28:16 ArchPC grub-btrfsd[2022]: Grub menu recreated
дек 08 02:28:16 ArchPC grub-btrfsd[2023]: 468: Watching /run/timeshift/1274/backup/timeshift-btrfs/snapshots for new snapshots...
дек 08 02:29:14 ArchPC sudo[2091]:   andrew : TTY=pts/3 ; PWD=/home/andrew ; USER=root ; COMMAND=/usr/bin/systemctl enable grub-btrfsd
дек 08 02:29:14 ArchPC sudo[2091]: pam_unix(sudo:session): session opened for user root(uid=0) by andrew(uid=1000)
дек 08 02:29:14 ArchPC systemd[1]: Reload requested from client PID 2097 ('systemctl') (unit session-1.scope)...
дек 08 02:29:14 ArchPC systemd[1]: Reloading...
дек 08 02:29:14 ArchPC systemd[1]: Reloading finished in 275 ms.
дек 08 02:29:14 ArchPC sudo[2091]: pam_unix(sudo:session): session closed for user root
дек 08 02:30:04 ArchPC crontab[2173]: (root) LIST (root)
дек 08 02:30:04 ArchPC crontab[2174]: (root) LIST (root)
дек 08 02:30:04 ArchPC systemd[1]: run-timeshift-1274-backup.mount: Deactivated successfully.
дек 08 02:30:04 ArchPC sudo[1269]: pam_unix(sudo:session): session closed for user root
дек 08 02:30:09 ArchPC grub-btrfsd[2183]: 468: detected timeshift shutdown
дек 08 02:30:09 ArchPC grub-btrfsd[2187]: Watching /run/timeshift for timeshift to start

Offline

#6 2024-12-08 09:39:27

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

Use the plain `set` command from the GRUB command line to find where it is looking for $configfile (grub.cfg), perhaps GRUB is not reading the correct file.


Para todos todo, para nosotros nada

Offline

#7 2024-12-08 20:51:38

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

photo with grub set
Sorry I am a bit confused where to look. I don't see the line with a config

Offline

#8 2024-12-08 20:56:34

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

$prefix is set to (hd0,gpt2)/boot/grub/ with the ESP at (hd0,gpt1). So it's looking in the second partition on the drive that contains the ESP.

EDIT: it's not looking under a subvolume though. Is that correct? How is your system configured?

Last edited by Head_on_a_Stick (2024-12-08 20:57:29)


Para todos todo, para nosotros nada

Offline

#9 2024-12-08 22:04:58

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

[andrew@ArchPC ~]$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 238,5G  0 disk 
├─sda1   8:1    0     1G  0 part /efi
└─sda2   8:2    0 237,5G  0 part /home
                                 /
sdb      8:16   0 298,1G  0 disk 
└─sdb1   8:17   0 298,1G  0 part /myhdd

EDIT: Also just noticed that my old snapshots contain just the "root" but newer snapshots (that are not visible in GRUB) contain "home" as well

[root@ArchPC snapshots]# ls
2024-11-14_23-32-58  2024-12-07_00-21-42  2024-12-08_00-41-11
2024-11-15_00-35-11  2024-12-07_00-22-17  2024-12-08_00-48-14
2024-12-04_01-16-58  2024-12-07_23-35-11  2024-12-08_02-28-47
2024-12-05_02-36-28  2024-12-07_23-54-14  2024-12-08_23-18-18
2024-12-05_03-02-11  2024-12-08_00-11-54  2024-12-09_01-00-01
2024-12-05_16-05-54  2024-12-08_00-33-23
[root@ArchPC snapshots]# ls 2024-11-14_23-32-58
@  info.json
[root@ArchPC snapshots]# ls 2024-11-15_00-35-11
@  info.json
[root@ArchPC snapshots]# ls 2024-12-08_00-11-54
@  @home  info.json
[root@ArchPC snapshots]# 

Last edited by Foolish★smug( ° ʖ °) (2024-12-08 22:24:06)

Offline

#10 2024-12-09 06:11:22

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

So it looks like GRUB is reading /boot/grub/grub.cfg on /dev/sda2, is there a file there?

mount /dev/sda2 /mnt
find /mnt -name grub.cfg
umount /mnt

EDIT: please also share the content of /etc/fstab and the output of

findmnt --real --notruncate

Last edited by Head_on_a_Stick (2024-12-09 07:14:14)


Para todos todo, para nosotros nada

Offline

#11 2024-12-09 14:09:49

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

Head_on_a_Stick wrote:

So it looks like GRUB is reading /boot/grub/grub.cfg on /dev/sda2, is there a file there?

Yes there is:

/mnt/@/boot/grub/grub.cfg
Head_on_a_Stick wrote:

EDIT: please also share the content of /etc/fstab and the output of

findmnt --real --notruncate
[andrew@ArchPC ~]$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=d3fbdb2a-dcd2-4d54-b16c-bf33d024ebd3	/         	btrfs     	rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@	0 0

# /dev/sda2
UUID=d3fbdb2a-dcd2-4d54-b16c-bf33d024ebd3	/home     	btrfs     	rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvol=/@home	0 0

# /dev/sda1
UUID=238F-0099      	/efi      	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/sdb1
UUID=bc6c39dd-b547-4781-b238-d2ea76bb6ead	/myhdd    	btrfs     	rw,relatime,compress=zstd:3,space_cache=v2,subvolid=5,subvol=/	0 0
[andrew@ArchPC ~]$ findmnt --real --notruncate
TARGET     SOURCE                                FSTYPE      OPTIONS
/          /dev/sda2[/timeshift-btrfs/snapshots/2024-11-14_23-32-58/@]
│                                                btrfs       rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=276,subvol=/timeshift-btrfs/snapshots/2024-11-14_23-32-58/@
├─/run/user/1000/doc
│          portal                                fuse.portal rw,nosuid,nodev,relatime,user_id=1000,group_id=984
├─/home    /dev/sda2[/@home]                     btrfs       rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=339,subvol=/@home
├─/efi     /dev/sda1                             vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro
└─/myhdd   /dev/sdb1                             btrfs       rw,relatime,compress=zstd:3,space_cache=v2,subvolid=5,subvol=/

Offline

#12 2024-12-09 16:29:03

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,461
Website

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

So you're booted into the 2024-11-14 snapshot rather than the main @ subvolume. Is there a /timeshift-btrfs/snapshots/2024-11-14_23-32-58/@/boot/grub/grub.cfg and does that contain the "missing" snapshot menuentries?

Unfortunately though I really don't know how Timeshift is supposed to work so I am unable to see what the problem is or how to fix it.


Para todos todo, para nosotros nada

Offline

#13 2024-12-10 18:32:54

Foolish★smug( ° ʖ °)
Member
Registered: 2024-12-07
Posts: 7

Re: grub-btrfs: no update for grub menu upon snapshot creation or deletion

Yes, it is exactly how you describe. I wasn't thinking that I am booting into the snapshot because now I don't specify it in GRUB. I only specified it once when my system was broken and I chose to "Restore" the selected snapshot in Timeshift-gtk.

EDIT: though the snapshots are in grub-btrfs.cfg which is a submenu for GRUB as i believe (it is in the same folder as grub.cfg)

Last edited by Foolish★smug( ° ʖ °) (2024-12-10 18:50:44)

Offline

Board footer

Powered by FluxBB