RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Jul 28, 2019 10:06 am

xlc wrote:
Sun Jul 28, 2019 9:50 am
Ive placed it in my home directory and entered the run command but it says
sudo: ./usb-boot: command not found
Did you make it executable with?:

Code: Select all

chmod +x usb-boot

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Jul 28, 2019 11:04 am

ok thanks, doing it now.

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Jul 28, 2019 11:19 am

Finished script
rebooted
cannot ssh now and its not connecting to my router

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Jul 28, 2019 1:59 pm

Further investigation.
tried to comment out the cmdline.txt to make it boot from the SD and it wont.

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Jul 28, 2019 6:48 pm

xlc wrote:
Sun Jul 28, 2019 1:59 pm
Further investigation.
tried to comment out the cmdline.txt to make it boot from the SD and it wont.
To return booting to the SD card, you simply restore the SD card's cmdline.txt to its original contents:

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 29, 2019 6:32 am

ok thanks.
It must be my HDD doesnt spin up fast enough on boot?

What else can I do?
I really need at least my www folder and files on the usb.
Is their a tutorial I can follow for a noob?

Thanks

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 29, 2019 7:22 am

xlc wrote:
Mon Jul 29, 2019 6:32 am
What else can I do?
I would try to get USB booting to work (using usb-boot) on a USB flash drive instead of the HDD. This would confirm that the HDD is the source of the problem and that you can actually get USB booting to work.

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 29, 2019 8:49 am

Ok Ive tried it on a usb drive and it works fine, so its my HDD.

Is there anything I can do to make it boot on the HDD?

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Mon Jul 29, 2019 12:45 pm

Ive got 3 2.5 HDD in usb caddies and none of them work.
Ive tried setting a boot delay to give the HDD time to power up but it seems they dont receive any power until the boot process starts so this has no effect.
I have a usb splitter with power but even if I power the hard drives they dont appear to spin up until the boot process starts.

So looks like my only option is to use the SD card for boot and the HDD for everything else, but I have no idea how to do this. :?

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Tue Jul 30, 2019 4:13 am

usb-boot has been updated to allow using the native USB boot capability of a Raspberry Pi 3B+ or a Raspberry Pi 3B that has its OTP bit set. Booting USB devices using an SD card is still the most reliable way to run Raspbian on a USB device (including the Raspberry Pi 3B/3B+).

See the original post for complete details and to download:

usb-boot
Last edited by RonR on Wed Jul 31, 2019 2:33 am, edited 1 time in total.

xlc
Posts: 26
Joined: Mon Jul 22, 2019 9:21 am

Re: Running Raspbian on USB Devices : Made Easy

Tue Jul 30, 2019 7:01 am

Ive already done this???

itsmedoofer
Posts: 359
Joined: Wed Sep 25, 2013 8:43 am

Re: Running Raspbian on USB Devices : Made Easy

Tue Jul 30, 2019 11:20 am

RonR wrote:
Tue Jul 30, 2019 4:13 am
usb-boot has been updated to allow using the native USB boot capability of a Raspberry Pi 3B+ or a Raspberry Pi 3B that has its OTP bit set. Booting USB devices using an SD card is still the most reliable way to run Raspbian on a USB device (including the Raspberry Pi 3B/3B+).

See the original post for complete details and to download:

https://www.raspberrypi.org/forums/view ... 2#p1230182
Your work is much appreciated ! The Zram script was handy as well ! Thanks.

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Tue Jul 30, 2019 11:37 pm

usb-boot now auto-resizes the USB device to use the full amount of space available. No additional tools or steps are needed.

This occurs on the first boot of the USB device, so please be patient.

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Wed Jul 31, 2019 9:58 pm

itsmedoofer wrote:
Tue Jul 30, 2019 11:20 am
Your work is much appreciated ! The Zram script was handy as well ! Thanks.
Thanks for the feedback. I'm pleased to hear you found them useful.

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sat Aug 17, 2019 10:50 pm

Ron

Ran into a little issue. I am sure I just missed something. The script formats the drive and copies all the data over(as far as I can tell). But it does not edit the cmdline.txt file. In my case it is locate in /boot .

"[email protected]:~/Holding $ sudo ./usb-boot
sed: can't read /media/cmdline.txt: No such file or directory"

"/dev/sda2 on /media/fred/9e526adc-49ca-4db5-beee-771601c775ab type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)"

"/dev/sda1 on /media/fred/C799-0C57 type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)"

My instinct would be to edit in the long string in sda2 into the cmdline.txt, but I am not sure. Pi4-4gb, Downloaded script yesterday.

Thanks

Edit: Instincts were wrong it was the sda1. It edited the version on the flash drive but not the one on the micro drive. Any idea what I did wrong?

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 5:53 am

Brad,

I'm assuming you're running Raspbian Desktop. Desktop auto-mounts USB devices. The destination USB device cannot be mounted if you're going to copy the SD card to it. I've added a check and an error message to avoid having the script continue and fail. I also found and fixed another potential problem that might have caused what you experienced.

Would you please download the attached test version and let me know if it works properly now?

Thanks

Ron

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 6:14 am

"[email protected]:~/Holding $ sudo ./usb-boot-test
sed: can't read /tmp/usb-boot-mnt/cmdline.txt: No such file or directory

