RPI 3 boot from USB drive?

  • I am new to this forum, so I may have missed this subject being addressed earlier!

    My question is: what is required to have LE boot from a USB drive on the RPI 3?

    Background: booting from USB is possible with Raspbian. Look at How to boot from a USB Mass Storage Device on a Raspberry Pi 3 - Raspberry Pi Documentation for a description.
    I have tested this and it works. What it does is update the firmware ofn the RPI to enable booting from USB and make some changes to have Raspbian finish the boot from USB properly. So now I have a RPI 3 that is prepared to boot from USB and I would like to boot LibreElec from USB as well.

    Questions:

    • can LibreElec be altered (by me, after installation) to do the boot properly (like: copy the start.elf and bootcode.bin files on the LibreElec image and make changes as described in the link to config.txt, cmdline.txt and fstab). Or will this kill LibreElec?
    • is the LibreElec development team planning to support this in a future release (I am now on 7.95.1)


    Any input is welcome!

  • IIRC we should already support this in the latest release.

    You just need to edit the cmdline.txt file with the correct boot and disk devices.

  • Thanks Irusak.
    Will give it a try!

    Hi,
    I'm trying the same just now with 7.95.2
    I updated root=/dev/sda2 in cmdline.txt but I think it's not enough, maybe I've to change /etc/fstab.
    (From Raspbian, /dev/sda2 contains only lost+found, strange, I will try again to create SD using win32diskimager in place of Rufus).

    I think LibreElec should give a LABEL to root partition to refer in cmdline.txt and /etc/fstab


    Also could be nice to boot LibreElec from PXE, maybe it's only more complicated the autoupdate being the firmware files loaded via tftp

    Thank you

  • Hi,
    I'm trying the same just now with 7.95.2
    I updated root=/dev/sda2 in cmdline.txt but I think it's not enough, maybe I've to change /etc/fstab.
    (From Raspbian, /dev/sda2 contains only lost+found, strange, I will try again to create SD using win32diskimager in place of Rufus).

    I think LibreElec should give a LABEL to root partition to refer in cmdline.txt and /etc/fstab


    Also could be nice to boot LibreElec from PXE, maybe it's only more complicated the autoupdate being the firmware files loaded via tftp

    Thank you

    Just tried it and it works!
    I have loaded 7.95.2 fresh on the USB stick and before starting the rpi changed cmdline.txt from:
    boot=/dev/mmcblk0p1 disk=/dev/mmcblk0p2 quiet
    to:
    boot=/dev/sda1 disk=/dev/sda2 quiet
    That was all.
    Of course I had already made the rpi USB-boot ready with raspbian.

    @Irusak: wondering if it would be helpful to add the other parameters that raspbian has like:
    dwtc_otg.lpm_enable=0 console=serial0,115200 console-tty1 elevator=deadline fsck.repair=yes rootwait

    Any idea?

    I agree with fabio70mi that using a label rather than an address would be nicer. Don't know how that should be phrased in cmdline.txt (or elsewhere).
    As far as fstab is concerned: I cannot find it on the USB stick from my Linix Mint box!

  • fabio70mi: Have you enabled USB boot mode by adding "program_usb_boot_mode=1" to config.txt, and after booting checked that the OTP (one-time programmable) bit is set correctly?

    Documentation is here: How to boot from a USB Mass Storage Device on a Raspberry Pi 3 - Raspberry Pi Documentation
    [hr]


    Hi,
    I'm trying the same just now with 7.95.2
    I updated root=/dev/sda2 in cmdline.txt but I think it's not enough, maybe I've to change /etc/fstab.
    (From Raspbian, /dev/sda2 contains only lost+found, strange, I will try again to create SD using win32diskimager in place of Rufus).

    There is no root= for LibreELEC - it is boot=. There is also no /etc/fstab.

    It sounds like /dev/sda2 should be your Storage partition, or disk=. Presumably /dev/sda1 would then be your System (boot=) partition.


    Also could be nice to boot LibreElec from PXE, maybe it's only more complicated the autoupdate being the firmware files loaded via tftp

    Thank you

    LibreELEC for RPi boots fine over TFTP. Some details of this process are in the PR I added several months ago: init: mount per-client boot/disk if available & configured by MilhouseVH · Pull Request #621 · LibreELEC/LibreELEC.tv · GitHub

    Also refer to the Raspberry Pi documentation (you'll need to adapt the Raspbian-specific instructions to LibreELEC).
    [hr]


    @Irusak: wondering if it would be helpful to add the other parameters that raspbian has like:
    dwtc_otg.lpm_enable=0 console=serial0,115200 console-tty1 elevator=deadline fsck.repair=yes rootwait

    Any idea?

    The LibreELEC kernel will add all required kernel options - look at /proc/cmdline of a booted system to see all the kernel options. LibreELEC is not Raspbian, and should not be treated as such. You're most likely to break something when adding Raspbian kernel options to LibreELEC.


    I agree with fabio70mi that using a label rather than an address would be nicer. Don't know how that should be phrased in cmdline.txt (or elsewhere).
    As far as fstab is concerned: I cannot find it on the USB stick from my Linix Mint box!

    You can use labels and uuids in addition to device ids when referring to partitions, eg disk=LABEL=Storage, or disk=UUID=aaaa-bbbb-cccc-dddd

    Edited once, last by milhouse (February 4, 2017 at 2:24 AM).

  • Now it's working. Thank you !

    I changed only disk=/dev/sda2 and not boot=/dev/sda1
    I read RPi cmdline.txt - eLinux.org and boot= was not documented, so I didn't mind it.

    I mean RPi2/RPi3 images should use LABEL= or UUID= to refer to partitions,
    to be able to copy image to uSD or to USB without changing cmdline.txt
    Maybe the script to resize should be also updated if physical device name is used.

    OT: Why I see only lost+found mounting /dev/sda2 from a linux system before resizing ?

    I will try PXE boot in the future using the reported instructions


  • I mean RPi2/RPi3 images should use LABEL= or UUID= to refer to partitions,
    to be able to copy image to uSD or to USB without changing cmdline.txt
    Maybe the script to resize should be also updated if physical device name is used.

    Absolutely not.

    Imagine you're booting with boot=LABEL=System and you boot while a removable drive with the same label is connected - chances are your system will fall to boot and cause a support headache. Or you boot with disk=LABEL=Storage while another "Storage" removable drive is connected, possibly used instead of your normal "Storage" drive, and potentially even resized by fs-resize.

    The UUID may well be different on your USB partition so won't work any better than device id - you'll still need to edit cmdline.txt

    Anyone switching to USB booting on the RPi can be expected to have the technical ability to edit cmdline.txt.

    fs-resize should resize a USB partition if it contains a file called "/.please_resize_me" and doesn't already contain .config, .cache and .kodi directories. If you wrote an .img directly to your USB disk then (after editing cmdline.txt) LibreELEC should boot and resize your Storage partition.


    OT: Why I see only lost+found mounting /dev/sda2 from a linux system before resizing ?

    What are you expecting to see? If it's a freshly formatted file system then lost+found is all you'll see - the .config, .cache, .kodi etc. directories will be created when LibreELEC boots.

    If you wrote a LibreELEC .img file to your USB drive then you should also have the ".please_resize_me" file in the root of the second partition.

    Edited once, last by milhouse (February 4, 2017 at 2:49 PM).