Mirror fails to boot

I’ havnig trouble with mirroring. I can’t boot from a mirrored SD card after more than one mirror. I’ve tried with multiple SD cards, the first mirror will work but any further full mirrors to the same SD card fail to boot. The mirror process completes without fail. I also had a working mirror fail to boot after re-syncing. I’ve tried with multiple pi’s and multiple SD cards. All with the same result. I then tried a fresh openhabian image. This mirrored but again the next mirror failed to boot.

Can you not re-mirror to an SD card that’s already been mirrored? Is there something I can change to have my mirror boot successfully?

In theory you can but probably noone ever tested but you.

You don’t give enough details it takes to answer. Do this upfront next time please.
And to be frank your description is confusing.

What HW do you use ?
How do you boot - by putting it into the internal SD slot? By specifying boot parameters (if so how?)
Do you have any card in the external reader when you try booting ?
Do you have any other mass storage attached?
How do you initiate mirroring ?
Set debugmode=maximum (see debug log) and initiate mirroring then repeat until you have a mirror that does not work then provide the log of its initiation and show the outputs of lsblk and blkid.

Interestingly I have run menu option 53 - Setup SD Mirroring 3 times since my first post and it worked each time. This kept failing to boot previously.

I then tried menu option 55 - Sync SD. After the process finished I tried booting from the synced card but it failed to boot. This fail twice in a row (menu item 53, susessful boot, menu item 55, failed to boot).

Below are answers to your questions and the output of menu option 55 - Sync SD, lsblk and blkid.

:black_small_square: Raspberry Pi4 4gb
:black_small_square: I’m booting from the internal SD slot
:black_small_square: I haven’t changed any boot parameters
:black_small_square: When booting from the mirrored drive I don’t have an external card reader attached. Just internal SD card (the mirror), power and ethernet
:black_small_square: No mass storage attached
:black_small_square: I’ve tried initiating mirroring using openhabian-config menu item 53 - Setup SD Mirroring, 54 - Raw copy SD and also using dd from my Mac with an external card reader.

Doesn’t the openhabian backup setup periodically full mirror? This is what led me to think that I was able to mirror to an SD with an existing mirror. I’ve tried formatting an SD card that is not booting and then mirroring to it again but this also didn’t boot.

Debug output:
I’ve tried include this output of the the Sync SD but it’s too long to be allowed to post. What the best way to share this?


sda           8:0    1   58G  0 disk 
├─sda1        8:1    1  256M  0 part 
├─sda2        8:2    1 29.5G  0 part 
└─sda3        8:3    1 28.3G  0 part /storage
mmcblk0     179:0    0 29.7G  0 disk 
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 29.5G  0 part /
zram0       254:0    0  200M  0 disk [SWAP]
zram1       254:1    0  150M  0 disk /opt/zram/zram1


/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="DC3E-E470" TYPE="vfat" PARTUUID="dcba1b89-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="a7adb26a-8b87-4729-99c8-9f5ac069d51e" TYPE="ext4" PARTUUID="dcba1b89-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="DC3E-E470" TYPE="vfat" PARTUUID="139473a5-01"
/dev/sda2: LABEL="rootfs" UUID="48b47de8-02b6-406c-8c58-f133141ce42f" TYPE="ext4" PARTUUID="139473a5-02"
/dev/sda3: UUID="c93edcd7-9840-48c6-a4f5-ab8893311e4a" TYPE="ext4" PARTUUID="139473a5-03"
/dev/zram0: LABEL="zram-config0" UUID="29960e6c-7977-42c4-ac87-f3e176254167" TYPE="swap"

What does “fail to boot” mean? What’s the console output then?
There’s nothing in your post that would explain it.

As in the Pi boot output (below)? or the Openhabian console? How do I show this? Login to console and run sync?

I’ve attached a photo of the Pi boot sequence.

When I initiated openhabian-config menu option 55 I selected partition sda2. (my understanding is sda1=boot and sda3=amanda storage)

After the boot failed i initiated menu option 55 again. The output of this sync fits in this post and is below.
Sync output:

