raty
Posts: 8
Joined: Fri Jul 10, 2015 10:24 am

Rpi3 USB boot from SSD Kernel Discrepancy

Thu Mar 22, 2018 4:37 pm

Hi there,

I've successfully installed Hassbian, which apparently is based on Raspbian Lite, to an external SSD.
Sadly, even though I'm using the original power supply, I can't boot from the SSD without having the MicroSD card inserted.
That alone isn't really a big deal for me, I guess it just requires too much power.

The problem is, that whenever I upgrade my Hassbian install, there appears to be some kind of discrepancy between the image on the microSD card and the upgraded image on the SSD.

Is there anyway to load the kernel from the SSD instead of the microSD?

If none of this makes any sense (hence the beginners forum), why can't I upgrade the image on my SSD without ending up in a kernel panic?

Thank you in advance!

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

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Thu Mar 22, 2018 6:29 pm

raty wrote:
Thu Mar 22, 2018 4:37 pm
The problem is, that whenever I upgrade my Hassbian install, there appears to be some kind of discrepancy between the image on the microSD card and the upgraded image on the SSD.

Is there anyway to load the kernel from the SSD instead of the microSD?

If none of this makes any sense (hence the beginners forum), why can't I upgrade the image on my SSD without ending up in a kernel panic?
When booting via an SD card, the kernel gets loaded from the SD card's boot partition (the boot partition of the USB device is not used). You simply need to ensure that the SD card's boot partition is mounted on /boot when you do an upgrade. It's safe to keep the SD card's boot partition mounted on /boot with the following /boot entry in /etc/fstab:

Code: Select all

/dev/mmcblk0p1  /boot           vfat    defaults          0       2
If you use rpi-update to upgrade your firmware and kernel, the following will upgrade the firmware and kernel on the SD card while running from your SSD:

Code: Select all

  umount /dev/mmcblk0p1
  umount /dev/mmcblk0p2
  mount /dev/mmcblk0p2 /media
  mount /dev/mmcblk0p1 /media/boot
  rm /media/boot/.firmware_revision
  ROOT_PATH=/media BOOT_PATH=/media/boot rpi-update
  rm -r /media/boot.bak
  umount /dev/mmcblk0p1
  umount /dev/mmcblk0p2
  mount /dev/mmcblk0p1 /boot

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

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Fri Mar 23, 2018 12:55 am

raty wrote:
Thu Mar 22, 2018 4:37 pm
Hi there,

I've successfully installed Hassbian, which apparently is based on Raspbian Lite, to an external SSD.
How did you successfully install Hassbian (outline tools and procedures, please)?

Do you have a Pi3B or Pi3B+ ?

If it's a Pi3B, did you set the OTP USB boot bit?
Sadly, even though I'm using the original power supply, I can't boot from the SSD without having the MicroSD card inserted.
That alone isn't really a big deal for me, I guess it just requires too much power.
Unlikely power related.
The problem is, that whenever I upgrade my Hassbian install, there appears to be some kind of discrepancy between the image on the microSD card and the upgraded image on the SSD.
That's normal since you are booting from an SD card.

Even when a Pi3B is correctly configured for USB boot, it will always boot from an SD card first. So when you insert the SD card the SSD is not being used (the system is booting and running from the SD card). It is possible to configure the system to start the boot process from SD then load and run the root OS from USB, but Raspbian is not configured that way by default.
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?

raty
Posts: 8
Joined: Fri Jul 10, 2015 10:24 am

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sat Mar 24, 2018 11:58 pm

@RonR: thank you for your answer!
That's exactly what I didn't understand.
The fstab file that has to be changed is the one that's on the SD card or the one that's on the ssd?


HawaiianPi wrote:
Fri Mar 23, 2018 12:55 am

How did you successfully install Hassbian (outline tools and procedures, please)?

Do you have a Pi3B or Pi3B+ ?

If it's a Pi3B, did you set the OTP USB boot bit?




That's normal since you are booting from an SD card.

Even when a Pi3B is correctly configured for USB boot, it will always boot from an SD card first. So when you insert the SD card the SSD is not being used (the system is booting and running from the SD card). It is possible to configure the system to start the boot process from SD then load and run the root OS from USB, but Raspbian is not configured that way by default.

Thanks for your answer!
I installed hassbian flashing it to the SSD using Etcher.
Then I grew the partition to fill the whole disk using gparted.
Then I edited /etc/fstab to change the partuuids, that have been modified by gparted.
I also removed the part, that said to grow the filesystem from config.txt and put /dev/sda2 as root partition.
After that I plugged the drive into the pi.


I set the otp usb bit a long time ago, so as that sticks it shouldn't be the problem. I have a Pi3B.
The system is definitively running from the SSD.
It just won't boot from it consistently, when the SD card isn't inserted.

Using other power supplies I had much more problems, than with the original one from the pi foundation, which so far has been flawless.

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

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sun Mar 25, 2018 12:26 am

