Raspberry Pi 3 USB Boot?


#1

Hello,

I have modded RetroPie to run/boot from USB alone, utilizing the details of this post:

To enable a Pi3 to boot from USB. I had to use the next version of Raspbian to pull it off, though.

I was curious – from what I can tell, Lakka uses Libre/OpenELEC to boot. Does this OS (or the OS used to build Lakka on top of) support USB boot yet? Is it possible to install Lakka on top of an OpenELEC OS? I’d love to have Lakka booting solely off of a USB stick, if possible on the Pi 3, just to keep it running on a slightly more reliable storage.


#2

Yeah, it does. After you put the image on the usb the same way you would on the sd card, it will start the kernel. Type fdisk -l. That will show you the location of the partitions. Write them down, or just remember them. Mine was /dev/sda or something. Then type poweroff, or just unplug it since the risk isnt as high of damage as it is with sd cards. Then load the card into your pc, (you could do everything from the kernel instead). Open the command text file, its either command.txt, commandline.txt, or something like that. Its right next to config.txt. Change the addresses that say something like mmcblk, to the SDA partition with the root file system. It is probably sda2. That’s it. I just tried lakka the first time today, and I tried it from USB, not SD.


#3

Hey, thank you for the feedback.

So, I tried to do that before and it wouldn’t boot. What version are you using? Also, can you be more specific?

If I put the image onto the USB via writing the image via a tool (similar to USB), how do I then utilize the kernel to see things? Do you need both the USB and SD at the same time? Plug both in (after having written to both) and then type fdisk -l to see both?

I had tried changing the command.txt to boot from SDA1/2 after writing the image to the USB on its own, and that was not successful. Are you sure we can boot it up alone in this manner, without having to adjust anything else? If so, it could be my USB stick, so I know some work and some do not.

Please advise on which version of Lakka and if you could be a little more clear on steps, I’d really appreciate it.


#4

Hey, I just did EXACTLY as you said.

The first time it loaded, it completely missed the SDA1 partition. Rebooted it a second time and it worked like a charm (and resized everything).

Thank you so much!


#5

I didn’t use the tool that your talking about. Here’s what I did:

1.Download the image to your computer.

  1. Unzip the image. I used Ark on the Knoppix distribution of Linux that I have. You can also use gunzip in the terminal emulator. You may already have a program to uncompress this that you like. If you do not, and the only distribution you have is Raspbian on your Pi, then drop the file into a usb like any other file, and look up how to use gunzip, then turn your pi on and use Raspbian so that you can use gunzip to uncompress the image. You need to use the terminal for the rest of this anyway. Also, change your working directory to the directory with the compressed image before you do-- it makes it easier. Just type cd /dev/sdX, or /media/sdX, where X is the letter of the drive. You can know that X letter by opening file explorer. In the address bar, type “/”, without quotation marks, and push either Enter, or Return on your keyboard. Look in the folder labeled " dev". If you see any folders that say sda or sdb, or whatever, look inside them until you find the file. If you find it here, leave this window open the rest of this process.

If you do not see these folders, then go back one directory at root labeled as “/”. Then go to the folder labeled " media", and go through the process I said to do for dev, but here instead. Leave this window open the rest of this process.

Uncompressed the image file.

  1. Now type su, and enter your password.

  2. Now I am going to use the directory /dev/sdX in this example, but if the directory that you have open is /media/sdX, type that instead, where X is corresponds with the letter that you do have

First: either move, or copy that image file to your desktop, then use cd again to change your present working directory into the desktop. I think you just type cd /home/pi/Desktop

Now type this (or the “media” version of this), but do not push enter yet.

dd if=/dev/sdX of=Lakka-Rpi2.arm-2.0.img bs=8M && sync

That is the version of lakka I am using, type the version you have.

Close the file browser that you had the image in after you MAKE SURE that you typed this in right, or you may erase your Raspbian that you are currently using. Come back to the terminal, now press enter.

