Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dietpi-drive_manager Transfer RootFS not working in Odroid C2 #4733

Closed
yandritos opened this issue Sep 13, 2021 · 2 comments
Closed

dietpi-drive_manager Transfer RootFS not working in Odroid C2 #4733

yandritos opened this issue Sep 13, 2021 · 2 comments
Labels
Milestone

Comments

@yandritos
Copy link

yandritos commented Sep 13, 2021

- DietPi version |
G_DIETPI_VERSION_CORE=7
G_DIETPI_VERSION_SUB=5
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
G_LIVE_PATCH_STATUS[0]='not applicable'

- Distro version |
10.10

- Kernel version |
Linux DietPi 3.16.85+ #1 SMP PREEMPT Tue Jun 30 19:02:35 CEST 2020 aarch64 GNU/Linux

- SBC model |
Odroid C2 (aarch64)

- Power supply used |
5V 2A

- SDcard used |
SanDisk ultra 16Gb

Additional Information (if applicable)

- Was the software title installed freshly or updated/migrated?
-Fresh install

Can this issue be replicated on a fresh installation of DietPi?
Yes

- Bug report ID | echo $G_HW_UUID
[ OK ] DietPi-Bugreport | Sending bug report
[ INFO ] DietPi-Bugreport | Reference code: f1f426f5-51d7-4d2b-bd70-ed8902dc2967

Steps to reproduce

  1. After a fresh install of dietPI in Odroid C2
  2. Execute the dietpi-drive_manager
  3. Select an external HDD connected via USB
  4. select the option !Transfer RootFS" to this unit and follow the steps (format ext 4, type no matter is "drive" or "partition" same result.

Expected behaviour

Complete the transfer process

Actual behaviour

Raises this next error:

_DietPi-Drive_Manager ├───────────────────────────┐
│ - Command: sed -i s##root=UUID=24d16755-9c44-4541-b2ea-0fa717ad2bec#g │
│ /boot/boot.ini │
│ - Exit code: 1 │
│ - DietPi version: v7.5.2 (MichaIng/master) | HW_MODEL: 12 | HW_ARCH: 3 | │
│ DISTRO: 5 │
│ - Image creator: DietPi Core Team │
│ - Pre-image: Meveric │
│ - Error log: │
│ sed: -e expression #1, char 0: no previous regular expression_

Extra details

This is the full trace of the execution:

_dietpi-drive_manager
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p2 > /
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p1 > /boot
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/sda1 > /mnt/usb_1
[ OK ] DietPi-Drive_Manager | mv .fstab /etc/fstab
[ OK ] DietPi-Drive_Manager | systemctl daemon-reload
[ OK ] DietPi-Drive_Manager | sync
dumpe2fs 1.44.5 (15-Dec-2018)
[ OK ] DietPi-Drive_Manager | umount /mnt/usb_1
[ OK ] DietPi-Drive_Manager | systemctl stop mnt-usb_1.automount
[ OK ] DietPi-Drive_Manager | rmdir /mnt/usb_1
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p2 > /
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p1 > /boot
[ INFO ] DietPi-Drive_Manager | - Detected unmounted drive: /dev/sda1
[ OK ] DietPi-Drive_Manager | mv .fstab /etc/fstab
[ OK ] DietPi-Drive_Manager | systemctl daemon-reload
[ OK ] DietPi-Drive_Manager | sync
[ INFO ] DietPi-Drive_Manager | Writing zeros to partition /dev/sda1
[ OK ] DietPi-Drive_Manager | dd if=/dev/zero of=/dev/sda1 bs=4K count=1337
[ OK ] DietPi-Drive_Manager | mkfs.ext4 -F -m 0 /dev/sda1
resize2fs 1.44.5 (15-Dec-2018)
The filesystem is already 122096385 (4k) blocks long. Nothing to do!

