openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
818 stars 251 forks source link

sd mirroring -> system didn't boot #1768

Closed aravorn6 closed 1 year ago

aravorn6 commented 1 year ago

Issue information:

sd mirroring -> switch sdcard from sd card reader to rasberry slot -> system didn't boot so this backup method is not helpful in an emergency I'm not sure if it's a peculiarity in my system or if it affects everyone. scripts that are involved: sdrawcopy.service -> mirror_SD -> backup.bash

Debug information:

I nailed it down to the scrript backup.bash After the sucessfull dd copies, the PARTUUID should bet set.

SILENT=1
+ SILENT=1
export SILENT
+ export SILENT
if ! partUUID="$(yes | cond_redirect set-partuuid "${dest}2" random | awk '/^PARTUUID/ { print substr($7,1,length($7) - 3) }')"; then echo "FAILED (set random PARTUUID)"; dirty="yes"; fi
++ yes
++ cond_redirect set-partuuid /dev/sdb2 random
++ [[ -n 1 ]]
++ set-partuuid /dev/sdb2 random
++ awk '/^PARTUUID/ { print substr($7,1,length($7) - 3) }'
++ return 0
+ partUUID=

SILENT=
+ SILENT=
export SILENT
+ export SILENT
if ! partUUID="$(yes | set-partuuid "${dest}2" random | awk '/^PARTUUID/ { print substr($7,1,length($7) - 3) }')"; then echo "FAILED (set random PARTUUID)"; dirty="yes"; fi
++ yes
++ set-partuuid /dev/sdb2 random
++ awk '/^PARTUUID/ { print substr($7,1,length($7) - 3) }'
+ partUUID=dfcbed96` 

with the standard SILENT option the PARTUUID not returned and with SILENT not set the PARTUUID is ok

looks like the cond_redirect to /dev/null didn't work properly ith the yes pipe

without the PARTUUID the script could not change the PARTUUID in the /etc/fstab and didn't boot

System information:

PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Platform = Raspberry Pi 4 Model B Rev 1.5
Linux openhabian 6.1.19-v7l+ #1637 SMP Tue Mar 14 11:07:55 GMT 2023 armv7l
openHAB 3.4.2 - Release Build
mstormi commented 1 year ago

Thanks for digging down!

Fixed-By: d91dacc42ce243fd85a5815e8178c27a74da7655