gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1423
Joined: Sat Sep 10, 2011 11:43 am

Re: USB boot now working on Pi3

Sun Mar 12, 2017 8:11 am

Thanks for that, it would be very much appreciated if you create a pull request to the documentation in github to make the changes (just go to the page you want to change in the documentation and click the github link at the bottom of the page, then edit the file and submit a pull request)

The 1TB HDD should be exactly the same, you just need to make sure it gets enough power... There are some issues with timeouts etc on some hard drives though... One option is to copy just bootcode.bin (just a single file) onto a blank FAT32 formatted SD card. Then boot from this, it has some of the bugs / timeouts fixed, but will tell you whether it is a known problem or not...

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

User avatar
DougieLawson
Posts: 35798
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: USB boot now working on Pi3

Sun Mar 12, 2017 9:24 am

gsh wrote: The 1TB HDD should be exactly the same, you just need to make sure it gets enough power... There are some issues with timeouts etc on some hard drives though... One option is to copy just bootcode.bin (just a single file) onto a blank FAT32 formatted SD card. Then boot from this, it has some of the bugs / timeouts fixed, but will tell you whether it is a known problem or not...
I find it easier to dd a bootable USB stick or even an SDCard to the first 8GB (depending on the size) of hard drive then use gparted to expand the root fs to use the rest of the available space.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

eaque
Posts: 8
Joined: Mon Feb 20, 2017 11:10 am

Re: USB boot now working on Pi3

Sun Mar 12, 2017 1:52 pm

eaque wrote:Actually I only used the main branch and I had this problem anyway.
It works now!

Let's recap !

First attempt:
I install latest raspbian on SD card.
I boot the pi, follow the instructions on the OP using only the main branch.
And the pi boots on the HDD (no SD card in it).
I update (apt-get update, upgrade and dist-upgrade).
Then I reboot and it won't boot. Sometimes the LED on the HDD flashes and stop and sometimes it remains lit. But there is no yellow led that flashes on the pi.

Attempt 2:
The same but I did all the upgrades on the SD card before following the instructions on the OP.
Now it seems to work!

Did I do something wrong?
Can I update the pi without problem?

Thanks!
Hi guys!

I'm quoting myself because I have a Rpi booting on HDD and I want to try to update it once again.

I did apt-get update and I'v seen that this packages can be updated:
- raspberrypi-bootloader
- raspberrypi-kernel
- raspberrypi-sys-mods
- raspberrypi-ui-mods
- raspi-config

Can I update this packages safely using apt-get upgrade ? I don't want the Rpi not to be able to boot because I changed something important (like the bootloader or the kernel...).

I'm using the main branch of rpi-update if that change anything!

Thanks! :)

DirkS
Posts: 9901
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: USB boot now working on Pi3

Sun Mar 12, 2017 3:09 pm

eaque wrote:I did apt-get update and I'v seen that this packages can be updated:
- raspberrypi-bootloader
- raspberrypi-kernel
- raspberrypi-sys-mods
- raspberrypi-ui-mods
- raspi-config

Can I update this packages safely using apt-get upgrade ? I don't want the Rpi not to be able to boot because I changed something important (like the bootloader or the kernel...).
Yes, kernel / firmware from repository support USB boot, etc.
Did this myself yesterday and everything is still working.

W. H. Heydt
Posts: 10762
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: USB boot now working on Pi3

Mon Mar 13, 2017 4:11 am

DirkS wrote: Yes, kernel / firmware from repository support USB boot, etc.
Did this myself yesterday and everything is still working.
Glad to hear that because in the next day or two, I'm planning to set up USB boot on a CM3L in a WD SATA Adapter. (I'll use the CMIO3 carrier that I now have to set the OTP bit in the CM3L.)

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1423
Joined: Sat Sep 10, 2011 11:43 am

Re: USB boot now working on Pi3

Mon Mar 13, 2017 9:47 am

When using the CMIO board, you will need to take note of the OTG pin on the board.

If you look closely at J6 (one of the two big connectors), near the power input there is a pin marked USB_OTGID. This is pulled to ground through R12.

Since the OTG ID pin is normally pulled low then it will default to host mode (i.e. the CM3 will behave as a normal host when you run Raspbian and talk to a keyboard / mouse!). But when you power up the CM3 with no eMMC, an empty eMMC or you have a USB host plugged into J15, and J4 is in the enable position, this will default to device USB boot because that is the only boot mode that is enabled through the OTP.

