OpenHABian backup sd-card booted during first test, but not anymore

  • Platform information:
    • Hardware: Raspberry Pi 4 Model B Rev 1.2
    • OS: Raspbian GNU/Linux 11 (bullseye), Kernel = Linux 5.15.61-v7l+
    • openHAB version: 3.3.0

I am having the problem that my the my backup sd-cards are not booting. This is the case for the backup that I made using option 53 (for periodic backup) and 54 (for the one-time raw-copy backup). Curiously, for both cases it worked the first time.

This is the order of events:

  1. I setup the periodic backup (i.e. Amanda+system-backup on the same sd-card) during installation of OpenHABian on my RPi a few months back.
  2. I tested the backup SD-card on the next day and it booted and worked as expected. I then switched back to the main card and again put the backup card in the USB reader to continue creating periodic backups.
  3. Since then I had OpenHABian running without testing the backup SD-card.
  4. I recently upgraded to OpenHAB 3.3 (~2 week ago) and tested the backup SD-card and it did not boot anymore.
  5. To continue with my update, I switched to another SD-card for the backup and created the backup manually on that using the raw-copy option 54 in openhabian-config. I tested, if I can boot from that backup SD-card and it booted as expected. Then I again switched back to the main card and successfully updated it to OpenHAB 3.3.
  6. Before making further modifications to OpenHAB I again ran option 54 to backup the current state. Testing again, if I can boot the backup SD-card, I found that this time the SD-card did not booting anymore. Since then, I have run option 54 twice (with intermitten reboots) and it continues not to work.

So I have been trying to figure out what the problem is:

This forum post descibes that the PARTUUID in /boot/cmdline.txt can end up not being correct:

openhabian@openhab3:/mnt $ cat cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

I found this behavior in for my backup card. I tried fixing it as discussed in the post by correcting the PARTUUID as reported by sudo blkid as shown below, but it did not help:

blkid output with the backup sd-card in the USB reader of the RPi (as /dev/sda):
1acf3f1c5568a0770ba45a4205192290.png
Corrected /mnt/cmdline.txt (which still does not boot):
c83468378324678507859d0b34775b32.png

Note: The forum post states that the PARTUUID of the /boot partition should be added to /mnt/cmdline.txt. But checking the /boot/cmdline.txt of my (functioning) main sd-card, I found that it actually contains the PARTUUID of the root partition (/). Anyway… I tried both PARTUUIDs in the cmdline.txt of the backup sd-card and neither worked …

I also checked that there is no file /etc/systemd/system/storage.mount (as suggested here here). I found none.

I reran option 54 with debugmode=maximum and recorded the terminal output like so:

sudo openhabian-config 2>&1 | tee /home/openhabian/01__debug/20220919_not_booting_from_sdcard_mirror/20220929_sdcard_backup.log

This is the output:

20220929_sdcard_backup.log (416.1 KB)

I hope someone can help me resolve this. Thank you in advance.

I have found that during the backup, I sometimes the following error in the logs:

Taking a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card
FAILED (set random UUID)
mount: /storage/syncmount: wrong fs type, bad option, bad superblock on /dev/sda2, missing codepage or helper program, or other error.
sed: can't read /storage/syncmount/etc/fstab: No such file or directory
umount: /storage/syncmount: not mounted.
OK (dirty bit on fsck /dev/sda2 is normal)

When this happens, I am not able to boot from the backup micro-SD card.
However, I am still able to mount the created partitions after executing the backup script on my Pi. I then see that the partUUIDs are incorrect:

The partUUID of the partitions is not correctly set in /etc/fstab and /boot/cmdline.txt. Which makes sense, because looking at the backup script here in function mirror_SD(), the mounting is necessary to do the string-replace to set the partUUID.

However, I find it strange that I am able to mount the partitions after running the script, but mounting fails during execution of the backup-script. Is there an explanation for this?

Also, the micro-SD card boots without issues, when the above error does not occur …