The process is slow, it did not freeze up. Leave it alone for however long it takes, until you see the that the terminal displays your user name again after the one that you just typed your previous commands from. ([email protected]$ or [email protected]#, something like that. Its what you see ever time before before you enter commands in the terminal).

  1. Shut down the raspberry pi.

Plug the drive into your pc.

Open the the partition labeled “LAKKA”, NOT the one labeled “LAKKA_DISK”, if you use windows, then you should only see the “LAKKA” partition.

Open the file labeled cmdline.text

That’s it. Hope I covered everything.


#6

No problem lol well now there are more instructions for anyone else that needs help.


#7

My bad, good thing it has some error correction built in, because I partially told you wrong before I wrote the tutorial.


#8

Hey,

I’m VERY close to having it working – I had to run e2fsck -y /dev/sda2 on another Pi machine (running from SD) because there was some kind of problem…

However, I have a new problem – my 128GB stick seems to be partitioned wrong? If I wrong “df”, I can see:

Filesystem 1K-blocks Used Available Use% Mounted on

/dev/sda2 27633 26827 151 99% /storage

So, /dev/sda2 is 99% full.

But if I check parted -l:

Model: Samsung Flash Drive FIT (scsi)

Disk /dev/sda: 128GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Disk Flags:

Number Start End Size Type File system Flags

1 1049kB 538MB 537MB primary fat16 boot, lba

2 539MB 128GB 128GB primary ext4

I should have a TON of extra space on it, but I’m at capacity… any thoughts?


#9

Yeah, it didn’t expand. Not sure why. If it works fine, other than the partition size, then either use a Linux is on your pc, or remove the lakka usb from the pi while it is off, insert the Raspbian usb, and turn it on.

Or

Just put a fresh image back on the drive the easy way that you did, but change those two values in cmdline.txt before you boot it the first time this time. Just use that picture that I posted, and then boot it up. It should expand correctly. If not, then follow these directions.

Start gparted if you are on a Linux pc

Or

Click the raspberry on the toolbar if you are using the pi.

Find “synaptic package manager”

Search for “gparted”

Download it.

Insert you lakka usb

Click the raspberry on the toolbar

Find gparted, its either in all, preferences, administration, or accessories. If not any of those, then you may not have all of those So don’t worry if you don’t see all of those. Just look for gparted.

On the right side of the gparted application, in a dropdown tab, is a list of drives that are connected. Click the 120 something GiB one. (GiB is not equivalent to GB, but its close enough)

Next you will see partitions listed. Right click the ones with a key symbol on them, and select “unmount”.

The boot drive is supposed to be small, it is fat32, and I think it is colored green. Thats the first partition, don’t mess with that partition any further for this.

Right click the 2nd partition, it is ext4 partition. Select " resize partition "

A window pops up. Use the mouse cursor and move it right over the line of the box, so that the pointer turns into a multidirectional pointer.

Left click and hold, then stretch the square NEAR the end of the space that it allows you to take it. Leave about a fifth of what you see with no partition. If you stretch it too far then it may corrupt the partition is why.

Click “ok” or whatever, maybe its “next”. Just don’t click cancel

The secondary window will close

Look at the buttons that are under the task bar. Select the green circular symbol with a check mark

A prompt will pop up, click accept, or yes, what ever, just akknowledge that you understand that this process may corrupt the partition.

Wait a short bit (may be kind of a long process on the pi, I’m not sure), just wait until you see that it says complete. Shutdown the pi, remove Raspbian, and turn it on with the lakka usb, unless you now want to add games.


#10

If you have any more trouble, I’ll be back on in about 8 hours if the hurricane doesn’t kill the internet here by then.


#11

Be careful! I’m in Houston, so I feel your pain, to some degree.

So, it’s weird. I’m not sure what’s going on. I think it’s failing on resizing at the very beginning of the script.

When the “PARTITION RESIZING IN PROGRESS” starts, it sits on the “Resizing /storage…” – been there for about 20 minutes now.

Is there a way to diagnose if something is wrong with the USB thumb drive? It worked fine with RetroPie. I’d like to really swap to Lakka – but it seems like it lags out/hangs on resizing /dev/sda2…

No matter what I’ve done to resize it with other tools, etc, it never resizes. It hangs. dmesg doesn’t get any new errors…

Going to try to let it run for a while on the initial resize script… We’ll see what happens, but I don’t see the USB drive flashing to show I/O.


#12

It just takes a VERY LONG TIME.

After I finally pulled the plug after it had run for a while, it resized the partition to 111GB. Not the complete size, but close enough for now.

I’ve noticed, in general, USB is kind of… buggy. Sometimes it works totally fine and things load – and other times things do not load correctly (Wi-Fi almost didn’t load for me).

Thank you for your assistance!


#13

I’ve heard that Samsung usb drives have issues with raspberry pi 3 for this. My Samsung drive seemed a little slow compared to my SanDisk usb drives on it.

I just put Lakka on another USB drive to hold all of my PSOne games, because its usb 3.0 and I didn’t have to wait a long time for the games to transfer to it.

The drive is the 64GB SanDisk USB Ultra Fit. It has had the best performance on the Raspberry Pi compared to my other USB drives. It took MAYBE a second to expand the file system, but maybe less. I dont know why, but when I had RetroPie on it, the N64 games performed best on this compared to my other drives. I havent put N64 games on it with Lakka this time. This drive heats up A LOT. It damages peoples usb drives on their PC’s because of how hot it gets, and it burns fingers to pull out. It has the best performance that I’ve seen for gaming on the pi with it, so I put heat sinks on my Raspberry Pi 3. The temperature warning no longer appears, and it no longer burns my fingers to pull it out. I haven’t damaged my PC’s ports with it, since I only leave it in there for as long as it takes to put files on it. The pictures are to show how to put the heat sinks on it. Heat sinks come with the sticky stuff on them, just peel paper off and stick them on.

The other drive I use for the Pi is the 128GB SanDisk Cruzer Glide. It performs well. It didn’t take long at all for it to expand its filesystem either. N64 games on this drive with RetroPie play well, but not as well as they do on this drive with Lakka, and not as well as they did on the other drive when I had RetroPie on it. I think emulation in Lakka is faster because the RetroPie set up probably uses more resources. This drive takes a lot longer to transfer games to it since this drive is USB 2.0. I have nearly 30 thousand game files. The PlayStation games alone take about 4 hours to transfer to this drive, that’s why I just transferred them on the other drive-- it took a little more than an hour.


#14

Quick add on, with copy/paste information.

I was able to get Lakka-RPi2.arm-2.2.img.gz running under USB with a Raspberry Pi 3b+ by editing cmdline.txt - Lakka 2.2 still has hard coded devices names for both “boot” and “disk”.

Quick change to boot Lakka from USB to cmdline.txt , change boot and disk (like previous explanation above):

boot=/dev/sda1 disk=/dev/sda2 quiet vt.global_cursor_default=0 loglevel=2

Note this then only works on USB, if you copy this image to say SD it will need to be changed again.

I was able to change using the LABEL option (I did not experiment with UUID and PARTUUID):

boot=LABEL=LAKKA disk=LABEL=LAKKA_DISK quiet vt.global_cursor_default=0 loglevel=2

I’ve opened up https://github.com/libretro/Lakka-LibreELEC/issues/611 to see if this can be supported out of the box.