hommar
Posts: 172
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: Can't USB boot (with SD card) anymore!

Sun Jun 04, 2017 9:01 pm

vinntec wrote:Not sure I understand where these PARTUUIDs come from otherwise no problem.
You can use

Code: Select all

fdisk -l /dev/sda
for look ID that DougieLawson say

vinntec
Posts: 145
Joined: Thu Aug 02, 2012 9:37 am
Location: Basingstoke, UK

Re: Can't USB boot (with SD card) anymore!

Fri Jul 14, 2017 12:51 pm

I have got 3 x RPi3 working without SD card. I have one slot left in my switch, so I wanted to put an RPi2 in there with the two USB hard disks left over (which are relatively slow to start). First I booted from normal SD card and checked the PARTUUIDs:

Code: Select all

pi@raspberrypi:~ $ sudo blkid
/dev/mmcblk0p1: LABEL="boot" UUID="3AFB-2896" TYPE="vfat" PARTUUID="cc09f592-01"
/dev/mmcblk0p2: UUID="62ca0b6d-6291-4c40-b1fd-11bc291e4a38" TYPE="ext4" PARTUUID="cc09f592-02"
/dev/mmcblk0: PTUUID="cc09f592" PTTYPE="dos"
/dev/sda1: LABEL="Elements" UUID="ACE47F77E47F431E" TYPE="ntfs" PARTUUID="0002ffbd-01"
/dev/sdb1: LABEL="boot" UUID="3AFB-2896" TYPE="vfat" PARTUUID="10e97edd-01"
/dev/sdb2: UUID="62ca0b6d-6291-4c40-b1fd-11bc291e4a38" TYPE="ext4" PARTUUID="10e97edd-02"
pi@raspberrypi:~ $
The one I want to boot from is the second one /dev/sdb so PARTUUID of the partition I need is 10e97edd-02. So far so good. So I changed /boot/cmdline.txt:

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=10e97edd-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh splash plymouth.ignore-serial-consoles
Then also updated /etc/fstab:

Code: Select all

proc                   /proc           proc    defaults          0       0
PARTUUID=10e97edd-01   /boot           vfat    defaults          0       2
PARTUUID=10e97edd-02   /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
Reboot - hangs "Unable to mount fs on unknown block" in kernel panic.
Switch off RPi and turn off second disk (own power supply). Reboot works fine. Then I switch on the second disk, still fine (it is now sdb).

Code: Select all

pi@RPi3-4:~ $ sudo blkid
/dev/mmcblk0p1: LABEL="boot" UUID="3AFB-2896" TYPE="vfat" PARTUUID="dc9c46fc-01"
/dev/sda1: LABEL="boot" UUID="3AFB-2896" TYPE="vfat" PARTUUID="10e97edd-01"
/dev/sda2: UUID="62ca0b6d-6291-4c40-b1fd-11bc291e4a38" TYPE="ext4" PARTUUID="10e97edd-02"
/dev/mmcblk0: PTUUID="dc9c46fc" PTTYPE="dos"
/dev/sdb1: LABEL="Elements" UUID="ACE47F77E47F431E" TYPE="ntfs" PARTUUID="0002ffbd-01"
pi@RPi3-4:~ $
Can anyone see what is wrong? I have tried putting a rootdelay into cmdline.txt and formatted the second disk to FAT32 rather than ntfs in case that was causing a problem (I was going to do this anyway), but neither makes any difference. As this will be up all the time, I could live with booting with the second disk off, but I would rather get to the bottom of things if possible.

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Can't USB boot (with SD card) anymore!

Fri Jul 14, 2017 1:15 pm

can you try with the UUID instead
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

vinntec
Posts: 145
Joined: Thu Aug 02, 2012 9:37 am
Location: Basingstoke, UK

Re: Can't USB boot (with SD card) anymore!

Fri Jul 14, 2017 1:45 pm

RaTTuS wrote:can you try with the UUID instead
Exactly the same symptoms - hang with both drives powered up when booting. I tried mounting the second disk using its UUID in fstab, but that made no difference either.
Correction - now it won't boot at all!

pixxx
Posts: 25
Joined: Sun Oct 08, 2017 4:12 pm