++ whiptail --title 'Welcome to the openHABian Configuration Tool [main]patchday-20210118-1221(c1919f7)' --menu Backup/Restore 14 116 7 --cancel-button Back --ok-button Execute '50 | Backup openHAB config' 'Backup the current active openHAB configuration' '51 | Restore an openHAB config' 'Restore a previous openHAB configuration from backup' '52 | Amanda System Backup' 'Set up Amanda to comprehensively backup your complete openHABian box' '53 | Setup SD mirroring' 'Setup mirroring of internal to external SD card' '   | Remove SD mirroring' 'Disable mirroring of SD cards' '54 | Raw copy SD' 'Raw copy internal SD to external disk / SD card' '55 | Sync SD' 'Rsync internal SD to external disk / SD card'
+ choice2='55 | Sync SD'
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 255 ']'
+ case "$choice2" in
+ mirror_SD diff
+ local src=/dev/mmcblk0
+ local dest=/dev/sda
+ local start
+ local destPartsLargeEnough=true
+ local storageDir=/storage
+ local syncMount=/storage/syncmount
+ local dirty=no
+ local repartitionText
+ local 'dumpInfoText=For your information as the operator of this openHABian system:\nA timed background job to run semiannually has just created a full raw device copy of your RPI'\''s internal SD card.\nOnly partitions to contain openHABian (/boot and / partitions 1 & 2) were copied.'
+ local partUUID
+ [[ 1 -eq 1 ]]
+ [[ -n 1 ]]
+ select_blkdev '^sd' 'Setup SD mirroring' 'Select USB device to copy the internal SD card data to'
+ [[ -z 1 ]]
+ array=()
+ declare -a array
+ read -r id foo foo size foo foo foo
++ lsblk -i
++ tr -d '`\\|'
++ tr -d '\\-'
++ grep -E '^sd'
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ [[ 2 -eq 0 ]]
+ (( count=2 + 8 ))
++ whiptail --title 'Setup SD mirroring' --cancel-button Cancel --ok-button Select --menu '\nSelect USB device to copy the internal SD card data to' 10 76 0 sda 58G
+ retval=sda
+ dest=/dev/sda
+ [[ /dev/mmcblk0 == \/\d\e\v\/\s\d\a ]]
++ blockdev --getsize64 /dev/sda
+ [[ -n 62277025792 ]]
+ mount
+ grep -Eq '$dest[12]'
+ [[ -d /storage/syncmount ]]
+ [[ diff == \r\a\w ]]
+ [[ diff == \d\i\f\f ]]
+ pgrep 'dd if=/dev/mmcblk0'
+ [[ -n 1 ]]
+ select_blkdev '^-sd' 'select partition' 'Select the partition to copy the internal SD card data to'
+ [[ -z 1 ]]
+ array=()
+ declare -a array
+ read -r id foo foo size foo foo foo
++ lsblk -i
++ tr -d '`\\|'
++ grep -E '^-sd'
++ tr -d '\\-'
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ array+=("$id" "$size")
+ read -r id foo foo size foo foo foo
+ [[ 6 -eq 0 ]]
+ (( count=6 + 8 ))
++ whiptail --title 'select partition' --cancel-button Cancel --ok-button Select --menu '\nSelect the partition to copy the internal SD card data to' 14 76 0 sda1 256M sda2 29.5G sda3 28.3G
+ retval=sda2
+ dest=/dev/sda2
+ mount /dev/sda2 /storage/syncmount
+ mountpoint -q /storage/syncmount
+ cond_redirect rsync --one-file-system -avRh / /storage/syncmount
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ rsync --one-file-system -avRh / /storage/syncmount \033[39;49;00m'

$ rsync --one-file-system -avRh / /storage/syncmount 
+ rsync --one-file-system -avRh / /storage/syncmount
sending incremental file list

sent 209.75M bytes  received 17.37K bytes  5.59M bytes/sec
total size is 6.22G  speedup is 29.64
+ return 0
+ umount /storage/syncmount
+ '[' 0 -ne 0 ']'
+ true
+ show_main_menu
+ local choice
+ local version
+++ get_git_revision
+++ local branch
+++ local latestTag
+++ local revCount
+++ local shorthash
++++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+++ branch=main
++++ git -C /opt/openhabian describe --tags --abbrev=0
+++ latestTag=patchday-20210118
++++ git -C /opt/openhabian log --oneline
++++ wc -l
+++ revCount=1221
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=c1919f7
+++ echo '[main]patchday-20210118-1221(c1919f7)'
++ whiptail --title 'Welcome to the openHABian Configuration Tool [main]patchday-20210118-1221(c1919f7)' --menu 'Setup Options' 18 116 11 --cancel-button Exit --ok-button Execute '00 | About openHABian' 'Information about the openHABian project and this tool' '' '' '01 | Select Branch' 'Select the openHABian config tool version ("branch") to run' '02 | Upgrade System' 'Upgrade all installed software packages (incl. openHAB) to their latest version' '03 | Install openHAB' 'Install or upgrade to openHAB release 3' '' '' '10 | Apply Improvements' 'Apply the latest improvements to the basic openHABian setup ►' '20 | Optional Components' 'Choose from a set of optional software components ►' '30 | System Settings' 'A range of system and hardware related configuration steps ►' '40 | openHAB Related' 'Switch the installed openHAB version or apply tweaks ►' '50 | Backup/Restore' 'Manage backups and restore your system ►'

Well it doesn’t fail to boot does it.
Screenshots are unreadable therefore discouraged but it shows your box does boot.
It cannot mount a disk but I cannot see which one.
Just a guess: it’s sda3. If you use auto-back or manually setup Amanda, it’s there on the mirror.
But running mirroring again from the mirror will not mirror it, it’s just mirroring partitions 1 & 2 so
/dev/sda3 does not exist or is trash so cannot be mounted on boot.

Make an fsck of your failing SD and mount it as /mnt.
Try to remove /mnt/etc/systemd/system/storage.mount to see if it boots then.

Long story short: Only take mirrors of the original or adapt it afterwards.