Skip to content

Fix restore failing silently when fstab uses LABEL= entries#556

Open
HannahPeuckmann wants to merge 1 commit into
linuxmint:masterfrom
HannahPeuckmann:fix-restore-fstab
Open

Fix restore failing silently when fstab uses LABEL= entries#556
HannahPeuckmann wants to merge 1 commit into
linuxmint:masterfrom
HannahPeuckmann:fix-restore-fstab

Conversation

@HannahPeuckmann

Copy link
Copy Markdown

is_for_system_directory() only recognized /dev/* and UUID= device strings, and find_device_in_list() only stripped the UUID= prefix before comparing against known devices. Any fstab entry using LABEL= (the default on Ubuntu cloud images, e.g. LABEL=cloudimg-rootfs) was filtered out before device resolution ever ran, so dst_root was never set.

For --restore --scripted against the currently running system, this meant mount_target_devices() bailed out at its dst_root null-check before the real rsync restore ever started, with no error, a restore that appeared to run but silently did nothing.

Recognize label=/partuuid=/partlabel= alongside /dev/ and uuid= in is_for_system_directory(), and strip label= before comparing in find_device_in_list(), the same way uuid= already is.

is_for_system_directory() only recognized /dev/* and UUID= device
strings, and find_device_in_list() only stripped the UUID= prefix
before comparing against known devices. Any fstab entry using LABEL=
(the default on Ubuntu cloud images, e.g. LABEL=cloudimg-rootfs) was
filtered out before device resolution ever ran, so dst_root was never
set.

For --restore --scripted against the currently running system, this
meant mount_target_devices() bailed out at its dst_root null-check
before the real rsync restore ever started, with no error, a restore
that appeared to run but silently did nothing.

Recognize label=/partuuid=/partlabel= alongside /dev/ and uuid= in
is_for_system_directory(), and strip label= before comparing in
find_device_in_list(), the same way uuid= already is.

Signed-off-by: Hannah Peuckmann <hannah.peuckmann@canonical.com>
@HannahPeuckmann

Copy link
Copy Markdown
Author

Without the fix (it just stops and does nothing):

ubuntu@ts-broken:~$ sudo timeshift --restore --snapshot-device /dev/sda1 --snapshot "2026-07-09_06-18-22" --skip-grub --scripted
Mounted '/dev/sda1' at '/run/timeshift/4485/backup'
******************************************************************************
GRUB will NOT be reinstalled
******************************************************************************
ubuntu@ts-broken:~$

With the fix:

ubuntu@ts-confirm:~$ sudo timeshift --restore --snapshot-device /dev/sda1 --snapshot "2026-07-08_11-43-49" --skip-grub --scripted
Mounted '/dev/sda1' at '/run/timeshift/2156/backup'
******************************************************************************
GRUB will NOT be reinstalled
******************************************************************************
Mounted '/dev/sda1' at '/run/timeshift/2156/restore/'
Mounted '/dev/sda16' at '/run/timeshift/2156/restore/boot'
Mounted '/dev/sda15' at '/run/timeshift/2156/restore/boot/efi'
******************************************************************************
Backup Device: /dev/sda1
******************************************************************************
******************************************************************************
Snapshot: 2026-07-08_11-43-49 ~ baseline-with-patched-timeshift
******************************************************************************
Restoring snapshot...
Syncing files with rsync...

...

sent 31,369,855 bytes  received 2,879 bytes  5,704,133.45 bytes/sec
total size is 2,547,396,225  speedup is 81.20

Updating GRUB menu...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-134-generic
Found initrd image: /boot/initrd.img-6.8.0-134-generic
Found linux image: /boot/vmlinuz-6.8.0-124-generic
Found initrd image: /boot/initrd.img-6.8.0-124-generic
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 ...
done

Syncing file systems...


Rebooting system...
Rebooting.

I have only been able to test this on an amd64 vm, I tried testing on arm64 and s390x vms but due to #523 this was not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant