adafruit / Adafruit-Pi-ExternalRoot-Helper

A shell script to configure a USB drive as root filesystem.
MIT License
69 stars 25 forks source link

cmdline.txt partuuid renaming failed #10

Open jshep321 opened 7 years ago

jshep321 commented 7 years ago

Hi, Ran this on an up-to-date jessie lite image today and everything worked well with one exception. The /boot/cmdline.txt.bak and cmdline.txt files were identical after reboot. I manually edited the partuuid to point to the sda1 image, rebooted, and all was fine.

New target was a HDD, not USB stick, fyi.

buteman commented 5 years ago

Ran the script on my 2018-11-23 stretch and had the same problem with cmdline.txt and fixed it the same way finding correct UUID using blkid. After this it booted but complained about 2 entries for / . It had added the new / in fstab but left the old one in.

jshep321 commented 5 years ago

Great! Unclear if anyone is monitoring/maintaining this anymore....

jshep321 commented 5 years ago

accidentally closed.

brennen commented 5 years ago

Great! Unclear if anyone is monitoring/maintaining this anymore....

An update pass on this & the related guide is on my list for One Of These Days, but as it's largely unnecessary with newer Pis it's a ways down the priority list.

jshep321 commented 5 years ago

OK, thanks. Curious about the "unnecessary"? Meaning no one uses HDD's or SSD's anymore?

brennen commented 5 years ago

Booting from a USB device is now directly supported on Raspberry Pi 3B, 3B+, 3A+ and Raspberry Pi 2B v1.2.

srob1 commented 4 years ago

Brennen: Unfortunately, USB mass storage boot is not yet supported on the Pi 4B, and the script is still essential for that device. Any chance that "One Of These Days" could be sooner rather than later? Before I found the issues list on GitHub, I ran into problems with the script on a Pi 4B, and posted a some of what went wrong to Adafruit's forums: https://forums.adafruit.com/viewtopic.php?f=50&t=163603&p=804006#p804006

brennen commented 4 years ago

Hey @srob1 - sorry to have left folks hanging here. I'm not doing any work for Adafruit these days (or really anything hardware related), so I haven't so much as booted any of my Pi hardware in months, and I haven't yet acquired a Pi 4.

I see that the Pi 4 is planned to gain support for USB mass storage at some nebulous point in the future. In the meantime, perhaps @ladyada has someone on staff who'd like to take a crack at it - I don't think the needed changes are all that drastic - but I'm afraid I probably won't have the spare cycles any time soon.

srob1 commented 4 years ago

@brennen

I believe I've worked out replacements for the sed commands that modify cmdline.txt and fstab near the end of the script. The following seem to work for me:

sed -i "s|root=[^ ]* |root=PARTUUID=${partition_unique_guid} rootdelay=5 |" /boot/cmdline.txt

sed -i 's/^([^ \t][ \t]\/[ \t*])/#\1/' /mnt/etc/fstab

Those are part of the issue with the script failing on recent Raspbian releases.

The issue that causes mke2fs to produce the error "The file /dev/sda1 does not exist and no size was specified." may be solved by adding the line "sleep 5" before invoking mkfs. See issue #5.

There is also an issue where mkfs interactively prompts for confirmation if there is already a file system on the target device.

brennen commented 4 years ago

I believe I've worked out replacements for the sed commands that modify cmdline.txt and fstab near the end of the script.

I no longer have write access here, but I'll note for anyone who does that #8 looks like it should be merged (for adding the sleep) and a PR for those 2 lines seems like it'd be a fine thing as well.

There is also an issue where mkfs interactively prompts for confirmation if there is already a file system on the target device.

I'm guessing mkfs.ext4 may have an option that skips the prompt, but I haven't looked very far into this.

srob1 commented 4 years ago

I just noticed a copy/paste error with the sed command I posted above for editing fstab. The fstab command should have been:

sed -i 's/^\([^ \t]*[ \t]*\/[ \t*]\)/#\1/' /mnt/etc/fstab

WarHawk8080 commented 1 year ago

It does rsync everything to the new drive...I just had to go into the /mnt/etc/fstab and manually comment out the 2nd partition of the SD card then go into /boot/cmdline.txt and manually update the PARTUID: to that of the actual USB drive...script is broken but it partially does it's job :(