Testing auto backup

Run blkid and compare UUIDs of internal and external SD.
If they’re equal, update openhabian to master branch and run dd sync via menu 54.

[12:24:00] openhabian@ohab2:~$ blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/sdb1: UUID="fbbff3f2-ab8d-d601-f017-f3f2ab8dd601" TYPE="ext4" PARTUUID="eeaebe6d-01"
/dev/sda3: UUID="30940710-15c1-4afc-80cb-8cfb4c2342de" TYPE="ext4" PARTUUID="4969f77f-03"
/dev/zram0: LABEL="zram-config0" UUID="d0c0e888-367f-4448-ab7a-04f9657e790c" TYPE="swap"
/dev/zram1: UUID="32d67301-6e60-4c17-ae52-03b921941e72" TYPE="ext4"
/dev/zram2: UUID="0b21779f-03f7-4cb7-9913-7915e93bd841" TYPE="ext4"

sda1 & sda2 not listed…
sdb1 is a usb stick (influxdb data)

edit: (idblk command not found)

Yes those are probably the important ones if it’s them you copied/synced your internal SD to.
These you need to compare with /dev/mmcblk0p1 & 2.
Is the card properly inserted ?

I wrote this because it’ll malfunction if there’s duplicates. I added code to ensure this but you have not run that (yet) on your system

yes, and sda3 (/storage) is also there…

should i do this now?

does this help?

[12:23:19] openhabian@ohab2:~$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 29.7G  0 disk
├─sda1        8:1    1  256M  0 part
├─sda2        8:2    1 14.6G  0 part
└─sda3        8:3    1 14.9G  0 part /storage
sdb           8:16   1 1006M  0 disk
└─sdb1        8:17   1 1003M  0 part /media/influxdbstick
mmcblk0     179:0    0 14.9G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 14.6G  0 part /
zram0       254:0    0  600M  0 disk [SWAP]
zram1       254:1    0  500M  0 disk /opt/zram/zram1
zram2       254:2    0  500M  0 disk /opt/zram/zram2

yes
but upgrade to latest master first.

i don’t think this went well:

++ whiptail --title 'Backup options' --menu 'Backup options' 14 116 7 --cancel-button Back --ok-button Execute '50 | B                                                                                                                                                                                                       ackup openHAB config' 'Backup the current active openHAB configuration' '51 | Restore an openHAB config' 'Restore a pr                                                                                                                                                                                                       evious openHAB configuration from backup' '52 | Amanda System Backup' 'Set up Amanda to comprehensively backup your co                                                                                                                                                                                                       mplete openHABian box' '53 | Setup SD mirroring' 'Setup mirroring of internal to external SD card' '   | Remove SD mir                                                                                                                                                                                                       roring' 'Disable mirroring of SD cards' '54 | Raw copy SD' 'Raw copy internal SD to external disk / SD card' '55 | Syn                                                                                                                                                                                                       c SD' 'Rsync internal SD to external disk / SD card'
+ choice2='54 | Raw copy SD'
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 255 ']'
+ case "$choice2" in
+ mirror_SD raw
+ local src=/dev/mmcblk0
+ local dest
+ local start
+ local storageDir=/storage
+ local syncMount=/storage/syncmount
+ local dirty=no
+ [[ -n 1 ]]
+ select_blkdev '^sd' 'Setup SD mirroring' 'Select the USB attached disk 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 '`\\|'
++ 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
+ [[ 4 -eq 0 ]]
++ whiptail --title 'Setup SD mirroring' --cancel-button Cancel --ok-button Select --menu 'Select the USB attached dis                                                                                                                                                                                                       k device to copy the internal SD card data to' 12 76 4 sda 29.7G sdb 1006M
+ retval=sda
+ [[ -z sda ]]
+ dest=/dev/sda
+ [[ /dev/mmcblk0 == \/\d\e\v\/\s\d\a ]]
++ blockdev --getsize64 /dev/sda
+ [[ -n 31914983424 ]]
++ mount
++ grep /dev/sda
+ [[ -n '' ]]
+ [[ raw == \r\a\w ]]
+ echo 'Creating a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card'
Creating a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card
+ cond_redirect dd if=/dev/mmcblk0 bs=1M of=/dev/sda
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ dd if=/dev/mmcblk0 bs=1M of=/dev/sda \033[39;49;00m'

$ dd if=/dev/mmcblk0 bs=1M of=/dev/sda
+ dd if=/dev/mmcblk0 bs=1M of=/dev/sda
15193+1 records in
15193+1 records out
15931539456 bytes (16 GB, 15 GiB) copied, 989.482 s, 16.1 MB/s
+ return 0
+ yes
+ cond_redirect set-partuuid /dev/sda random
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ set-partuuid /dev/sda random \033[39;49;00m'

$ set-partuuid /dev/sda random
+ set-partuuid /dev/sda random
/opt/openhabian/functions/helpers.bash: line 31: set-partuuid: command not found
+ return 127
+ echo 'FAILED (set random PARTUUID)'
FAILED (set random PARTUUID)
+ dirty=yes
+ cond_redirect fsck -y -t ext4 /dev/sda2
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ fsck -y -t ext4 /dev/sda2 \033[39;49;00m'

$ fsck -y -t ext4 /dev/sda2
+ fsck -y -t ext4 /dev/sda2
fsck from util-linux 2.33.1
e2fsck 1.44.5 (15-Dec-2018)
rootfs: recovering journal
Setting free inodes count to 862148 (was 864056)
Setting free blocks count to 2368617 (was 2376094)
rootfs: clean, 73852/936000 files, 1454359/3822976 blocks
+ return 0
+ [[ yes == \n\o ]]
+ return 0
+ '[' 0 -ne 0 ']'
+ true
+ show_main_menu
+++ get_git_revision
+++ local branch
+++ local latestTag
+++ local revCount
+++ local shorthash
++++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+++ branch=master
++++ git -C /opt/openhabian describe --tags --abbrev=0
+++ latestTag=v1.6-alpha
++++ git -C /opt/openhabian log --oneline
++++ wc -l
+++ revCount=842
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=a04bec2
+++ echo '[master]v1.6-alpha-842(a04bec2)'
++ whiptail --title 'Welcome to the openHABian Configuration Tool [master]v1.6-alpha-842(a04bec2)' --menu 'Setup Optio                                                                                                                                                                                                       ns' 18 116 11 --cancel-button Exit --ok-button Execute '00 | About openHABian' 'Information about the openHABian proje                                                                                                                                                                                                       ct and this tool' '' '' '01 | Select Branch' 'Select the openHABian config tool version ("branch") to run' '02 | Upgra                                                                                                                                                                                                       de System' 'Upgrade all installed software packages (incl. openHAB) to their latest version' '03 | openHAB Stable' 'In                                                                                                                                                                                                       stall or upgrade to the latest stable release of openHAB 2' '' '' '10 | Apply Improvements' 'Apply the latest improvem                                                                                                                                                                                                       ents 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 ►'

you didn’t upgrade first.
EDIT:
Download https://raw.githubusercontent.com/openhab/openhabian/master/includes/set-partuuid or copy from /opt/openhabian/includes to /usr/local/sbin and re-run the command set-partuuid /dev/sda random that failed.

openhabian-config updates itself, right?
i got the update-message before and assumed it updated itselft… now the update-msg doesn’t appear anymore…

Welcome to the openHABian Configuration Tool [master]v1.6-alpha-842(a04bec2)

[13:41:20] root@ohab2:/usr/local/sbin# set-partuuid /dev/sda random

gdisk not installed

Ok to install gdisk (y/n)? y

Installing gdisk

Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:3 https://deb.nodesource.com/node_12.x buster InRelease
Hit:4 https://repos.influxdata.com/debian buster InRelease
Ign:5 https://dl.bintray.com/openhab/apt-repo2 stable InRelease
Hit:6 https://packages.grafana.com/oss/deb stable InRelease
Get:7 https://dl.bintray.com/openhab/apt-repo2 stable Release [6,051 B]
Fetched 6,051 B in 4s (1,411 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  gdisk
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 181 kB of archives.
After this operation, 699 kB of additional disk space will be used.
Get:1 http://raspbian.mirror.garr.it/mirrors/raspbian/raspbian buster/main armhf gdisk armhf 1.0.3-1.1 [181 kB]
Fetched 181 kB in 1s (291 kB/s)
Selecting previously unselected package gdisk.
(Reading database ... 58292 files and directories currently installed.)
Preparing to unpack .../gdisk_1.0.3-1.1_armhf.deb ...
Unpacking gdisk (1.0.3-1.1) ...
Setting up gdisk (1.0.3-1.1) ...
Processing triggers for man-db (2.8.5-2) ...
Updating FireMotD available updates count ...

Invalid DEVICE: /dev/sda

Usage: /usr/local/sbin/set-partuuid device [ hhhhhhhh-02 | hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh | random ]

SD not inserted ? evtl. sudo partprobe

[16:26:30] root@ohab2:/home/openhabian# partprobe
Error: Partition(s) 3 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.

:frowning:

/dev/sda3 is still shown as mounted:

[16:26:59] root@ohab2:/home/openhabian# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 29.7G  0 disk
├─sda1        8:1    1  256M  0 part
├─sda2        8:2    1 14.6G  0 part
└─sda3        8:3    1 14.9G  0 part /storage

Whatever. Think of it on next boot and run the script to ensure unique UUIDs.
(boot with external UNPLUGGED to make sure then plugin before running the commands).

[20:35:31] root@ohab2:/home/openhabian# sudo blkid -o list -w /dev/null
device                     fs_type     label        mount point                    UUID
-----------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0p1             vfat        boot         /boot                          4AD7-B4D5
/dev/mmcblk0p2             ext4        rootfs       /                              2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/sda1                  ext4                     /media/influxdbstick           fbbff3f2-ab8d-d601-f017-f3f2ab8dd601
/dev/mmcblk0                                        (in use)
/dev/zram0                 swap        zram-config0 [SWAP]                         db2318a9-4e58-486b-82da-f4d867520f53
/dev/zram1                 ext4                     /opt/zram/zram1                5aab68a3-2af2-4f9d-9203-ab3424f7d918
/dev/zram2                 ext4                     /opt/zram/zram2                613510b0-1f5f-459b-840f-01d049e85965
[20:35:34] root@ohab2:/home/openhabian# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 1006M  0 disk
└─sda1        8:1    1 1003M  0 part /media/influxdbstick
mmcblk0     179:0    0 14.9G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 14.6G  0 part /
zram0       254:0    0  600M  0 disk [SWAP]
zram1       254:1    0  500M  0 disk /opt/zram/zram1
zram2       254:2    0  500M  0 disk /opt/zram/zram2
[20:36:07] root@ohab2:/home/openhabian# blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/sda1: UUID="fbbff3f2-ab8d-d601-f017-f3f2ab8dd601" TYPE="ext4" PARTUUID="eeaebe6d-01"
/dev/zram0: LABEL="zram-config0" UUID="db2318a9-4e58-486b-82da-f4d867520f53" TYPE="swap"
/dev/zram1: UUID="5aab68a3-2af2-4f9d-9203-ab3424f7d918" TYPE="ext4"
/dev/zram2: UUID="613510b0-1f5f-459b-840f-01d049e85965" TYPE="ext4"
/dev/mmcblk0: PTUUID="d0c18a5b" PTTYPE="dos"

plugging in sd card

[20:36:11] root@ohab2:/home/openhabian# sudo blkid -o list -w /dev/null
device                     fs_type     label        mount point                    UUID
-----------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0p1             vfat        boot         /boot                          4AD7-B4D5
/dev/mmcblk0p2             ext4        rootfs       /                              2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/sda1                  ext4                     /media/influxdbstick           fbbff3f2-ab8d-d601-f017-f3f2ab8dd601
/dev/zram0                 swap        zram-config0 [SWAP]                         db2318a9-4e58-486b-82da-f4d867520f53
/dev/zram1                 ext4                     /opt/zram/zram1                5aab68a3-2af2-4f9d-9203-ab3424f7d918
/dev/zram2                 ext4                     /opt/zram/zram2                613510b0-1f5f-459b-840f-01d049e85965
/dev/mmcblk0                                        (in use)
/dev/sdb1                  vfat        boot         (not mounted)                  4AD7-B4D5
/dev/sdb2                  ext4        rootfs       (not mounted)                  2887d26c-6ae7-449d-9701-c5a4018755b0
[20:37:35] root@ohab2:/home/openhabian# blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/sda1: UUID="fbbff3f2-ab8d-d601-f017-f3f2ab8dd601" TYPE="ext4" PARTUUID="eeaebe6d-01"
/dev/zram0: LABEL="zram-config0" UUID="db2318a9-4e58-486b-82da-f4d867520f53" TYPE="swap"
/dev/zram1: UUID="5aab68a3-2af2-4f9d-9203-ab3424f7d918" TYPE="ext4"
/dev/zram2: UUID="613510b0-1f5f-459b-840f-01d049e85965" TYPE="ext4"
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/sdb2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/mmcblk0: PTUUID="d0c18a5b" PTTYPE="dos"
[20:37:52] root@ohab2:/home/openhabian# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 1006M  0 disk
└─sda1        8:1    1 1003M  0 part /media/influxdbstick
sdb           8:16   1 29.7G  0 disk
├─sdb1        8:17   1  256M  0 part
└─sdb2        8:18   1 14.6G  0 part
mmcblk0     179:0    0 14.9G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 14.6G  0 part /
zram0       254:0    0  600M  0 disk [SWAP]
zram1       254:1    0  500M  0 disk /opt/zram/zram1
zram2       254:2    0  500M  0 disk /opt/zram/zram2

same UUID for /dev/sdb* and internal sd card partitions… /dev/sdb3 missing (this was my amanda backup location). now running openhabian-config / 54 (updated itself before)

++ whiptail --title 'Backup options' --menu 'Backup options' 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='54 | Raw copy SD'
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 255 ']'
+ case "$choice2" in
+ mirror_SD raw
+ local src=/dev/mmcblk0
+ local dest
+ local start
+ local storageDir=/storage
+ local syncMount=/storage/syncmount
+ local dirty=no
+ [[ -n 1 ]]
+ select_blkdev '^sd' 'Setup SD mirroring' 'Select the USB attached disk 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 '`\\|'
++ 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
+ [[ 4 -eq 0 ]]
++ whiptail --title 'Setup SD mirroring' --cancel-button Cancel --ok-button Select --menu 'Select the USB attached disk device to copy the internal SD card data to' 12 76 4 sda 1006M sdb 29.7G
+ retval=sdb
+ [[ -z sdb ]]
+ dest=/dev/sdb
+ [[ /dev/mmcblk0 == \/\d\e\v\/\s\d\b ]]
++ blockdev --getsize64 /dev/sdb
+ [[ -n 31914983424 ]]
++ mount
++ grep /dev/sdb
+ [[ -n '' ]]
+ [[ raw == \r\a\w ]]
+ echo 'Creating a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card'
Creating a raw partition copy, be prepared this may take long such as 20-30 minutes for a 16 GB SD card
+ cond_redirect dd if=/dev/mmcblk0 bs=1M of=/dev/sdb
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ dd if=/dev/mmcblk0 bs=1M of=/dev/sdb \033[39;49;00m'

$ dd if=/dev/mmcblk0 bs=1M of=/dev/sdb
+ dd if=/dev/mmcblk0 bs=1M of=/dev/sdb
15193+1 records in
15193+1 records out
15931539456 bytes (16 GB, 15 GiB) copied, 992.774 s, 16.0 MB/s
+ return 0
+ yes
+ cond_redirect set-partuuid /dev/sdb random
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ set-partuuid /dev/sdb random \033[39;49;00m'

$ set-partuuid /dev/sdb random
+ set-partuuid /dev/sdb random

Invalid DEVICE: /dev/sdb

Usage: /usr/local/sbin/set-partuuid device [ hhhhhhhh-02 | hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh | random ]

+ return 1
+ echo 'FAILED (set random PARTUUID)'
FAILED (set random PARTUUID)
+ dirty=yes
+ cond_redirect fsck -y -t ext4 /dev/sdb2
+ [[ -n '' ]]
+ echo -e '\n\033[90;01m$ fsck -y -t ext4 /dev/sdb2 \033[39;49;00m'

$ fsck -y -t ext4 /dev/sdb2
+ fsck -y -t ext4 /dev/sdb2
fsck from util-linux 2.33.1
e2fsck 1.44.5 (15-Dec-2018)
rootfs: recovering journal
Setting free inodes count to 861913 (was 861958)
Setting free blocks count to 2349957 (was 2349556)
rootfs: clean, 74087/936000 files, 1473019/3822976 blocks
+ return 0
+ [[ yes == \n\o ]]
+ return 0
+ '[' 0 -ne 0 ']'
+ true
+ show_main_menu
+++ get_git_revision
+++ local branch
+++ local latestTag
+++ local revCount
+++ local shorthash
++++ git -C /opt/openhabian rev-parse --abbrev-ref HEAD
+++ branch=master
++++ git -C /opt/openhabian describe --tags --abbrev=0
+++ latestTag=v1.6-alpha
++++ git -C /opt/openhabian log --oneline
++++ wc -l
+++ revCount=844
++++ git -C /opt/openhabian log --pretty=format:%h -n 1
+++ shorthash=6437c42
+++ echo '[master]v1.6-alpha-844(6437c42)'
++ whiptail --title 'Welcome to the openHABian Configuration Tool [master]v1.6-alpha-844(6437c42)' --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 | openHAB Stable' 'Install or upgrade to the latest stable release of openHAB 2' '' '' '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 ►'
+ choice=
+ RET=1
+ '[' 1 -eq 1 ']'
+ return 255
+ system_check_default_password
+ is_pi
+ is_pizero
+ [[ '' == \p\i\0 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]09[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pizerow
+ [[ '' == \p\i\0\w ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[cC][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pione
+ [[ '' == \p\i\1 ]]
+ grep -q '^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$' /proc/cpuinfo
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmone
+ [[ '' == \c\m\1 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]06[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pitwo
+ [[ '' == \p\i\2 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]04[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithree
+ [[ '' == \p\i\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]08[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthree
+ [[ '' == \c\m\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[aA][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithreeplus
+ [[ '' == \p\i\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[dDeE][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthreeplus
+ [[ '' == \c\m\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]10[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pifour
+ [[ '' == \p\i\4 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]11[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ local algo
+ local defaultPassword
+ local defaultUser
+ local generatedPassword
+ local introText
+ local originalPassword
+ local salt
+ is_pi
+ is_pizero
+ [[ '' == \p\i\0 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]09[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pizerow
+ [[ '' == \p\i\0\w ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[cC][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pione
+ [[ '' == \p\i\1 ]]
+ grep -q '^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$' /proc/cpuinfo
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmone
+ [[ '' == \c\m\1 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]06[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pitwo
+ [[ '' == \p\i\2 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]04[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithree
+ [[ '' == \p\i\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]08[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthree
+ [[ '' == \c\m\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[aA][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithreeplus
+ [[ '' == \p\i\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[dDeE][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthreeplus
+ [[ '' == \c\m\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]10[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pifour
+ [[ '' == \p\i\4 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]11[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ id -u pi
+ is_pi
+ is_pizero
+ [[ '' == \p\i\0 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]09[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pizerow
+ [[ '' == \p\i\0\w ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[cC][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pione
+ [[ '' == \p\i\1 ]]
+ grep -q '^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$' /proc/cpuinfo
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmone
+ [[ '' == \c\m\1 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]06[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pitwo
+ [[ '' == \p\i\2 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]04[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithree
+ [[ '' == \p\i\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]08[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthree
+ [[ '' == \c\m\3 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[aA][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pithreeplus
+ [[ '' == \p\i\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[dDeE][0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_cmthreeplus
+ [[ '' == \c\m\3\+ ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]10[0-9a-fA-F]$' /proc/cpuinfo
+ return 1
+ is_pifour
+ [[ '' == \p\i\4 ]]
+ grep -q '^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]11[0-9a-fA-F]$' /proc/cpuinfo
+ return 0
+ return 0
+ defaultUser=openhabian
+ defaultPassword=openhabian
++ grep -w openhabian /etc/shadow
++ cut -d: -f2
+ originalPassword='$6$Oa2jE7q9LCf2pwQg$CLetQr8dlemHVGxr9.wbHNvBb6ka.UdH.8usMFy8XpTqxGP15mVAkART3WMCVWhNCWoGU7kJFpwyuyp1EpmpQ1'
++ echo '$6$Oa2jE7q9LCf2pwQg$CLetQr8dlemHVGxr9.wbHNvBb6ka.UdH.8usMFy8XpTqxGP15mVAkART3WMCVWhNCWoGU7kJFpwyuyp1EpmpQ1'
++ cut '-d$' -f2
+ algo=6
+ introText='The default password was detected on your system! That is a serious security concern. Bad guys or malicious programs in your subnet are able to gain root access!\n\nPlease set a strong password by typing the command '\''passwd openhabian'\''!'
++ echo '$6$Oa2jE7q9LCf2pwQg$CLetQr8dlemHVGxr9.wbHNvBb6ka.UdH.8usMFy8XpTqxGP15mVAkART3WMCVWhNCWoGU7kJFpwyuyp1EpmpQ1'
++ cut '-d$' -f3
+ salt=Oa2jE7q9LCf2pwQg
+ export algo defaultPassword salt
++ perl -le 'print crypt("$ENV{defaultPassword}","\$$ENV{algo}\$$ENV{salt}\$")'
+ generatedPassword='$6$Oa2jE7q9LCf2pwQg$9HTAmBlN7dLelML.38m4zn0c87LbiBI6xQjDcD5xAeCDQQuMxeD6a3ueqs8x2w13Kogedhqd.gVsgbQ96lNM71'
++ timestamp
++ date +%F_%T_%Z
+ echo -n '2020-09-22_21:04:30_CEST [openHABian] Checking for default openHABian username:password combination... '
2020-09-22_21:04:30_CEST [openHABian] Checking for default openHABian username:password combination... ++ id -u openhabian
+ [[ -n 1000 ]]
+ [[ $6$Oa2jE7q9LCf2pwQg$9HTAmBlN7dLelML.38m4zn0c87LbiBI6xQjDcD5xAeCDQQuMxeD6a3ueqs8x2w13Kogedhqd.gVsgbQ96lNM71 == \$\6\$\O\a\2\j\E\7\q\9\L\C\f\2\p\w\Q\g\$\C\L\e\t\Q\r\8\d\l\e\m\H\V\G\x\r\9\.\w\b\H\N\v\B\b\6\k\a\.\U\d\H\.\8\u\s\M\F\y\8\X\p\T\q\x\G\P\1\5\m\V\A\k\A\R\T\3\W\M\C\V\W\h\N\C\W\o\G\U\7\k\J\F\p\w\y\u\y\p\1\E\p\m\p\Q\1 ]]
+ echo OK
OK
++ timestamp
++ date +%F_%T_%Z
+ echo -e '2020-09-22_21:04:30_CEST [openHABian] We hope you got what you came for! See you again soon ;)'
2020-09-22_21:04:30_CEST [openHABian] We hope you got what you came for! See you again soon ;)
+ cd /opt
[21:04:30] root@ohab2:/home/openhabian# sudo blkid -o list -w /dev/null
device                     fs_type     label        mount point                    UUID
-----------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0p1             vfat        boot         /boot                          4AD7-B4D5
/dev/mmcblk0p2             ext4        rootfs       /                              2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/sda1                  ext4                     /media/influxdbstick           fbbff3f2-ab8d-d601-f017-f3f2ab8dd601
/dev/zram0                 swap        zram-config0 [SWAP]                         db2318a9-4e58-486b-82da-f4d867520f53
/dev/zram1                 ext4                     /opt/zram/zram1                5aab68a3-2af2-4f9d-9203-ab3424f7d918
/dev/zram2                 ext4                     /opt/zram/zram2                613510b0-1f5f-459b-840f-01d049e85965
/dev/sdb1                  vfat        boot         (not mounted)                  4AD7-B4D5
/dev/sdb2                  ext4        rootfs       (not mounted)                  2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/mmcblk0                                        (in use)

it’s still the same UUID(s)? and still no /dev/sdb3 ?

[21:05:27] root@ohab2:/home/openhabian# blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/sda1: UUID="fbbff3f2-ab8d-d601-f017-f3f2ab8dd601" TYPE="ext4" PARTUUID="eeaebe6d-01"
/dev/zram0: LABEL="zram-config0" UUID="db2318a9-4e58-486b-82da-f4d867520f53" TYPE="swap"
/dev/zram1: UUID="5aab68a3-2af2-4f9d-9203-ab3424f7d918" TYPE="ext4"
/dev/zram2: UUID="613510b0-1f5f-459b-840f-01d049e85965" TYPE="ext4"
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/sdb2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/mmcblk0: PTUUID="d0c18a5b" PTTYPE="dos"
[21:06:59] root@ohab2:/home/openhabian# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 1006M  0 disk
└─sda1        8:1    1 1003M  0 part /media/influxdbstick
sdb           8:16   1 29.7G  0 disk
├─sdb1        8:17   1  256M  0 part
└─sdb2        8:18   1 14.6G  0 part
mmcblk0     179:0    0 14.9G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 14.6G  0 part /
zram0       254:0    0  600M  0 disk [SWAP]
zram1       254:1    0  500M  0 disk /opt/zram/zram1
zram2       254:2    0  500M  0 disk /opt/zram/zram2
[21:07:04] root@ohab2:/home/openhabian# set-partuuid /dev/sdb random

Invalid DEVICE: /dev/sdb

Usage: /usr/local/sbin/set-partuuid device [ hhhhhhhh-02 | hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh | random ]

[21:08:12] root@ohab2:/home/openhabian# partprobe
[21:08:48] root@ohab2:/home/openhabian#

No idea. Tried /dev/sdb2 as device? Plugged card, plugged device ?

[21:11:30] root@ohab2:/home/openhabian# set-partuuid /dev/sdb2 random

Set PARTUUID on /dev/sdb2 to random (y/n)? y


PARTUUID on /dev/sdb2 is set to 2fe1e029-02

[21:41:42] root@ohab2:/home/openhabian#
[21:41:42] root@ohab2:/home/openhabian# sudo blkid -o list -w /dev/null
device                     fs_type     label        mount point                    UUID
-----------------------------------------------------------------------------------------------------------------------
/dev/mmcblk0p1             vfat        boot         /boot                          4AD7-B4D5
/dev/mmcblk0p2             ext4        rootfs       /                              2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/sda1                  ext4                     /media/influxdbstick           fbbff3f2-ab8d-d601-f017-f3f2ab8dd601
/dev/sdb1                  vfat        boot         (not mounted)                  4AD7-B4D5
/dev/sdb2                  ext4        rootfs       (not mounted)                  2887d26c-6ae7-449d-9701-c5a4018755b0
/dev/mmcblk0                                        (in use)
/dev/zram0                 swap        zram-config0 [SWAP]                         c29ce216-1d0d-4c53-89a6-b2680ac90f6d
/dev/zram1                 ext4                     /opt/zram/zram1                57da401e-011e-4bb9-a271-0da9ea7abcd3
/dev/zram2                 ext4                     /opt/zram/zram2                7e7fd423-d4d2-4fd2-bb34-0f3e5332d1e2

UUID is still the same.

pulled device.

But PARTUUID is not. That’s what we wanted.
Did that command also change PARTUUID of /dev/sdb1 ?

yes, i think so:

[21:41:51] root@ohab2:/home/openhabian# blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="d0c18a5b-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="d0c18a5b-02"
/dev/sdb1: LABEL_FATBOOT="boot" LABEL="boot" UUID="4AD7-B4D5" TYPE="vfat" PARTUUID="2fe1e029-01"
/dev/sdb2: LABEL="rootfs" UUID="2887d26c-6ae7-449d-9701-c5a4018755b0" TYPE="ext4" PARTUUID="2fe1e029-02"

and i’m back to square one with zram and/or persistence. one on of the last reboots / shutdowns i lost my persistence data of the last 4 days (atm zram-config status and zramctl look good)… :man_facepalming:

This could have caused that: when 2 partitions have the same PARTUUID it’s coincidence which one is booted from.

this = lost persistence data?

what should i do regarding autobackup now?

yes

If the PARTUUIDs are different now: nothing.