Re: Can't USB boot (with SD card) anymore!

Sun Oct 08, 2017 5:04 pm

I am in the same situation like Mo3tasm, however I am using Raspbian version 2017-09-07 and I insisted on using USB with SD because I don't want to modify the irreversible OTP.

In the cmdline.txt on the SD card I have:
root=/dev/sda1 ---> no longer working as it used to.
root=PARTUUID=be705999-02 ---> not working

What I did was:
1) Formatted the USB stick with SD Card Formatter (overwrite option)
2) Copied the new Raspbian image to the USB stick with Etcher.
3) Formatted the SD card with SD Card Formatter.
4) Copied all of the files from the USB boot to SD card.
5) Edit SD card's cmdline.txt as mentioned above.
6) Insert both USB and SD card into the Pi3 and boot it up.
7) The Rpi3 stucks in the loop of rebooting (can never get passed the rainbow screen)

How do I make the newest image boot from the micro SD card but run from the USB at the same time? Thanks in advance for any help.

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

Re: Can't USB boot (with SD card) anymore!

Sun Oct 08, 2017 11:04 pm

pixxx wrote:
Sun Oct 08, 2017 5:04 pm
How do I make the newest image boot from the micro SD card but run from the USB at the same time?
There's no need (and it's a waste of time) to format SD cards and USB drives before using Etcher to write Raspbian images to them.

Try this:

1. Using Etcher, write the 2017-09-07 Raspbian image to an SD card AND a USB drive.
2. Insert the SD card in the RPi and boot it.
3. Download set-boot.zip (download/file.php?id=19909), extract set-boot, and run it:

Code: Select all

chmod +x set-boot
./set-boot /dev/mmcblk0 /dev/mmcblk0
4. Reboot to ensure the SD card still boots.
5. Plug in the USB drive.
6. Run blkid and note the PARTUUID value for /dev/sda2.
7. Edit /boot/cmdline.txt, setting root=PARTUUID=xxxxxxxx-02 to the PARTUUID of /dev/sda2.
8. Reboot.

You should be running from the USB drive at this point.

Note: raspi-config cannot resize USB drives. Download fix-rc.zip (download/file.php?id=19959) which contains two ways around this problem:

1. raspi-config-usb will make a temporary copy of raspi-config, patch the temporary copy to work with USB drives, run it, and then delete the temporary copy.

2. patch-rc will patch a copy of raspi-config to work with USB drives AND SD cards.

pixxx
Posts: 25
Joined: Sun Oct 08, 2017 4:12 pm

Re: Can't USB boot (with SD card) anymore!

Mon Oct 09, 2017 3:17 am

First off, many thank to RonR for helping me with the answer. I really appreciate your time and effort.

There is one thing I forgot to mention in the last post. I have been using Pi3 with Raspbian for the past 2 years with no problem. I usually put the new image on a 16GB Samsung Evo SD card. I am using a headless setup in which I VNC into my pi3. Every now and then, VNC stops responding altogether. It does not matter how many times I tried to reconnect it just not answered so I had to pull the plug to reboot the pi. Recently it started to act up whenever I tried to run apt-get update and upgrade. Usually the sudo apt-get update part is fine but apt-get -y upgrade is not. Here is the screen cap:
Image
I tried to follow the instruction but in the end this is how I always ended up:
Image
My Pi3 is litterally freezed and could not get any update done. This is a fresh installation and it leads me to believe that might be something is wrong with my SD card. I don't have any other Linux machine near by to run fsck nor understanding well the available tools to get to the bottom of this very annoying phenomenon.

For now, I only have one 2GB SD card (which is not big enough to pursue your instruction) and a 16GB USB stick. That is the reason why I prefer the old method of root=/dev/sda1 which I tried successfully. I will try to get another 16GB or bigger Samsung SD card to try your method but for now I am stuck in a suburban location in Vietnam so getting one right a way is a little bit inconvenient.

My pi3 is still running fine with the 16GB Samsung SD card, just could not run any upgrade nor install anything.

With your method, would I need the SD card in the Pi all the times for it to work? or the USB only would do the trick after I run the patch?

