Openhabian move root to sd error!

Tags: #<Tag:0x00007efec485d8c8> #<Tag:0x00007efec485d6e8>

Hey. there was a problem with transferring the system from sd card to external hdd Openhabian. The crux of the problem is that in the Openhabian-config menu, I’m trying to transfer the system from a flash drive to a hdd. Before that, I deleted zram menu 38) and rebooted the Raspberry. But when trying to transfer the system (menu 37), it gives an error that the system does not seem to be on the sd card and therefore the process is completed. What could be the problem is not strong on unix systems. Tell me what to do. Using RPi 4 and openHABian 1.6

What is the output of

sudo awk -F ' ' '{ print $4 }' /boot/cmdline.txt | sed -e 's|root=||g'

rootfstype=ext4

Code snippet that is being executed:

 rootPart="$(awk -F ' ' '{ print $4 }' /boot/cmdline.txt | sed -e 's|root=||g')"
  srcSize="$(blockdev --getsize64 /dev/mmcblk0)"
  destSize="$(blockdev --getsize64 "$newRootDev")"

  if ! (whiptail --title "Move system root to '${newRootPart}'?" --yes-button "Continue" --no-button "Cancel" --yesno "$introText" 24 80); then echo "CANCELED"; return 0; fi

  # Check if system root is on partition 2 of the SD card since 2017-06, RaspiOS uses PARTUUID=.... in cmdline.txt and fstab instead of /dev/mmcblk0p2
  if [[ $rootPart == "PARTUUID="* ]]; then
    if (blkid -l -t "$rootPart" | grep -qs "/dev/mmcblk0p2"); then
      rootOnSD="true"
    fi
  elif [[ $rootPart == "/dev/mmcblk0p2" ]]; then
    rootOnSD="true"
  fi

  # Exit if root is not on SD card
  if [[ $rootOnSD != "true" ]]; then
    whiptail --title "System root not on SD card!" --msgbox "It seems that your system root is not on the SD card.\\n\\n***Aborting, process cannot be started!***" 9 80
    return 0
  fi

Looks like the content of variable rootPart ( rootfstype=etx4 ) is not expected.
rootPart is checked against a string that starts with “PARTUUID=” and alternatively rootPart needs to be equal to /dev/mmcblk0p2.
As both is not the case rootOnSD is not true and you get the message “System root not on SD card”.

What is the content of /boot/cmdline.txt ?
You can do

sudo cat /boot/cmdline.txt

to see the complete content. In case it’s to long you may run

sudo cat /boot/cmdline.txt | more

Most probably only the rows with

sudo grep root= /boot/cmdline.txt

are relevant.

console=serial0,115200 console=tty1 root=PARTUUID=2a0e8df0-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

use debugmode=maximum in /etc/openhabian.conf to get live debug output

root=PARTUUID=2a0e8df0-02 is the third field in /boot/cmdline.txt. The script expects it to be the fourth field.
There are two possibilities:
a) change the sequence of the parameters in the cmdline.txt file but I am not sure if the system expects it to be in a fixed sequence. If it would be my system I would try it by having a backup.

or

b) edit the file ext-storage.bash and change the 4 to 3 in the code line that is mentioned in a previous post

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.