jens-maus / RaspberryMatic

:house: A feature-rich but lightweight, buildroot-based Linux operating system alternative for your CloudFree CCU3/ELV-Charly 'homematicIP CCU' IoT smarthome central. Running as a pure virtual appliance (ProxmoxVE, Home Assistant, LXC, Docker/OCI, Kubernetes/K8s, etc.) on a dedicated embedded device (RaspberryPi, etc.) or generic x86/ARM hardware.
https://raspberrymatic.de
Apache License 2.0
1.52k stars 186 forks source link

Boot order when 2 USB drives are connected #416

Open StefanGubler opened 5 years ago

StefanGubler commented 5 years ago

Describe the bug Error booting up the Raspberry Pi when having 2 USB disks connected, and / or the boot order changes

To Reproduce Steps to reproduce the behavior:

  1. Flash an SD Card with the newest Raspberrymatic Image
  2. Boot the Raspi
  3. Shutdown the Raspi
  4. Flash an USB SSD with the newest Raspberrymatic Image
  5. Boot the Raspi -- until here is everything ok
  6. Plug a USB Stick to the Raspberry PI to save the diagram data
  7. Restart the Raspberry PI --> The Raspi does not boot and cycles in the boot menu. see attachement

Second test:

  1. Flash a USB Stick with the newest Raspberrymatic Image and connect to the raspberry Pi
  2. Connect an empty, fat32 formatted USB Stick to the Raspi
  3. Start the Rapspi
  4. It boots and starts the HomeMatic, all fine
  5. Reboot the Raspi (out of the WebUI)
  6. --> The Raspi does not boot and cycles in the boot menu. because it tries to boot with the wrong USB stick.

Third test:

  1. Flash an SD-Card Stick with the newest Raspberrymatic Image and connect to the raspberry Pi
  2. Connect an empty, fat32 formatted USB Stick or an USB SSD to the Raspi
  3. Start the Rapspi
  4. It boots and starts the HomeMatic, all fine
  5. Reboot the Raspi (out of the WebUI)
  6. it boots again correctly, because the first bootdevice is always the SD-Card

Expected behavior Even with two USB drives connected, the raspberry pi should check whether is bootable or not

Screenshots ![error on boot with two usb drives](

![error on boot with usb and ssd]

(https://user-images.githubusercontent.com/43369612/45977677-d42a2200-c039-11e8-9de1-05858972398d.jpg)

https://user-images.githubusercontent.com/43369612/45973815-041ff800-c02f-11e8-8e1e-df1f67572a62.jpg)

System information (please complete the following information):

Additional context Tried to find an order by changing the USB-Ports of the two usb drives but that did not help

As in this Raspberrymatic Firmware Version it is required to have a USB drive connected to have the diagram function working, we need to revert back using SD-Card ass bootmedia

Is there anyhow the possibility to control the boot-order ?

or does the raspberry pi boots to the drive who responds first ?

StefanGubler commented 5 years ago

Issue #381 Shows a similar issue

jens-maus commented 5 years ago

After some investigation, this seems to be a U-Boot boot loader issue which requires some more work on the u-boot boot scripts correctly identifying from which USB stick the system should be booted. This, however, requires some more detailed work on U-Boot which we have to reschedule.

StefanGubler commented 5 years ago

Thanks for the update. As alternative I'm using Asus Tinkerboard S with integrated Memory, as per your hint :-) Therefore I don't need this feature anymore. It would be nice if we could plug in an USB-Stick if we want to test out a new version or an alternative System or to boot in a safe mode or to access the local disks to recover files in case the System is not booting anymore.

lobocobra commented 4 years ago

My issue report was closed and linked to this one, but it is not the same.

The topic is still relevant for me. I added a SSD directly to the raspi 3b and have no SD-card inserted any longer. I understood that the diagramm function was possible previously before the last upgrade (there was no check if there is an USB drive). => Ideally there should be a flag to bypass all checkings, so that one can decide if he wants to write digaramms to the mounted drive or not.

Or can you give me a hint, how I manually can enable diagramm?

Many thanks

jens-maus commented 3 years ago

Bin hier gerade am Aufräumen. Ist das Problem hier noch relevant? Vielleicht kann @Baxxy13 hier ja feedback geben ob das mit dem aktuellen nightly snapshot nun für einen Pi3 genauso kein problem mehr ist wie für die Pi4 Reihe oder was genau aktuell nicht geht?

Baxxy13 commented 3 years ago

Ich mache mich mal an die Test's. Nightly - RaspberryMatic-3.55.5.20210103-b7817c

Pi4B: Bootmedium: USB3 Stick, sekundärer USB-Stick angesteckt --> bootet problemlos (sekundärer USB-Stick wird als /media/usb1 eingebunden aber nicht benutzt --> passt)

Test's zu Pi3B & Pi3B+ in Kürze...

Baxxy13 commented 3 years ago

Leider ist es doch wieder mal nicht so einfach. Es gibt Abhängigkeiten vom verwendeten Dateisystem des sekundären USB-Sticks. Pi4B: bootet immer von USB, egal ob der sek. Stick mit FAT/FAT32/NTFS/F2FS formatiert ist Pi3B/Pi3B+: bootet nicht von USB wenn der sek. Stick mit FAT/FAT32/NTFS formatiert ist (mit dem sekundärem F2FS-Stick booten auch die 3er Pi's)

Fazit: Beim Pi3 USB-Boot idealerweise keinen sekundären Stick anstecken, braucht man ja eh nicht.

jens-maus commented 3 years ago

@Baxxy13 Danke für deine Tests. Kannst du das dann bitte entsprechend im Documentation Wiki im Bereich über den es über die USB-Bootmöglichkeit geht ergänzen? Das wäre super.

StefanGubler commented 3 years ago

Vielen Dank Baxxy13 für die Tests. Für mich ist das im Moment nicht mehr interessant. Aber gut zu wissen wie die Abhängigkeiten sind.

Baxxy13 commented 3 years ago

bitte entsprechend im Documentation Wiki im Bereich über den es über die USB-Bootmöglichkeit geht ergänzen?

Dokumentationen sind ja nicht so meine Stärke. Habe den Bereich mit weiteren Informationen gefüllt. Bitte nochmal drüberschauen.