P.S. I am trying to post the screen cap image directly here but it does not work so I have to link it from a image host. If you can not see the pix please let me know. I could be reached at achau2838@gmail.com. Thanks again for your help.

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

Re: Can't USB boot (with SD card) anymore!

Mon Oct 09, 2017 6:25 am

I'm not familiar with VNC, so I can't be of any help in that area. I would suggest trying to get a simple system running from a USB drive first using just an SSH client (like PuTTY) and go from there.

Pulling the plug on a running RPi runs a big risk of corrupting the filesystem sooner or later. Once you get things running properly, I highly recommend installing a normally-open pushbutton switch between GPIO header pins 5 and 6 and adding the following to /boot/config.txt:

dtoverlay=gpio-shutdown

This will allow an orderly shutdown of the RPi if you cannot communicate with it from a terminal. Pressing the button on a running system will issue a 'shutdown -h now' command. Pressing the button on a halted system will restart it.

Since you are running headless, make sure you add an empty file named ssh in the boot partition of both the SD card and the USB drive to enable SSH access.

A Raspbian image consists of two partitions. The partition ending in 1 is the boot partition (/dev/mmcblk0p1 or /dev/sda1) while the partition ending in 2 is the root filesystem (/dev/mmcblk0p2 or /dev/sda2). As such, the root= entry in /boot/cmdline.txt on the SD card must point to the root partition (/dev/sda2 not /dev/sda1).

You might be able to use the instructions I previously posted with a 2 GB SD card if you use Raspbian Lite on the SD card (it will be tight, so don't install anything extra). The SD card is used only for booting and could be removed once running from the USB drive. The SD card would have to be present in order to boot again.

pixxx
Posts: 25
Joined: Sun Oct 08, 2017 4:12 pm

Re: Can't USB boot (with SD card) anymore!

Mon Oct 09, 2017 4:32 pm

Thank you very much for your help. After posting the previous reply I decided to take a dive into your instruction with the corrupted 16GB SD card. Here is what happened:

1) Keep the formatted USB with Raspbian Stretch image in the Pi.
2) Use Etcher to write a fresh Raspbian Stretch image onto the corrupted 16GB SD card (no more full format this time, hehe! and yes it took me almost an hour long last time).
3) Follow step 1 to 8 of your instruction. Upon reboot with the new USB, I noticed the time was a little bit longer than the SD card which made it appeared like it booted from the USB.
4) Shut down the pi and copy the /boot of the 16GB SD card onto the 2GB SD card.
5) The pi accepted the 2GB SD card and booted up to my surprise with no hiccup. I was also able to perform full update, upgrade, and installation of Samba. Rebooted a few more times to confirm and yes I concluded your instruction worked very well. BTW, for the corrupted 16GB SD card, is it possible to physically fix it or it is done?

I have not tried the patch-rc (not fully understood the method yet) but will definitely try later because I plan to run the pi on USB SSD not just with the USB stick.

Do you mind helping me elaborate on this:
"Pulling the plug on a running RPi runs a big risk of corrupting the filesystem sooner or later. Once you get things running properly, I highly recommend installing a normally-open pushbutton switch between GPIO header pins 5 and 6 and adding the following to /boot/config.txt:
dtoverlay=gpio-shutdown". I have never heard of this interesting thing before but willing to learn.

It is very thoughtful of you about the SSH headless access. Will try and learn along with wpa.

Yes, you are right about /dev/sda2 not sda1. Your explanation is very logical, new lesson learned for me.

It is proven that I don't need the Lite version. Just copy the /boot drive from the 16G onto the 2G would do the trick. I thought it would not work because the system might use device id to track thing down.

BTW, have you tried to re-program the OTP to make the pi boot directly from the USB only method? I read somewhere and people reported incidents where the pi stops booting into the USB after a while.

Once again, thank you very much for your wonderful help and advice. I could not be more happy after months of googling around.

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

Re: Can't USB boot (with SD card) anymore!

Mon Oct 09, 2017 8:39 pm

pixxx wrote:
Mon Oct 09, 2017 4:32 pm
BTW, for the corrupted 16GB SD card, is it possible to physically fix it or it is done?
Now that you're running from the USB drive, you should be able to check and (possibly) repair the corrupted 16 GB SD card. Place the SD card in a USB adapter and plug it into the running RPi. Use blkid to determine its device name (it should be /dev/sdb). Use df to make sure it's not mounted (umount it, if necessary) and then run:

Code: Select all

e2fsck -f /dev/sdb2
pixxx wrote:
Mon Oct 09, 2017 4:32 pm
Do you mind helping me elaborate on this:
"Pulling the plug on a running RPi runs a big risk of corrupting the filesystem sooner or later. Once you get things running properly, I highly recommend installing a normally-open pushbutton switch between GPIO header pins 5 and 6 and adding the following to /boot/config.txt:
dtoverlay=gpio-shutdown". I have never heard of this interesting thing before but willing to learn.
See this for further details:

http://www.stderr.nl/Blog/Hardware/Rasp ... utton.html

This feature has now been implemented in Raspbian images and all that's needed to activate it is adding "dtoverlay=gpio-shutdown" to /boot/config.txt.
pixxx wrote:
Mon Oct 09, 2017 4:32 pm
It is proven that I don't need the Lite version. Just copy the /boot drive from the 16G onto the 2G would do the trick. I thought it would not work because the system might use device id to track thing down.
I prefer to have a fully operational SD card in place. I frequently have reasons to boot it up (by setting root=/dev/mmcblk0p2 in its /boot/cmdline.txt). I also prefer to use PARTUUID references (instead of /dev/sdX) for USB devices. This becomes crucial if you ever plug in more than one USB storage device which can alter the exepected /dev/sdX assignments. If you elect to use PARTUUID references, ensure that the SD card does not have the same PARTUUID as one of your USB drives.
pixxx wrote:
Mon Oct 09, 2017 4:32 pm
BTW, have you tried to re-program the OTP to make the pi boot directly from the USB only method? I read somewhere and people reported incidents where the pi stops booting into the USB after a while.
I've been running reliably from USB devices for more than 3 years now using the SD card method, so I've had no reason to change or risk new problems.

pixxx
Posts: 25
Joined: Sun Oct 08, 2017 4:12 pm

Re: Can't USB boot (with SD card) anymore!

Tue Oct 10, 2017 3:08 pm

RonR wrote:
Mon Oct 09, 2017 8:39 pm
Now that you're running from the USB drive, you should be able to check and (possibly) repair the corrupted 16 GB SD card. Place the SD card in a USB adapter and plug it into the running RPi. Use blkid to determine its device name (it should be /dev/sdb). Use df to make sure it's not mounted (umount it, if necessary) and then run:

Code: Select all

e2fsck -f /dev/sdb2
I have tried blkid command for a few times after inserted the corrupted 16GB SD card into the pi, it did not show anything about the expected sdb. The lsblk commnad, on the other hand, showed the sdb drive correctly. After a few mount/umount it showed up at last and I was able to perform the e2fsck on it. It surely showed a lot of problems and I said y too all the questions to have the problem fixed. After it finished I decided to run e2fsck again to see if the problem is fixed and it seems like the same problem still exists. No idea why.

Thanks for the detail, will work on it later.
RonR wrote:
Mon Oct 09, 2017 8:39 pm
I prefer to have a fully operational SD card in place. I frequently have reasons to boot it up (by setting root=/dev/mmcblk0p2 in its /boot/cmdline.txt). I also prefer to use PARTUUID references (instead of /dev/sdX) for USB devices. This becomes crucial if you ever plug in more than one USB storage device which can alter the exepected /dev/sdX assignments. If you elect to use PARTUUID references, ensure that the SD card does not have the same PARTUUID as one of your USB drives.
From now on, I will always elect to use PARTUUID instead of /dev/sdb2 for accuracy. Thanks for the advice.

lgoptimusv5
Posts: 10
Joined: Mon Nov 17, 2014 4:34 pm

Re: Can't USB boot (with SD card) anymore!

Tue Dec 26, 2017 4:31 pm

Mo3tasm wrote:
Sun Apr 16, 2017 12:31 pm
Hello

I've always used to flash Raspbian images to a USB flash drive and then copy boot partition to an SD card and point root file system in cmdline.txt as follows:
change "root=/dev/mmcblk0p2" to "root=/dev/sda2" so I can boot Raspbian from USB stick,

