Antynea / grub-btrfs

Include btrfs snapshots at boot options. (Grub menu)
GNU General Public License v3.0
730 stars 75 forks source link

Grub-btrfs doesn't detect my Timeshift btrfs snapshots on running "grub-mkconfig" #344

Open Xe-no1 opened 1 month ago

Xe-no1 commented 1 month ago

As the title suggests, Grub-btrfs is not detecting my btrfs snapshots (using Timeshift), I configured the Grub-btrfs daemon to monitor the Timeshift snapshots using "--timeshift-auto" but without any results or detecting my snapshots, even though I'm sure I have snapshots. My version of Timeshift is 24.06.3 and Grub-btrfs is version 4.12. Im using vanilla Arch linux with KDE Plasma Wayland on a VM and my host computer is a MacBook Pro 14 inch 2021, meaning everything is aarch64 and my Arch linux is the ARM flavor This is the exact output I get from running "grub-mkconfig":

[mazentech@Archie ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/Image
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 ...
No snapshots found.
If you think an error has occurred, please file a bug report at "https://github.com/Antynea/grub-btrfs"
Unmount /tmp/grub-btrfs.tc96LtwE8b .. Success
done
[mazentech@Archie ~]$ 

These are my grub configs:

  1 #                                                                                                                                                                          
  2 # DO NOT EDIT THIS FILE                                                                                                                                                    
  3 #                                                                                                                                                                          
  4 # It is automatically generated by grub-mkconfig using templates                                                                                                           
  5 # from /etc/grub.d and settings from /etc/default/grub                                                                                                                     
  6 #                                                                                                                                                                          
  7                                                                                                                                                                            
  8 ### BEGIN /etc/grub.d/00_header ###                                                                                                                                        
  9 insmod part_gpt                                                                                                                                                            
 10 insmod part_msdos                                                                                                                                                          
 11 if [ -s $prefix/grubenv ]; then                                                                                                                                            
 12   load_env                                                                                                                                                                 
 13 fi                                                                                                                                                                         
 14 if [ "${next_entry}" ] ; then                                                                                                                                              
 15    set default="${next_entry}"                                                                                                                                             
 16    set next_entry=                                                                                                                                                         
 17    save_env next_entry                                                                                                                                                     
 18    set boot_once=true                                                                                                                                                      
 19 else                                                                                                                                                                       
 20    set default="0"                                                                                                                                                         
 21 fi                                                                                                                                                                         
 22                                                                                                                                                                            
 23 if [ x"${feature_menuentry_id}" = xy ]; then                                                                                                                               
 24   menuentry_id_option="--id"                                                                                                                                               
 25 else                                                                                                                                                                       
 26   menuentry_id_option=""                                                                                                                                                   
 27 fi                                                                                                                                                                         
 28                                                                                                                                                                            
 29 export menuentry_id_option                                                                                                                                                 
 30                                                                                                                                                                            
 31 if [ "${prev_saved_entry}" ]; then                                                                                                                                         
 32   set saved_entry="${prev_saved_entry}"                                                                                                                                    
 33   save_env saved_entry                                                                                                                                                     
 34   set prev_saved_entry=                                                                                                                                                    
 35   save_env prev_saved_entry                                                                                                                                                
 36   set boot_once=true                                                                                                                                                       
 37 fi                                                                                                                                                                         
 38                                                                                                                                                                            
 39 function savedefault {                                                                                                                                                     
 40   if [ -z "${boot_once}" ]; then                                                                                                                                           
 41     saved_entry="${chosen}"                                                                                                                                                
 42     save_env saved_entry                                                                                                                                                   
 43   fi                                                                                                                                                                       
 44 }                                                                                                                                                                          
 45                                                                                                                                                                            
 46 function load_video {                                                                                                                                                      
 47   if [ x$feature_all_video_module = xy ]; then                                                                                                                             
 48     insmod all_video                                                                                                                                                       
 49   else                                                                                                                                                                     
 50     insmod efi_gop                                                                                                                                                         
 51     insmod efi_uga                                                                                                                                                         

These are my grub-btrfs configs:

  1 #!/usr/bin/env bash                                                                                                                                                        
  2                                                                                                                                                                            
  3                                                                                                                                                                            
  4 GRUB_BTRFS_VERSION=4.12-master-2023-04-28T16:26:00+00:00                                                                                                                   
  5                                                                                                                                                                            
  6 # Disable grub-btrfs.                                                                                                                                                      
  7 # Default: "false"                                                                                                                                                         
  8 #GRUB_BTRFS_DISABLE="true"                                                                                                                                                 
  9                                                                                                                                                                            
 10 # Name appearing in the Grub menu.                                                                                                                                         
 11 # Default: "Use distribution information from /etc/os-release."                                                                                                            
 12 #GRUB_BTRFS_SUBMENUNAME="Arch Linux snapshots"                                                                                                                             
 13                                                                                                                                                                            
 14 # Custom title.                                                                                                                                                            
 15 # Shows/Hides "date" "snapshot" "type" "description" in the Grub menu, custom order available.                                                                             
 16 # Default: ("date" "snapshot" "type" "description")                                                                                                                        
 17 #GRUB_BTRFS_TITLE_FORMAT=("date" "snapshot" "type" "description")                                                                                                          
 18                                                                                                                                                                            
 19 # Limit the number of snapshots populated in the GRUB menu.                                                                                                                
 20 # Default: "50"                                                                                                                                                            
 21 #GRUB_BTRFS_LIMIT="50"                                                                                                                                                     
 22                                                                                                                                                                            
 23 # Sort the found subvolumes by "ogeneration" or "generation" or "path" or "rootid".                                                                                        
 24 # # See Sorting section to https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-subvolume#SUBCOMMAND                                                                      
 25 # "-rootid" means list snapshot by new ones first.                                                                                                                         
 26 # Default: "-rootid"                                                                                                                                                       
 27 #GRUB_BTRFS_SUBVOLUME_SORT="+ogen,-gen,path,rootid"                                                                                                                        
 28                                                                                                                                                                            
 29 # Show snapshots found during run "grub-mkconfig"                                                                                                                          
 30 # Default: "true"                                                                                                                                                          
 31 #GRUB_BTRFS_SHOW_SNAPSHOTS_FOUND="false"                                                                                                                                   
 32                                                                                                                                                                            
 33 # Show Total of snapshots found during run "grub-mkconfig"                                                                                                                 
 34 # Default: "true"                                                                                                                                                          
 35 #GRUB_BTRFS_SHOW_TOTAL_SNAPSHOTS_FOUND="true"                                                                                                                              
 36                                                                                                                                                                            
 37 # By default, "grub-btrfs" automatically detects most existing kernels.                                                                                                    
 38 # If you have one or more custom kernels, you can add them here.                                                                                                           
 39 # Default: ("")                                                                                                                                                            
 40 #GRUB_BTRFS_NKERNEL=("kernel-custom" "vmlinux-custom")                                                                                                                     
 41                                                                                                                                                                            
 42 # By default, "grub-btrfs" automatically detects most existing initramfs.                                                                                                  
 43 # If you have one or more custom initramfs, you can add them here.                                                                                                         
 44 # Default: ("")                                                                                                                                                            
 45 #GRUB_BTRFS_NINIT=("initramfs-custom.img" "initrd-custom.img" "otherinit-custom.gz")                                                                                       
 46                                                                                                                                                                            
 47 # By default, "grub-btrfs" automatically detects most existing microcodes.                                                                                                 
 48 # If you have one or more custom microcodes, you can add them here.                                                                                                        
 49 # Default: ("")                                                                                                                                                            
 50 #GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")                                                                                       

These are my grub-btrfs daemon configs:

btrfsd.service05fe6ce786d0a3f5                                                         
[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

Feel free to ask me to add any needed info that I missed, I am really really new to Linux (literally started 2 weeks ago) and I try to add any relevant info that I know of.

Xe-no1 commented 1 month ago

Try remaking grub, the automation might not be working. sudo grub-mkconfig -o /boot/grub/grub.cfg

Yep I did that exact command, still doesn't recognise any snapshots

Schievel1 commented 1 month ago

Maybe you have forgotten to start the daemon?

Try 'systemctl status grub-btrfsd' to find out, and 'systemctl start grub-btrfsd' to start it if it isn't

Xe-no1 commented 1 month ago

Maybe you have forgotten to start the daemon?

Try 'systemctl status grub-btrfsd' to find out, and 'systemctl start grub-btrfsd' to start it if it isn't

I have used the 'systemctl enable grub-btrfsd' so it should start on system startup anyway, and after editing the config to support Timeshift I did 'systemctl restart grub-btrfsd'. I double checked anyway with 'systemctl status grub-btrfsd' and the grub-btrfsd is active

Schievel1 commented 1 month ago

Yes that's sounds good to me.

Can you watch the syslog (I think with systemd the command for that should be 'journalctl -f') then open timeshift, do a snapshot in timeshift and close it again? Then post the output of the syslog here.

Xe-no1 commented 1 month ago

Yes that's sounds good to me.

Can you watch the syslog (I think with systemd the command for that should be 'journalctl -f') then open timeshift, do a snapshot in timeshift and close it again? Then post the output of the syslog here.

Here is the exact full output as a txt file:

[mazentech@Archie ~]$ journalctl -f
Aug 02 13:56:18 Archie systemd[701]: Starting flatpak session helper...
Aug 02 13:56:18 Archie systemd[701]: Started flatpak session helper.
Aug 02 13:56:18 Archie systemd[701]: Started app-flatpak-org.kde.konsole-1681.scope.
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "menuFont"  doesn't exist
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "font"  doesn't exist
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "activeFont"  doesn't exist
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "toolBarFont"  doesn't exist
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "smallestReadableFont"  doesn't exist
Aug 02 13:56:19 Archie xdg-desktop-portal-kde[942]: xdp-kde-settings: Key  "fixed"  doesn't exist
Aug 02 13:56:22 Archie flatpak[1701]: "applications.menu"  not found in  QList()
Aug 02 13:56:59 Archie systemd[701]: Started Timeshift - System Restore Utility.
Aug 02 13:56:59 Archie timeshift-launcher[1776]: /usr/bin/timeshift-launcher: line 16: xhost: command not found
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: Listener adapter polkit_qt_listener_initiate_authentication
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: GSimpleAsyncResult: 0xaaaaec1bbe00
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: polkit_qt_listener_initiate_authentication callback for  0xaaaaec18ee80
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: Initiating authentication
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: Action description has been found
Aug 02 13:56:59 Archie plasmashell[902]: The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: User:  "unix-user:mazentech"
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: Trying again
Aug 02 13:56:59 Archie polkit-agent-helper-1[1786]: pam_systemd_home(polkit-1:auth): New sd-bus connection (system-bus-pam-systemd-home-1786) opened.
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: REQUEST
Aug 02 13:56:59 Archie polkit-kde-authentication-agent-1[940]: Request:  "Password: "
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Dialog accepted
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: COMPLETED
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Completed:  true
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Finishing obtaining privileges
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Listener adapter polkit_qt_listener_initiate_authentication_finish
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: polkit_qt_listener_initiate_authentication_finish callback for  0xaaaaec18ee80
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Finish obtain authorization: true
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Dialog cancelled
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Finishing obtaining privileges
Aug 02 13:57:03 Archie polkit-kde-authentication-agent-1[940]: Finish obtain authorization: true
Aug 02 13:57:03 Archie polkitd[781]: Operator of unix-session:2 successfully authenticated as unix-user:mazentech to gain ONE-SHOT authorization for action in.teejeetech.pkexec.timeshift-gtk for unix-process:1772:10180 [bash /usr/bin/timeshift-launcher] (owned by unix-user:mazentech)
Aug 02 13:57:03 Archie pkexec[1777]: pam_unix(polkit-1:session): session opened for user root(uid=0) by mazentech(uid=1000)
Aug 02 13:57:03 Archie pkexec[1777]: mazentech: Executing command [USER=root] [TTY=unknown] [CWD=/home/mazentech] [COMMAND=/usr/bin/timeshift-gtk]
Aug 02 13:57:03 Archie timeshift-launcher[1777]: App config loaded: /etc/timeshift/timeshift.json
Aug 02 13:57:03 Archie timeshift-launcher[1777]: Mounted '/dev/sda3' at '/run/timeshift/1777/backup'
Aug 02 13:57:03 Archie timeshift-launcher[1777]: btrfs: Quotas are not enabled
Aug 02 13:57:03 Archie kwin_wayland[744]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Aug 02 13:57:04 Archie grub-btrfsd[1839]: 434: detected Timeshift startup, PID is: 1777
Aug 02 13:57:04 Archie systemd[1]: tmp-grub\x2dbtrfs.9MMEPF8CSx.mount: Deactivated successfully.
Aug 02 13:57:04 Archie grub-btrfsd[2109]: Grub menu recreated
Aug 02 13:57:04 Archie grub-btrfsd[2110]: 434: Watching /run/timeshift/1777/backup/timeshift-btrfs/snapshots for new snapshots...
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Creating new backup...(BTRFS)
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Saving to device: /dev/sda3, mounted at path: /run/timeshift/1777/backup
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Created directory: /run/timeshift/1777/backup/timeshift-btrfs/snapshots/2024-08-02_13-57-17
Aug 02 13:57:17 Archie grub-btrfsd[2116]: 434: Detected snapshot creation/ deletion, recreating Grub menu
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Created subvolume snapshot: /run/timeshift/1777/backup/timeshift-btrfs/snapshots/2024-08-02_13-57-17/@
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Created subvolume snapshot: /run/timeshift/1777/backup/timeshift-btrfs/snapshots/2024-08-02_13-57-17/@home
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Created control file: /run/timeshift/1777/backup/timeshift-btrfs/snapshots/2024-08-02_13-57-17/info.json
Aug 02 13:57:17 Archie timeshift-launcher[1777]: BTRFS Snapshot saved successfully (0s)
Aug 02 13:57:17 Archie timeshift-launcher[1777]: Tagged snapshot '2024-08-02_13-57-17': ondemand
Aug 02 13:57:17 Archie timeshift-launcher[1777]: ------------------------------------------------------------------------------
Aug 02 13:57:22 Archie systemd[1]: tmp-grub\x2dbtrfs.kU7JNRRuaP.mount: Deactivated successfully.
Aug 02 13:57:22 Archie grub-btrfsd[2425]: Grub menu recreated
Aug 02 13:57:26 Archie timeshift-launcher[1777]: App config saved: /etc/timeshift/timeshift.json
Aug 02 13:57:26 Archie crontab[2429]: (root) LIST (root)
Aug 02 13:57:26 Archie crontab[2430]: (root) LIST (root)
Aug 02 13:57:26 Archie systemd[1]: run-timeshift-1777-backup.mount: Deactivated successfully.
Aug 02 13:57:26 Archie timeshift-launcher[2437]: /usr/bin/timeshift-launcher: line 18: xhost: command not found
Aug 02 13:57:26 Archie timeshift-launcher[2438]: /usr/bin/timeshift-launcher: line 19: xhost: command not found
Aug 02 13:57:26 Archie systemd[701]: app-timeshift\x2dgtk@e14d38527db245569dadeb6a74a9c056.service: Main process exited, code=exited, status=127/n/a
Aug 02 13:57:26 Archie systemd[701]: app-timeshift\x2dgtk@e14d38527db245569dadeb6a74a9c056.service: Failed with result 'exit-code'.
Aug 02 13:57:35 Archie flatpak[1701]: qt.qpa.wayland: Creating a popup with a parent, QWidgetWindow(0xaaaaf94d6830, name="MainWindow#1Window") which does not match the current topmost grabbing popup, QWidgetWindow(0xaaaaf9b53430, name="QMenuClassWindow") With some shell surface protocols, this is not allowed. The wayland QPA plugin is currently handling it by setting the parent to the topmost grabbing popup. Note, however, that this may cause positioning errors and popups closing unxpectedly. Please fix the transient parent of the popup.
Aug 02 13:57:35 Archie flatpak[1701]: The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.
Aug 02 13:57:40 Archie grub-btrfsd[2451]: 434: detected timeshift shutdown
Aug 02 13:57:40 Archie grub-btrfsd[2455]: Watching /run/timeshift for timeshift to start
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Aug 02 13:58:06 Archie flatpak[1701]: kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
Aug 02 13:58:06 Archie flatpak[1701]:  "Not connected to D-Bus server"
Schievel1 commented 1 month ago

So it seems like grub-btrfsd is working correctly. It detects snapshots being created and trigger the grub submenu creation (it says "grub menu recreated" in the logs after timeshift creates the snapshot)

What this does is running '/etc/grub.d/41_snapshots-btrfs' So let's continue there. Maybe you can run this command and see if that gives us any errors. Also, if you create a snapshot in timeshift and after that run this command, does the snapshot show up in the next boot?

Also if you give it the command 'btrfs subvolume list -sa /' what does it say?

Xe-no1 commented 1 month ago

Okay to address your points, running the first command just says "Detecting snapshots..." on all occasions (Both before and after Timeshift snapshot creation), not an error but not a success either, Here is the output:

[mazentech@Archie ~]$ /etc/grub.d/41_snapshots-btrfs
Detecting snapshots ...
[mazentech@Archie ~]$ /etc/grub.d/41_snapshots-btrfs
Detecting snapshots ...
[mazentech@Archie ~]$ /etc/grub.d/41_snapshots-btrfs
Detecting snapshots ...
[mazentech@Archie ~]$ 

The first two were before making a snapshot and the third output is after the Timeshift snapshot, all of them are the exact same. No, no snapshot boot entries showed up in the next boot after making a snapshot and running the former command. As for the second command, the "btrfs subvolume list -sa /", here is the output of that command, I had to use 'sudo' for elevated privileges:

[mazentech@Archie ~]$ btrfs subvolume list -sa /
ERROR: can't perform the search: Operation not permitted
[mazentech@Archie ~]$ sudo btrfs subvolume list -sa /
[sudo] password for mazentech: 
ID 265 gen 346 cgen 162 top level 5 otime 2024-07-31 22:11:26 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_19-11-26/@
ID 266 gen 164 cgen 163 top level 5 otime 2024-07-31 22:11:26 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_19-11-26/@home
ID 267 gen 346 cgen 183 top level 5 otime 2024-07-31 22:26:31 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_19-26-31/@
ID 268 gen 185 cgen 184 top level 5 otime 2024-07-31 22:26:31 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_19-26-31/@home
ID 269 gen 346 cgen 230 top level 5 otime 2024-07-31 23:05:39 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_20-05-39/@
ID 270 gen 232 cgen 231 top level 5 otime 2024-07-31 23:05:39 path <FS_TREE>/timeshift-btrfs/snapshots/2024-07-31_20-05-39/@home
ID 271 gen 346 cgen 346 top level 5 otime 2024-08-02 13:57:17 path <FS_TREE>/timeshift-btrfs/snapshots/2024-08-02_13-57-17/@
ID 272 gen 347 cgen 347 top level 5 otime 2024-08-02 13:57:17 path <FS_TREE>/timeshift-btrfs/snapshots/2024-08-02_13-57-17/@home
ID 273 gen 366 cgen 366 top level 5 otime 2024-08-03 01:52:01 path <FS_TREE>/timeshift-btrfs/snapshots/2024-08-03_01-52-01/@
ID 274 gen 367 cgen 367 top level 5 otime 2024-08-03 01:52:01 path <FS_TREE>/timeshift-btrfs/snapshots/2024-08-03_01-52-01/@home
[mazentech@Archie ~]$ 
Schievel1 commented 1 month ago

Sorry I forgot to mention, the first command also needs sudo

Xe-no1 commented 1 month ago

Sorry I forgot to mention, the first command also needs sudo

In that case, after running it with sudo I do get lots of text, and in the end it just ends up saying "No snapshots found". Here is the output:

[mazentech@Archie ~]$ sudo /etc/grub.d/41_snapshots-btrfs
[sudo] password for mazentech: 
Detecting snapshots ...
if [ ! -e "${prefix}/grub-btrfs.cfg" ]; then
echo ""
else
submenu 'Arch Linux ARM snapshots' {
    configfile "${prefix}/grub-btrfs.cfg"
}
fi
No snapshots found.
If you think an error has occurred, please file a bug report at "https://github.com/Antynea/grub-btrfs"
Unmount /tmp/grub-btrfs.whr3wpL0dT .. Success
[mazentech@Archie ~]$ sudo /etc/grub.d/41_snapshots-btrfs
Detecting snapshots ...
if [ ! -e "${prefix}/grub-btrfs.cfg" ]; then
echo ""
else
submenu 'Arch Linux ARM snapshots' {
    configfile "${prefix}/grub-btrfs.cfg"
}
fi
No snapshots found.
If you think an error has occurred, please file a bug report at "https://github.com/Antynea/grub-btrfs"
Unmount /tmp/grub-btrfs.uFMxYDLx1Y .. Success
[mazentech@Archie ~]$ 
Schievel1 commented 1 month ago

Ok, so executing this script is what grub does as well. And it gets back this snippet you postet and integrates that into the grub.cfg file in /boot/grub. For some reason the script can't find any snapshots but btrfs-progs can. Hm.

You say you're running grub-btrfs version 4.12. is there any particular reason for that? I know there have been some problems with changes in btrfs-progs in the past which led to grub-btrfs not working anymore. Could you try upgrading to 4.13?

Xe-no1 commented 1 month ago

Ok, so executing this script is what grub does as well. And it gets back this snippet you postet and integrates that into the grub.cfg file in /boot/grub. For some reason the script can't find any snapshots but btrfs-progs can. Hm.

You say you're running grub-btrfs version 4.12. is there any particular reason for that? I know there have been some problems with changes in btrfs-progs in the past which led to grub-btrfs not working anymore. Could you try upgrading to 4.13?

Yes about that, I'm having the same issue as this guy here: #341. I just used 'pacman' to install grub-btrfs, not even the AUR and it is supposed to be on 4.13, but as in the grub-btrfs config file it actually says that I have version 4.12.

Xe-no1 commented 1 month ago

To add on, if necessary I could compile from source and get the package that way, but idk if the grub-btrfs config is just wrong and that I am using 4.13, or if the 'pacman' package is actually not up to date with the source on GitHub.

Schievel1 commented 1 month ago

No you're fine. I think that was just a mistake I made in the 4.13 commit.

There is one issue where the user had the same problem and with migration from timeshift to snapper it got solved. Instead of migrating directly, maybe make a manual snapshot first and see if it is detected. To do this run 'sudo mkdir /snapshots' 'btrfs subvolume snapshot / /snapshots/mysnapshot' Then run grub-config again as usual.

To get rid of the snapshot just delete the /snapshots directory again.

Xe-no1 commented 1 month ago

Okay, so I am on the latest version. What you're saying so far is that btrfs-progs detects the snapshot but the script doesn't, yes?

Schievel1 commented 1 month ago

Yes. The script is using btrfs-progs as well, then parses the output of btrfs-progs using awk and such. If something in the output of btrfs-progs changes, the script will fail. But then again, if that is the case you wouldn't be the only one opening an issue here I guess.

Xe-no1 commented 1 month ago

Another thing I must add, why is the output so crowded and 'unclean', I thought it would just say "Detecting snapshots" and directly after mention it finding any snapshots or not, but in the output I get, it looks very confusing and crowded.

Schievel1 commented 1 month ago

You mean this part?

if [ ! -e "${prefix}/grub-btrfs.cfg" ]; then echo "" else submenu 'Arch Linux ARM snapshots' { configfile "${prefix}/grub-btrfs.cfg" } fi

This is the part grub integrates into its scripts. Those scripts work by generating output conditionally. Grub-mkconfig just calls the scripts in /etc/grub.d one by one and fetches whatever they output to stdout and puts it into /boot/grub/grub.cfg. Usually you don't see this because grub-mkconfig redirects stdout of those scripts. But you can see the "detecting snapshots" and "no snapshots found" part because is printed to stderr. Grub-mkconfig doesn't redirect that. Since we ran the script manually without grub-mkconfig we can see it's whole output.

You said that you are new to Linux, you maybe want to read about stdin, stderr and stdout. It's a very powerful and old concept of Unix and the way it can chain programs together.

Xe-no1 commented 1 month ago

You mean this part?

if [ ! -e "${prefix}/grub-btrfs.cfg" ]; then echo "" else submenu 'Arch Linux ARM snapshots' { configfile "${prefix}/grub-btrfs.cfg" } fi

This is the part grub integrates into its scripts. Those scripts work by generating output conditionally. Grub-mkconfig just calls the scripts in /etc/grub.d one by one and fetches whatever they output to stdout and puts it into /boot/grub/grub.cfg. Usually you don't see this because grub-mkconfig redirects stdout of those scripts. But you can see the "detecting snapshots" and "no snapshots found" part because is printed to stderr. Grub-mkconfig doesn't redirect that. Since we ran the script manually without grub-mkconfig we can see it's whole output.

You said that you are new to Linux, you maybe want to read about stdin, stderr and stdout. It's a very powerful and old concept of Unix and the way it can chain programs together.

Okay good to know, will read about those, as I'm finding Linux and Unix very interesting so far and I would love to get even deeper. Thanks!