SD card must remain in place to boot the USB device"

To me it looks like it is trying to edit the one on the usb flash drive. Does it not want to edit the one on the micro sd card?

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 6:32 am

Brad Q wrote:
Sun Aug 18, 2019 6:14 am
"[email protected]:~/Holding $ sudo ./usb-boot-test
sed: can't read /tmp/usb-boot-mnt/cmdline.txt: No such file or directory

SD card must remain in place to boot the USB device"

To me it looks like it is trying to edit the one on the usb flash drive. Does it not want to edit the one on the micro sd card?

/dev/mmcblk0p1 (the SD card boot partition) gets mounted on /tmp/usb-boot-mnt. If the mount failed, there would be an error message. /tmp/usb-boot-mnt/cmdline.txt should exist (it does here).

Is there anything unusual about your cmdline.txt in the SD card's boot partition?

Reboot and make sure /tmp/usb-boot-mnt does NOT exist before running usb-boot-test again.

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 5:12 pm

There is no /tmp/usb

From sd card cmdline.txt:

#dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=9a9f084e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles"

I copied and pasted in the second line and changed the root= part on the "active" line. Beyond that it is the stock as installed line.

From the USb drive cmdline.txt

"dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=9a9f084e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles"

This was generated by the script when it copied the data (cloned) from the sd card.

.

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 5:20 pm

mount command:

"/dev/mmcblk0p7 on /media/fred/root type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)"

"/dev/mmcblk0p6 on /media/fred/boot type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)"

"/dev/sda2 on / type ext4 (rw,noatime)"

"/dev/sda1 on /media/fred/C799-0C57 type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)"

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 6:45 pm

Brad Q wrote:
Sun Aug 18, 2019 5:12 pm
#dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=9a9f084e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles"

I copied and pasted in the second line and changed the root= part on the "active" line. Beyond that it is the stock as installed line.

You shouldn't have needed to copy and paste in the second line and change the root= part on the "active" line. usb-boot should have simply changed the existing line to 'root=PARTUUID=9a9f084e-02'. It's the issue with sed not finding cmdline.txt that's the problem.
Brad Q wrote:
Sun Aug 18, 2019 5:12 pm
From the USb drive cmdline.txt

"dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=9a9f084e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles"

This was generated by the script when it copied the data (cloned) from the sd card.

This is correct, but the BOOT partition and its cmdline.txt on the USB drive is not used when booting via the SD card, so it's not relevant.
Brad Q wrote:
Sun Aug 18, 2019 5:20 pm
mount command:

"/dev/mmcblk0p7 on /media/fred/root type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)"

"/dev/mmcblk0p6 on /media/fred/boot type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)"

"/dev/sda2 on / type ext4 (rw,noatime)"

"/dev/sda1 on /media/fred/C799-0C57 type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)"

You're running on the USB drive: /dev/sda2 on / type ext4 (rw,noatime)

My mount list looks like this:

/dev/sda2 on / type ext4 (rw,noatime)

/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

/dev/sda1 on /media/pi/3DB9-0CBC type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

/dev/mmcblk0p2 on /media/pi/rootfs type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)

I don't understand why your SD card is coming up as /dev/mmcblk0p6 and /dev/mmcblk0p7 instead of /dev/mmcblk0p1 and /dev/mmcblk0p2. That's the real issue and apparently why sed in usb-boot is failing to find cmdline.txt that it needs to change. usb-boot mounts /dev/mmcblk0p1 and expects to find cmdline.txt there. The mount apparently doesn't fail, but there's no cmdline.txt there.

Do you have any idea why your SD card is not /dev/mmcblk0p1 and /dev/mmcblk0p2? Was a Raspbian image written to the SD card with Etcher and no changes to the partitioning made afterwards? You're not running NOOBS, are you? usb-boot doesn't support NOOBS, as pointed out in the first post:

NOTE: Do NOT use usb-boot on NOOBS

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 6:49 pm

I said from the start that I probably missed something simple. Yep, I used NOOBs.

That being said, it does work (with my one edit).

Thanks

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 6:55 pm

Brad Q wrote:
Sun Aug 18, 2019 6:49 pm
I said from the start that I probably missed something simple. Yep, I used NOOBs.

That being said, it does work (with my one edit).

Thanks

A happy ending after all. :D

Have fun!

RonR
Posts: 629
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 8:58 pm

Brad Q wrote:
Sun Aug 18, 2019 6:49 pm
That being said, it does work (with my one edit).

Brad,

I think you have another problem lurking. I suspect /dev/mmcblk0p1 is mounted on /boot in /etc/fstab of your USB drive at the moment.

In your case (NOOBS), /dev/mmcblk0p6 should be mounted on /boot in /etc/fstab of your USB drive. If it's not, you're going to have problems with updates.

Ron

Brad Q
Posts: 40
Joined: Mon Aug 12, 2019 12:10 am

Re: Running Raspbian on USB Devices : Made Easy

Sun Aug 18, 2019 9:03 pm

As predicted:

"/dev/mmcblk0p1 /boot "

So all I need to do is edit the fstab from 1 to 6?

Return to “Advanced users”