But, with the 2017-04-10 update, it becomes "root=PARTUUID=ff22455b-02" and changing it to "root=/dev/sda2" won't boot anymore. I'm using Raspberry pi 3 and don't really want to enable native USB boot mode.

I understand some changes were made to allow USB boot without SD card and that's great, but how can I boot now just like I did before?

Thanks.
I also used to just copy boot partition to an SD card and point root file system in cmdline.txt to the USB /dev/sda2 partition.
But recently I ran into an issue with RetroPie 4.3 & 0riginal RaspberryPi v1.
Booted from sd -> Found USB -> Successfully Re-Sized the USB -> Then got Stuck in endless Rebooting.
I was aware there was no need to change 'root=PARTUUID=3d24ca30-02' -> 'root=/dev/sda2' anymore, so I was a perplexed.

My solution was to simply Remove the Re-Size Script from the 'cmdline.txt' AFTER 1st Boot and Re-Size took place on the USB.
I am now running RetroPie 4.3 on 0riginal RaspberryPi v1 'just like I did before,' Booting from USB + Initially loading from sd.

This is the line I removed from the end of the 'cmdline.txt' on RetroPie 4.3:
init=/usr/lib/raspi-config/init_resize.sh

greg2684
Posts: 2
Joined: Tue Apr 10, 2018 6:03 pm

Re: Can't USB boot (with SD card) anymore!

Tue Apr 10, 2018 6:10 pm

Thanks Mo3tasm, just wanted to say that your solution of removing "init=/usr/lib/raspi-config/init_resize.sh" from cmdline.txt worked for me, with no other changes. Then I resized the partition manually using fdisk and resize2fs.

User avatar
HawaiianPi
Posts: 4616
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Can't USB boot (with SD card) anymore!

Fri Apr 13, 2018 7:59 pm

A better option with recent versions of Raspbian is to use a FAT32 formatted SD card with just the bootcode.bin file on it. This should work with anything based on the 2017-04-10 release of Raspbian or newer, and the latest bootcode.bin (click to download).

Image your USB device, then format an SD card with the FAT32 filesystem and copy just bootcode.bin to the card. The bootcode.bin file wil run from the SD card and then boot your USB device. Automatic partition resizing of the USB device works with the bootcode.bin-only method. Note that you should only have 1 USB storage device connected when using this method, since bootcode.bin will only attempt to boot the first USB drive it finds, and there is no way to guarantee that will be your intended boot device with more than 1 USB drive connected.

It's always recommended to use the very latest Raspbian version.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Can't USB boot (with SD card) anymore!

Fri Apr 13, 2018 8:39 pm

Note that you should only have 1 USB storage device connected when using this method, since bootcode.bin will only attempt to boot the first USB drive it finds, and there is no way to guarantee that will be your intended boot device with more than 1 USB drive connected.
Isn't that the primary reason why the "bootcode.bin" method is inferior to the "all the regular contents of /boot on the SD card" method ?

Because in the later method, you can put the actual device name (or UUID) into the cmdline.txt file and not have to worry about what happens when you have more than one USB device connected at boot time.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

User avatar
HawaiianPi
Posts: 4616
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Can't USB boot (with SD card) anymore!

Sun Apr 15, 2018 7:34 am

n67 wrote:
Fri Apr 13, 2018 8:39 pm
Isn't that the primary reason why the "bootcode.bin" method is inferior to the "all the regular contents of /boot on the SD card" method ?

Because in the later method, you can put the actual device name (or UUID) into the cmdline.txt file and not have to worry about what happens when you have more than one USB device connected at boot time.
Yes, but automatic partition resizing does not work if /boot and rootfs are on different devices. Also, you have to edit /etc/fstab to ensure that kernel/firmware updates are properly applied. With only boodcode.bin on the card everything just works without any user intervention.

If you want to run with additional USB drives connected, you could start with bootcode.bin only, and only your boot drive connected, then after the first boot and resize has completed you could copy the rest of /boot to the card, edit /etc/fstab to mount /dev/mmcblk0p1 as /boot and connect whatever you want.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Raspbian”