[ OK ] DietPi-Drive_Manager | sync
[ OK ] DietPi-Drive_Manager | Created ext4 filesystem: /dev/sda1
[ OK ] DietPi-Drive_Manager | mkdir -p /mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec
[ OK ] DietPi-Drive_Manager | mount /dev/sda1 /mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec
[ INFO ] DietPi-Drive_Manager | Detecting drives, please wait...
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p2 > /
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/mmcblk0p1 > /boot
[ INFO ] DietPi-Drive_Manager | - Detected mounted physical drive: /dev/sda1 > /mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec
[ OK ] DietPi-Drive_Manager | mv .fstab /etc/fstab
[ OK ] DietPi-Drive_Manager | systemctl daemon-reload
[ OK ] DietPi-Drive_Manager | sync
[ SUB1 ] DietPi-Services > stop
[ OK ] DietPi-Services | stop : cron
[ OK ] DietPi-Services | stop : plexmediaserver
[ INFO ] DietPi-Drive_Manager | Checking for required APT packages: rsync
[ OK ] DietPi-Drive_Manager | All required APT packages are already installed.
[ SUB1 ] DietPi-Set_swapfile > Applying 0 /var/swap
[ INFO ] DietPi-Set_swapfile | Disabling and deleting all existing swap files
[ OK ] DietPi-Set_swapfile | swapoff -a
[ OK ] DietPi-Set_swapfile | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_SWAPFILE_SIZE=0
[ OK ] DietPi-Set_swapfile | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_SWAPFILE_LOCATION=/var/swap
[ INFO ] DietPi-Set_swapfile | Setting /tmp tmpfs size: 863 MiB
[ OK ] DietPi-Set_swapfile | mount -o remount /tmp
[ OK ] DietPi-Drive_Manager | cp -a /etc/fstab /etc/fstab_new
[ OK ] DietPi-Drive_Manager | sed -i \@[[:blank:]]/mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec[[:blank:]]@d /etc/fstab_new
[ OK ] DietPi-Drive_Manager | sed -i \@UUID=[^[:blank:]]*[[:blank:]]\+/[[:blank:]]@cUUID=24d16755-9c44-4541-b2ea-0fa717ad2bec / ext4 noatime,lazytime,rw 0 1 /etc/fstab_new
[ OK ] DietPi-Drive_Manager | mkdir -p /tmp/tmp_rootfs
[ OK ] DietPi-Drive_Manager | mount /dev/mmcblk0p2 /tmp/tmp_rootfs
[ OK ] DietPi-Drive_Manager | rsync -aHv --delete /tmp/tmp_rootfs/ /mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec/
[ OK ] DietPi-Drive_Manager | mv /etc/fstab_new /mnt/24d16755-9c44-4541-b2ea-0fa717ad2bec/etc/fstab
[FAILED] DietPi-Drive_Manager | sed -i s##root=UUID=24d16755-9c44-4541-b2ea-0fa717ad2bec#g /boot/boot.ini_
@MichaIng MichaIng added this to the v7.6 milestone Sep 13, 2021
MichaIng added a commit that referenced this issue Sep 13, 2021
+ CHANGELOG | DietPi-Drive_Manager: Added support for moving the root filesystem to a different drive on Odroid N2
+ CHANGELOG | DietPi-Drive_Manager: Resolved an issue where on Odroid C2 moving the root filesystem to a different drive failed. Many thanks to @yandritos for reporting this issue: #4733
@MichaIng
Copy link
Owner

MichaIng commented Sep 13, 2021

Many thanks for your report.

Indeed there is a bug in the script, which is able to detect the root entry on Odroid XU4 correctly (https://github.com/MichaIng/DietPi/blob/master/boot_xu4.ini#L11) but not on C2 due to the leading " double quote character in front "root=": https://github.com/MichaIng/DietPi/blob/master/boot_c2.ini#L126

Fixed with: ed19661
Changelog: 82fb47a

What is that the on your Odroid now? Is it still running after you exited drive manager? Before rebooting, apply this change manually to boot.ini:

# Store the content of the old entry in a variable
rootfs_current=$(mawk '-F[" ]' '{for(i=1;i<=NF;i++) if($i~/^root=/) {print $i;exit}}' /boot/boot.ini)
# Verify that it is valid
echo "$rootfs_current"
# The output of the above should look like "root=UUID=24d16755-9c44-4541-b2ea-0fa717ad2bec" just with a different a different UUID.
# If so, apply it to your boot.ini
sed -i "s#$rootfs_current#root=UUID=24d16755-9c44-4541-b2ea-0fa717ad2bec#g" /boot/boot.ini
# You can then verify that is has been applied correctly
cat /boot/boot.ini

It should then look like here: https://github.com/MichaIng/DietPi/blob/master/boot_c2.ini#L126
but with /dev/mmcblk0p2 replaced by UUID=24d16755-9c44-4541-b2ea-0fa717ad2bec.

@MichaIng MichaIng added the Solution available 🥂 Definite solution has been done label Sep 13, 2021
@yandritos
Copy link
Author

Dear Michalng,

Thanks a lot for your very fast reply and the fix. I just finish to impement it and all worked!

Thanks again and have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants