No longer working?
Opened this issue · 2 comments
First of all thank you for this very useful script! I've used this script several times in the past. Unfortunately today it's giving me trouble. I'm using with Raspbian Lite 2018-03-13.
On the first boot of a freshly flashed SD card, this is my /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=20f1a3b0-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Here's /etc/fstab
PARTUUID=20f1a3b0-01 /boot vfat defaults 0 2
PARTUUID=20f1a3b0-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
Here's the results of "blkid -o export":
DEVNAME=/dev/mmcblk0p1
LABEL=boot
UUID=5DB0-971B
TYPE=vfat
PARTUUID=20f1a3b0-01
DEVNAME=/dev/mmcblk0p2
LABEL=rootfs
UUID=060b57a8-62bd-4d48-a471-0d28466d1fbb
TYPE=ext4
PARTUUID=20f1a3b0-02
OK, now here's what's in the script:
info "boot config" "Configuring boot from {$target_partition}"
# rootdelay=5 is likely not necessary here, but seems to do no harm.
cp /boot/cmdline.txt /boot/cmdline.txt.bak
sed -i "s|root=\/dev\/mmcblk0p2|root=PARTUUID=${partition_unique_guid} rootdelay=5|" /boot/cmdline.txt
info "boot config" "Commenting out old root partition in /etc/fstab, adding new one"
# These changes are made on the new drive after copying so that they
# don't have to be undone in order to switch back to booting from the
# SD card.
sed -i '/mmcblk0p2/s/^/#/' /mnt/etc/fstab
echo "/dev/disk/by-uuid/${target_partition_uuid} / ext4 defaults,noatime 0 1" >> /mnt/etc/fstab
I'm not experienced with "sed" so I can't suggest exactly how to fix the script, but it needs to not just be looking for /dev/mmcblk0p2 anymore when updating cmdline.txt and fstab. It's going to need some new search parameters to account for Raspbian using PARTUUID now.
In the meantime I'm going to either modify the original cmdline.txt and fstab settings to use /dev/mmcblk0p1 and /dev/mmcblk0p2 before I run the script. That or update fstab and cmdline.txt with the correct PARTUUID manually after I run the script.
It didn't work for me either. I ran it today. Can I have a step-by-step guide to how to make it work? Has anyone overcame these problems?
I can confirm that cmdline.txt does not get modified (I'm using Raspberry Pi OS based on Debian Buster with a RPi4).
The root filesystem is copied to a newly created ext4 partition on my external SSD as expected, but the partition UUID is not inserted into cmdline.txt. Another thing I noticed is that after running the script the original SD card root partition UUID is not commented out in /mnt/etc/fstab.
I was able to boot my RPi 4 from my external SSD by manually inserting the SSD's root partition UUID into cmdline.txt and commenting out the old partition UUID in /mnt/etc/fstab before rebooting.