As soon as you add the program_usb_boot_mode=1 this will enable the host mode such that both modes are now enabled. Since this is the case the bootcode uses the OTGID pin to decide which of the two boot modes to use.


TLDR?
Remove R12 from the CMIO board and drive OTGID pin to ground to boot in host mode, from MSD or ethernet.
Leave OTGID pin floating to boot using rpiboot

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

CoPop
Posts: 9
Joined: Wed Aug 31, 2016 3:24 pm
Location: Colorado, U.S.

Re: USB boot now working on Pi3

Mon Mar 13, 2017 12:43 pm

Thank you for your replies! But yes, I will see what I can do about getting things changed on github.

W. H. Heydt
Posts: 10762
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: USB boot now working on Pi3

Tue Mar 14, 2017 12:19 am

gsh wrote: TLDR?
Remove R12 from the CMIO board and drive OTGID pin to ground to boot in host mode, from MSD or ethernet.
Leave OTGID pin floating to boot using rpiboot

Gordon
I didn't actually see this until *after* I got things working. (And--YES--it's working!) I only used the CMIO3 board to set the OTP bit. Once that was done and I did a couple of final tweaks to the SSD I've been using with a CM1 on the WD SATA Adapter, I swapped the now MSD-boot-enabled CM3L into the WD board...and it booted. Everything seems to be running fine and I am a Happy Camper.

Is anyone else running any form of CM3 in a WD SATA Adapter, let alone boot directly to the attached drive?

eaque
Posts: 8
Joined: Mon Feb 20, 2017 11:10 am

Re: USB boot now working on Pi3

Tue Mar 14, 2017 7:48 am

DirkS wrote:
eaque wrote:I did apt-get update and I'v seen that this packages can be updated:
- raspberrypi-bootloader
- raspberrypi-kernel
- raspberrypi-sys-mods
- raspberrypi-ui-mods
- raspi-config

Can I update this packages safely using apt-get upgrade ? I don't want the Rpi not to be able to boot because I changed something important (like the bootloader or the kernel...).
Yes, kernel / firmware from repository support USB boot, etc.
Did this myself yesterday and everything is still working.
It worked!
Thanks ;)