raty wrote:
Sat Mar 24, 2018 11:58 pm
I installed hassbian flashing it to the SSD using Etcher.
Then I grew the partition to fill the whole disk using gparted.
Then I edited /etc/fstab to change the partuuids, that have been modified by gparted.
I also removed the part, that said to grow the filesystem from config.txt and put /dev/sda2 as root partition.
After that I plugged the drive into the pi.
Most of that should be totally unnecessary, unless Hassbian is based on a relatively old version of Raspbian.

Just image the SSD with Hassbian and give it a try without any changes. With recent versions of Raspbian that's all that's needed. The automatic rootfs resizing and reboot works fine without user intervention. So start with a fresh Hassbian image on the SSD and let us know what happens.

Also note that boot problems can be related to the USB drive itself. The bootloader in the Pi SoC is rather primitive and it's not compatible with some devices. Unfortunately the only fix for that is booting from the SD card. One of my USB SATA adapters will boot every time I power on the Pi, but restarts are unreliable and shutdown locks the system before it completes. The same adapter works 100% when I leave /boot on the SD card. Another adapter of mine just won't boot at all, but then I have several that work perfectly. ¯\_(ツ)_/¯
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?

User avatar
KLL
Posts: 1431
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sun Mar 25, 2018 12:47 am

if there is a timing issue??
you not find it
https://www.raspberrypi.org/documentati ... des/msd.md
but see:
https://github.com/raspberrypi/document ... es/host.md
https://www.raspberrypi.org/documentati ... ootflow.md
If the device fails to respond after this maximum timeout ?2s?, it is possible to increase the timeout to five seconds using
program_usb_timeout=1
in config.txt.
but should be relevant for HDD not SSD??

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

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sun Mar 25, 2018 6:49 am

The only change necessary is to modify /etc/fstab on the SSD.

raty
Posts: 8
Joined: Fri Jul 10, 2015 10:24 am

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sun Mar 25, 2018 11:32 am

KLL wrote: if there is a timing issue??
you not find it
https://www.raspberrypi.org/documentati ... des/msd.md
but see:
https://github.com/raspberrypi/document ... es/host.md
https://www.raspberrypi.org/documentati ... ootflow.md
If the device fails to respond after this maximum timeout ?2s?, it is possible to increase the timeout to five seconds using
program_usb_timeout=1
in config.txt.
but should be relevant for HDD not SSD??
Thanks for the suggestion.
I've already tried that before and it didn't really help.

HawaiianPi wrote:
raty wrote:
Sat Mar 24, 2018 11:58 pm
I installed hassbian flashing it to the SSD using Etcher.
Then I grew the partition to fill the whole disk using gparted.
Then I edited /etc/fstab to change the partuuids, that have been modified by gparted.
I also removed the part, that said to grow the filesystem from config.txt and put /dev/sda2 as root partition.
After that I plugged the drive into the pi.
Most of that should be totally unnecessary, unless Hassbian is based on a relatively old version of Raspbian.

Just image the SSD with Hassbian and give it a try without any changes. With recent versions of Raspbian that's all that's needed. The automatic rootfs resizing and reboot works fine without user intervention. So start with a fresh Hassbian image on the SSD and let us know what happens.

Also note that boot problems can be related to the USB drive itself. The bootloader in the Pi SoC is rather primitive and it's not compatible with some devices. Unfortunately the only fix for that is booting from the SD card. One of my USB SATA adapters will boot every time I power on the Pi, but restarts are unreliable and shutdown locks the system before it completes. The same adapter works 100% when I leave /boot on the SD card. Another adapter of mine just won't boot at all, but then I have several that work perfectly. ¯\_(ツ)_/¯
Thanks for your answer.
When I flashed it like that, without changing anything on the partitions, the image failed to expand the filesystem.
See here: viewtopic.php?t=196550

Is this not relevant anymore with newer versions of Raspbian?

I think the problem lies within the USB SATA adapter I'm using, as well.
Therefore I'm actually quite happy, that in conjunction with the microSD card, my system is running perfectly now for months.
I only want to be able to upgrade/update the system, without breaking everything. This already happened three times, because I didn't understand, that I had to change the fstab before.

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

Re: Rpi3 USB boot from SSD Kernel Discrepancy

Sun Mar 25, 2018 7:52 pm

raty wrote:
Sun Mar 25, 2018 11:32 am
Thanks for your answer.
When I flashed it like that, without changing anything on the partitions, the image failed to expand the filesystem.
See here: viewtopic.php?t=196550

Is this not relevant anymore with newer versions of Raspbian?
Auto-resizing the rootfs partition on the first boot works correctly in Raspbain when using pure USB boot or booting with only bootcode.bin on the SD card. It won't work if you have /boot and the rootfs on different drives (/boot on SD card and / on a USB drive).
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 “Beginners”

Who is online

Users browsing this forum: ayeem and 10 guests