Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] System Snapper + BtrFS rollback assistance request  (Read 2645 times)

Offline PhillyBass

  • User
  • Posts: 7
    • Flint Weller
[EN] System Snapper + BtrFS rollback assistance request
« on: 2023/06/20, 19:20:50 »

The issue I am having is that I did not seem to perform a snapper rollback properly.
I would greatly appreciate if someone would be able to point me in the right direction to fix my system.
I took notes during the rollback process and am sharing them here along with some files that may be relevant.
My system is a laptop running Siduction MoW KDE Plasma


I made files available for anyone with this link to download
https://www.dropbox.com/scl/fo/qtedc4sti430tod4vreud/h?dl=0&rlkey=gi3whg42ltc7fp81rp7i75pq4


2023-06-20
Booted my Siduction after a full system apt upgrade and ran into two issues
1. Message: error: file '/@/usr/share/grub/themes/mow/theme.txt' not found.
2. System will not boot into KDE Plasma, but drops me into a text-only console

I then rebooted and...
Select the desired snapshot number in the grub menu.  Snapshot #125 selected.  #125 is 6 days ago.
If I select kernel 6.3.8.2, I end up with a text-only console
If I select kernel 6.3.8.1, I am able to boot into the Plasma desktop env

Log into account, open konsole, enter superuser mode
$ su

Tell snapper to rollback in the proper way
# snapper --ambit classic rollback

List the snapshots
# snapper list

Notice how the most recent snapshot is a r/w copy of the desired snapshot.  Snapshot #139 is the r/w copy of #125

Reboot
Select default grub installation, and the appropriate kernel version
system boots into text-only console, not KDE Plasma

Log into account, open konsole, enter superuser mode
# su

Point grub to the latest snapshot
# grub-install ...

Update KDE Plastma cache
# sudo update-desktop-database

Reboot
Select default grub installation, and kernel 6.3.8.1
system boots into text-only console, not KDE Plasma, this is strange.
I still see the error message about missing grub mow theme.  I now realize that /usr/share is probably not included in the snapper rollback ( is it?)
ATTACHMENTS: dmesg.txt, hostnamectrl.txt, inxi.txt, snapper_list.txt, 

Checking on the error message about missing grub theme
$ su
# cd /usr/share/grub
The themes directory is missing

On a different computer that is running siduction (and is working nicely), I archive the /usr/share/grub/themes directory
# 7za a /mnt/SkyData/Tmp/themes.7z themes

Back on my siduction laptop that has the issues, I restore the themes directory
# 7za x /mnt/SkyData/Tmp/themes.7z 

Reboot the computer
Progress!  I no longer see the error message about the missing grub theme
But I still boot into console and not KDE Plasma login

I double check snapper list, and yes the system is running on snapshot #139 which is a rollback of #125
For a sanity check, I perform a 
# apt update
# apt list --upgradable
And what I see is only two packages that are available to update.  This is a massive clue that I did not roll back properly.  
If I am actually running on snapshot #139 which is a rollback of #125, I should see 6 days worth of package updates, which would be a very long list, not a list of 2.
ATTACHMENT: dmesg2.txt


Offline PhillyBass

  • User
  • Posts: 7
    • Flint Weller
Re: System Snapper + BtrFS rollback assistance request
« Reply #1 on: 2023/06/21, 00:36:15 »
Replying to my own post.

I fixed my system. 

Feedback for the Siduction documentation team...
There is an error in the Siduction manual, section 7.5.4 Snapper rollback

Where the manual states:

Quote
We perform the command
# grub-install ...


It should instead state:

Quote
We perform the command
# update-grub




Offline scholle1

  • User
  • Posts: 86
Re: System Snapper + BtrFS rollback assistance request
« Reply #2 on: 2023/06/21, 14:44:36 »
I suspect that there was another issue.
The "grub-install" command is necessary and correct.

The update-grub command is automatically executed by the /usr/share/siduction/test-btrfs-default.sh script 15 seconds after booting.
The conditions for this are:
After booting or new snapshot, checks if Btrfs default subvolume, booted subvolume, and Grub default menu item match. Create new /boot/grub/grub.cfg if not.

The output off
Code: [Select]
ls -l /usr/share/siduction/test-btrfs-default.shshould be
Code: [Select]
-rwxr-xr-x 1 root root 1198  8. Mär 15:37 /usr/share/siduction/test-btrfs-default.shand the state off the associated systemd files should be like this:
Code: [Select]
# systemctl status siduction_btrfs.service
○ siduction_btrfs.service - Execute 'update-grub' if btrfs-default-subvolume changed.
     Loaded: loaded (/lib/systemd/system/siduction_btrfs.service; static)
     Active: inactive (dead) since Wed 2023-06-21 11:21:56 CEST; 1h 52min ago
TriggeredBy: ● siduction_btrfs.path
             ● siduction_btrfs.timer
       Docs: https://github.com/siduction/grub-btrfs-rollback-settings
    Process: 4669 ExecStart=/usr/share/siduction/test-btrfs-default.sh (code=exited, status=0/SUCCESS)
   Main PID: 4669 (code=exited, status=0/SUCCESS)
        CPU: 19ms[
Jun 21 11:21:46 pc1 systemd[1]: Starting siduction_btrfs.service - Execute 'update-grub' if btrfs-default-subvolu>
Jun 21 11:21:56 pc1 test-btrfs-default.sh[4669]: Nothing to do
Jun 21 11:21:56 pc1 systemd[1]: siduction_btrfs.service: Deactivated successfully.
Jun 21 11:21:56 pc1 systemd[1]: Finished siduction_btrfs.service - Execute 'update-grub' if btrfs-default-subvolu>

You have to execute the rollback command from the current (possibly incorrect) default subvolume.
Only this is writable and the grub entry points to it.
After rebooting into the now only writable rollback subvolume (r/w copy of snapshot #125), the grub entry still points to the previous default subvolume (snapshot #137 ?). Therefore, the command "grub-install" is necessary to point to the rollback subvolume and its "grub.cfg".

You booted with kernel 6.3.8.1 in snapshot #125 and performed the rollback there. This snapshot is not writable. All changes to grub have no effect.
The correct way (described in the manual as well) is to go back to the default snapshot (#137 ?). Execute the rollback there as root. Then reboot with grub's default entry into the rollback destination and run the command "grub-install" as root.
« Last Edit: 2023/06/22, 11:41:36 by scholle1 »
Je mehr Bürgerinnen und Bürger mit Zivilcourage ein Land hat, desto weniger Helden wird es einmal brauchen.
(Franka Magnani)

Offline PhillyBass

  • User
  • Posts: 7
    • Flint Weller
Re: System Snapper + BtrFS rollback assistance request
« Reply #3 on: 2023/06/22, 01:40:26 »
Hello @scholle1
What you write makes sense.  I realize now that when I "fixed my system" yesterday, that it was from a lucky collection of commands at the right time and not from actually understanding how the system should work.  I am cleaning it up now thanks to your explanation, and I should be able to roll back in far less time the next time this happens.
Thank you