And can I try "apt-get dist-upgrade" or is it too soon?
I'm afraid it won't boot like (I'm pretty sure) it happened to me the first time!

timothyfpope
Posts: 4
Joined: Wed Mar 15, 2017 7:22 am

Re: USB boot now working on Pi3

Wed Mar 15, 2017 8:02 am

CoPop wrote:Just wanted to mention I got interested in booting from the usb ports after working on what I'll call a wireless backup system I'm trying to put together (wanted to use the raspberry pi for storage). I've popped two SD cards so far in the process. The theory du jour is I'm using usb mechanical drives for storage and the pi can't handle the power requirements for long. So I have a usb hub ordered to handle my usb hdd.

Anyway, while I'm waiting I wanted to mention I had problems getting a usb thumb drive to work at first using this article: https://www.raspberrypi.org/documentati ... des/msd.md. It looks to me to be a bit out-of-date, so I went through it and modified some of the instructions until I got it to work. I'm thinking the newest? raspbian OS requires some changes. Thought I would do my civic duty and post what I did to get it to work for even newer newbies:

(This works for the following raspbian version)
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

(The sed commands were a couple of big changes)
MODIFIED INSTRUCTIONS
sudo apt-get update
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
vcgencmd otp_dump | grep 17:
17:3020000a
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
(should see: program_usb_boot_mode=1)
reboot (now check to make sure flash is on /dev/sda)
lsblk (check to make sure flash is on /dev/sda, if not pull out
other usb devices)
sudo parted /dev/sda
(parted) mktable msdos
Warning: The existing disk label on /dev/sda will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes
Error: Partition(s) 1 on /dev/sda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use. As a
result, the old partition(s) will remain in use. You should reboot now before
making further changes.
Ignore/Cancel? cancel
(parted) quit
reboot
sudo parted /dev/sda
(parted) mkpart primary fat32 0% 100M
(parted) mkpart primary ext4 100M 100%
(parted) print
(should see something similar below for a 8GB flash drive)
Model: SanDisk Cruzer (scsi)
Disk /dev/sda: 7761MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 99.6MB 98.6MB primary fat32 lba
2 99.6MB 7761MB 7661MB primary ext4 lba
(parted) quit
Information: You may need to update /etc/fstab.
sudo mkfs.vfat -n BOOT -F 32 /dev/sda1
sudo mkfs.ext4 /dev/sda2
sudo mkdir /mnt/target
sudo mount /dev/sda2 /mnt/target/
sudo mkdir /mnt/target/boot
sudo mount /dev/sda1 /mnt/target/boot/
sudo apt-get update; sudo apt-get install rsync
sudo rsync -ax --progress / /boot /mnt/target
cd /mnt/target
sudo mount --bind /dev dev

sudo mount --bind /sys sys
sudo mount --bind /proc proc
sudo chroot /mnt/target
[email protected]:/# rm /etc/ssh/ssh_host*
dpkg-reconfigure openssh-server
exit
reboot
sudo mount /dev/sda2 /mnt/target/
sudo mount /dev/sda1 /mnt/target/boot/

sudo sed -i "s,root=/dev/mmcblk0p7,root=/dev/sda2," /mnt/target/boot/cmdline.txt
sudo sed -i "s,/dev/mmcblk0p6,/dev/sda1," /mnt/target/etc/fstab
sudo sed -i "s,/dev/mmcblk0p7,/dev/sda2," /mnt/target/etc/fstab
cd ~
sudo umount /mnt/target/boot
sudo umount /mnt/target

(after doing the power off below disconnect the power supply from the Raspberry Pi, remove the SD card, and reconnect the power supply. If all has gone well, the Raspberry Pi should begin to boot after a few seconds.)
sudo poweroff
Following your sequence of instructions for getting an RPi3 to boot from a thumb drive without the SD card being present, the boot process stalls after 4 raspberries appear in the top left corner of the screen. This is after the rainbow splash screen has come and gone. Any suggestions for getting it past this to complete the install?

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1423
Joined: Sat Sep 10, 2011 11:43 am

Re: USB boot now working on Pi3

Wed Mar 15, 2017 9:44 am

This is probably because it can't find the filesystem, are you sure about the root filesystem is set correctly in cmdline?

Also remove 'quiet' from the cmdline and you should get a little more information

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

timothyfpope
Posts: 4
Joined: Wed Mar 15, 2017 7:22 am

Re: USB boot now working on Pi3

Thu Mar 16, 2017 11:30 pm

gsh wrote:This is probably because it can't find the filesystem, are you sure about the root filesystem is set correctly in cmdline?

Also remove 'quiet' from the cmdline and you should get a little more information

Gordon
Thanks for the pointer. After burning out one thumb drive and trying again, I discovered that sudo sed was not substituting /dev/sda2, so I did it manually using sudo nano. I did the same for fstab. There was one further glitch where I checked cmdline.txt by opening it on the desktop using Text Editor and discovered it had not after all been updated to sda2. I assumed that the editing had been done to the copy of cmdline.txt on the SD card instead of the one on the thumb drive, so once I had fixed that, my Rpi3 booted properly without the SD card. I now just have to go back and put the 'quiet' back into the line.
All this has shown that you need a fast thumb drive to get USB boot to work at all, not to mention the fact that I went through 3 SD cards before I found one that I could originally boot from when I first got the Pi3. Also, doing a manual edit of cmdline and fstab, once you have figured out which copy to edit, seems a safer way to go because the last digit of mmcblk0p? might vary from setup to setup. Calling a boot up from USB 'experimental' is certainly correct.
Again, thanks for your helpful answer.

CoPop
Posts: 9
Joined: Wed Aug 31, 2016 3:24 pm
Location: Colorado, U.S.

Re: USB boot now working on Pi3

Fri Mar 17, 2017 12:24 am

timothyfpope wrote: Following your sequence of instructions for getting an RPi3 to boot from a thumb drive without the SD card being present, the boot process stalls after 4 raspberries appear in the top left corner of the screen. This is after the rainbow splash screen has come and gone. Any suggestions for getting it past this to complete the install?
Another problem could be 'my bad'. I went over the instructions again and below the "(parted) mktable msdos" command I should have had the following:

Warning: Partition(s) on /dev/sda are being used.
Ignore/Cancel? ignore

I imagine a 'cancel' would cause problems. I went ahead and added it to my original post. I would have been here sooner, but I was checking my instructions again when my 3rd sd card bit the dust. I think I weakened it earlier with my 1TB hdd experimenting - or the raspberry pi is a ploy to sell sd cards. ;) Maybe now I'm ready for github (definite maybe)

timothyfpope
Posts: 4
Joined: Wed Mar 15, 2017 7:22 am

Re: USB boot now working on Pi3

Fri Mar 17, 2017 5:34 am

CoPop wrote:
Another problem could be 'my bad'. I went over the instructions again and below the "(parted) mktable msdos" command I should have had the following:

Warning: Partition(s) on /dev/sda are being used.
Ignore/Cancel? ignore

I imagine a 'cancel' would cause problems. I went ahead and added it to my original post. I would have been here sooner, but I was checking my instructions again when my 3rd sd card bit the dust. I think I weakened it earlier with my 1TB hdd experimenting - or the raspberry pi is a ploy to sell sd cards. ;) Maybe now I'm ready for github (definite maybe)
Thanks for mentioning this, but I don't think I was tempted to press c for cancel. The problem was finding the correct copy of cmdline.txt and fstab to edit, and then making the substitutions. In my setup, it was mmcblk0p1 and 2, not mmcblk0p6 and 7 as in your setup. That's why the substitution didn't work using your exact script.
Thanks, however, for giving me the assurance that USB booting was not after all impossible. That got me going again.
Tim
Canada

timothyfpope
Posts: 4
Joined: Wed Mar 15, 2017 7:22 am

Re: USB boot now working on Pi3

Fri Mar 17, 2017 6:24 pm

gsh wrote:This is probably because it can't find the filesystem, are you sure about the root filesystem is set correctly in cmdline?

Also remove 'quiet' from the cmdline and you should get a little more information

Gordon
Having enabled USB booting I am now concerned that it is no longer possible to back up the thumb drive to my Mac, since the drive is not readable by the Mac. I have no idea why you can back up an SD card with sudo dd but not the thumb drive. Is there any way to do this, short of installing Linux on the Mac?
Thanks.

CoPop
Posts: 9
Joined: Wed Aug 31, 2016 3:24 pm
Location: Colorado, U.S.

Re: USB boot now working on Pi3

Sat Mar 18, 2017 12:49 pm

timothyfpope wrote: The problem was finding the correct copy of cmdline.txt and fstab to edit, and then making the substitutions. In my setup, it was mmcblk0p1 and 2, not mmcblk0p6 and 7 as in your setup. That's why the substitution didn't work using your exact script.
Thanks, however, for giving me the assurance that USB booting was not after all impossible. That got me going again.
Tim
Canada
And thank you for pointing out how much these sd card partitions can vary! Now that I think of it, the original article could be rewritten to account for all this variance we seem to be seeing. Taking a look at the results of an lsblk command before proceeding could be very helpful!

loydb
Posts: 9
Joined: Tue Mar 07, 2017 6:50 am
Location: Chicago,USA

Re: USB boot now working on Pi3

Sat Mar 18, 2017 9:58 pm

HELP!
I have done everything as instructed on usb booting multiple times.
How to boot from a USB Mass Storage Device on a Raspberry Pi 3
https://www.raspberrypi.org/documentati ... des/msd.md

I get the pi3 to boot from usb ok. but I cannot get another MSD to work properly and it is shown mounted.

What is the proper way to get the MSD to operate as it was, when booting from the sd card ?

troubleshooting:

[email protected]:~ $ ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1

[email protected]:~ $ ls /media/pi
ls: cannot open directory /media/pi: Permission denied


[email protected]:~ $ cat /boot/cmdline.txt

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles


[email protected]:~ $ cat /mnt/target/etc/fstab
cat: /mnt/target/etc/fstab: No such file or directory
[email protected]:~ $


When inserting usb msd labeled =TOSHIBA_2

pop-up:/

Removable medium is inserted
type of medium: Removable disk
Please select the action you want to perform:
-Open in file manager >> clicked


then
pop-up:/

error
The specified directory '/media/pi/TOSHIBA_2' is not valid






Thanks.

CoPop
Posts: 9
Joined: Wed Aug 31, 2016 3:24 pm
Location: Colorado, U.S.

Re: USB boot now working on Pi3

Tue Mar 21, 2017 3:27 am

gsh wrote:Thanks for that, it would be very much appreciated if you create a pull request to the documentation in github to make the changes
Gordon
Put in pull request #590

atex
Posts: 5
Joined: Mon Jun 01, 2015 2:39 pm

Re: USB boot now working on Pi3

Thu Mar 23, 2017 2:29 pm

Hi everyone,

My rasp3 is now booting without any problem from a msata disk and works without the sdcard. But there is an issue that I cant turnover and I cant find an explication.
Every about 7minutes the rasp freezes for about 30seconds.
I developed a test software that writes do the disk ever 0,5 seconds.
In several combinations (external disks connected on usb or writing to sdcard ) using the sdcard to boot everything works fine. If I boot from the msata disk I get the problem.
Any idea about this?

Thank you

Sir FICO
Posts: 29
Joined: Sat Nov 07, 2015 11:34 pm

Re: USB boot now working on Pi3

Sun Mar 26, 2017 10:16 pm

As I just got usb wd drive I though I would give booting from usb a go following the instructions on
https://www.raspberrypi.org/documentati ... des/msd.md

A failure it was. However I found this forum thread and read some recent posts by DougieLawson and then tweaked my ftab and and cmdline.txt files accordingly and got it all to work :D The sed stuff in the instructions were all wrong, for me anyway.

I then saw a very recent post my CoPop who shows what the sed commands should be. This being the first I have heard of sed I cannot be sure, but logic of how I tweaked the file indicate that the commands below would have worked perfectly.

sudo sed -i "s,root=/dev/mmcblk0p7,root=/dev/sda2," /mnt/target/boot/cmdline.txt
sudo sed -i "s,/dev/mmcblk0p6,/dev/sda1," /mnt/target/etc/fstab
sudo sed -i "s,/dev/mmcblk0p7,/dev/sda2," /mnt/target/etc/fstab

So I thought I would give this post in case it may help others.

DirkS
Posts: 9901
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: USB boot now working on Pi3

Sun Mar 26, 2017 10:24 pm

Sir FICO wrote:A failure it was.
Well, it was only a failure because your starting point was a Noobs install.
The instructions you link to use the single Jessie (full or lite) image install as a starting point.
Install Raspbian Lite (or Raspbian with PIXEL) on the SD card in the normal way See here.
The link under 'See here' is https://www.raspberrypi.org/documentati ... /README.md

Sir FICO
Posts: 29
Joined: Sat Nov 07, 2015 11:34 pm

Re: USB boot now working on Pi3

Sun Mar 26, 2017 10:36 pm

To DirkS, No this SD created from a full jessie image downloaded last week. But I did create a different SD card first and then used this other SD card to copy (dd) create a 'master' image on my Mac, and then I copied this master image to some old cards that may well have originally been created with NOOBS. However I thought a DD image copy would completely overwrite an old SD card. Perhaps I'm mistaken.

Sir FICO
Posts: 29
Joined: Sat Nov 07, 2015 11:34 pm

Re: USB boot now working on Pi3

Sun Mar 26, 2017 10:46 pm

To DirkS ... Sorry I think you were correct and the SD card did originate from a NOOBs card. :oops: However the instructions make no mention of using different sed instructions for noobs, so let noobs beware :lol: Thanks for your info on this BTW.

baqai
Posts: 7
Joined: Fri Dec 16, 2016 4:16 am

Re: USB boot now working on Pi3

Wed Mar 29, 2017 6:33 am

guys thanks for the guide, i managed to boot my pi with a transcend 16gb usb stick, now here is an interesting problem i am facing, i want to clone this usb to boot around 30 pi's i have with me, i tried the usb on another pi but it didnt boot, i guess i will have to tinker some setting on each pi to enable usb boot on it? can someone guide me with this?

canadian.bacon
Posts: 3
Joined: Thu Mar 30, 2017 2:43 am

Re: USB boot now working on Pi3

Thu Mar 30, 2017 2:57 am

Hi,
I managed to get the PI running ok on USB. Got a WD 1TB drive (7200rpm, 32mb cache, if it matters, sata), with an external power supply. Pretty much all attempts to use a non-powered enclosure failed even at copying the partition data over.
Speeds are 25-30mb/sec, read and write, pretty consistent. The boot sequence take a few more seconds, not a biggie, I dont reboot it often at all.
The only thing I noticed is that now the Pi average load lingers around: load average: 0.29, 0.26, 0.20, whereas before, on the SD card, it was always at 0.00 across the board. The only process that takes about 7-10% CPU at all times is kworker/u8:0.
This has been consistent for a few days now. I also noticed that when testing the transfer rates, the load is lower on the HDD (~1.50), compared to the SD card (~3.50) under the same test.
So why is this happening ? Is this expected? Anybody else has this issue?
I run only Pihole on it so far, it is the DNS server I use for all my devices, not many, 2-3 phones, 2 laptops and a NUC.
4.4.50-v7+ #970 SMP, jessie.

Thanks.

Return to “General discussion”