TogaDuck
Posts: 4
Joined: Sat Mar 18, 2017 3:46 am

booting from usb

Sat Mar 18, 2017 4:12 am

Hi all I'm a frequent visitor to the forums but first time poster. I'm having no luck with getting my pi 3 to boot from usb I've tried two different thumb drives and two different external hard drives plugged into a usb hub with external power supply and have tried plugging directly into the usb ports on the pi itself.

Tried with a current and clean install to no avail. A couple of things I have noticed after powering the pi on without the microsd card inserted the thumb drive plugged into the usb ports on the pi itself will blink for a bit then turn off however the lights on ethernet port will light up right after however I still do not get a blinking green ACT led just the red ACT led. I followed the instructions from the official documentation https://www.raspberrypi.org/documentati ... des/msd.md and verified everything was correct however I just noticed that on this line

Code: Select all

sudo sed -i "s,/dev/mmcblk0p,/dev/sda," /mnt/target/etc/fstab
shouldn't

Code: Select all

/dev/sda
be

Code: Select all

/dev/sda1
or

Code: Select all

/dev/sda2
since we created two different file systems earlier?

loydb
Posts: 4
Joined: Tue Mar 07, 2017 6:50 am

Re: booting from usb

Tue Mar 21, 2017 5:37 am

Try installing on the sdcard

sudo apt-get install gparted

and inspect the partitions on the usb drive.

or try the command and see the tree.
lsblk

pi@raspberrypi:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 29.3G 0 disk
├─sda1 8:1 1 94M 0 part /media/pi/USB_BOOT_00
└─sda2 8:2 1 11.7G 0 part /media/pi/be4f0fc9-4291-4927-8ad7-592e1cca2

mmcblk0 179:0 0 29.8G 0 disk
├─mmcblk0p1 179:1 0 63M 0 part /boot
└─mmcblk0p2 179:2 0 29.8G 0 part /


edit usb drive as needed with gparted



I had a similar problem with a gigabit drive, it kept creating a small 8 MB partition at the beginning

TogaDuck
Posts: 4
Joined: Sat Mar 18, 2017 3:46 am

Re: booting from usb

Tue Mar 21, 2017 6:05 am

All partitions are correct 100MB fat32 partition for booting and a 57.59GB ext4 partition for everything else

loydb
Posts: 4
Joined: Tue Mar 07, 2017 6:50 am

Re: booting from usb

Wed Mar 22, 2017 2:11 am

I just did anotherone with a little different approach.

The same problem with the msd r/w persists.

===============================================================
Procedure Based on these instruction:

https://www.raspberrypi.org/documentati ... des/msd.md

BESIDES USING GPARTED TO CREATE THE PARTITIONS,
THE REST IS MUCH THE SAME
WITH MULTIPLE VERIFICATIONS ALONG THE WAY.

===============================================================
sudo apt-get update
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
vcgencmd otp_dump | grep 17: ;#verify bit changed to
17:3020000a

echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
(should see: program_usb_boot_mode=1)

reboot





PREPARE THE USB STORAGE DEVICE
===============================================================
I did not do this section
===============================================================
sudo parted /dev/sda

-------- GNU Parted 3.2
-------- Using /dev/sda
-------- Welcome to GNU Parted! Type 'help' to view a list of commands.
-------- (parted)

(parted) mktable msdos
(parted) mkpart primary fat32 0% 100M
(parted) mkpart primary ext4 100M 20%

===============================================================
I USED GPARTED TO SEE IN THE GUI WHAT WAS CREATED /REFRESH
===============================================================
+DELETE ALL PARTITIONS-----> APPLY
+CREATE A SINGLE PARTITION/FORMATT /FAT32 STARTING AT 0 , (NOT 1 per default)-> APPLY


USE GPARTED TO CREATE PARTITIONS/PRIMARY AND VERIFY PROGRESS/REFRESH
0-100M fat32 #START AT 0 (this was creating problems!)
0-5000M ext4 # SMALL TO FIT 8GB TO REIMAGE/CLONE


sudo parted /dev/sda # MORE VERIFICATIONS
(parted) print
-------- Model: Corsair Voyager Mini 3.0 (scsi)
-------- Disk /dev/sda: 31.0GB
-------- Sector size (logical/physical): 512B/512B
-------- Partition Table: msdos
-------- Disk Flags:

-------- Number Start End Size Type File system Flags
-------- 1 1049kB 106MB 105MB primary fat32
-------- 2 106MB 735MB 629MB primary ext4

(parted) quit



lsblk # MORE VERIFICATIONS OD
-------- pi@raspberrypi:~ $ lsblk
-------- NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
-------- sda 8:0 1 28.9G 0 disk
-------- ├─sda1 8:1 1 100M 0 part
-------- └─sda2 8:2 1 4.9G 0 part
-------- mmcblk0 179:0 0 29.8G 0 disk
-------- ├─mmcblk0p1 179:1 0 63M 0 part /boot
-------- └─mmcblk0p2 179:2 0 29.8G 0 part /
-------- pi@raspberrypi:~ $


Create the boot and root file systems:

sudo mkfs.vfat -n BOOT -F 32 /dev/sda1
-------- mkfs.fat 3.0.27 (2014-11-12)


sudo mkfs.ext4 /dev/sda2
-------- mke2fs 1.42.12 (29-Aug-2014)
-------- /dev/sda2 contains a ext4 file system
-------- created on Tue Mar 21 14:26:26 2017
-------- Proceed anyway? (y,n) y
-------- Creating filesystem with 1280000 4k blocks and 320000 inodes
-------- Filesystem UUID: 4a6f0A72-3b2A-4f5b-aa46-6f6Af7aafA7A
-------- Superblock backups stored on blocks:
32A68, 98A04, 163A40, 229A76, 294A12, 819A00, 884A36

-------- Allocating group tables: done
-------- Writing inode tables: done
-------- Creating journal (32768 blocks): done
-------- Writing superblocks and filesystem accounting information: done

-------- pi@raspberrypi:~ $


sudo mkdir /mnt/target
-------- #reusing the same sda card =
--------mkdir: cannot create directory ‘/mnt/target’: File exists

sudo mount /dev/sda2 /mnt/target/
sudo mkdir /mnt/target/boot
sudo mount /dev/sda1 /mnt/target/boot/

-------- #make sure online connection

sudo apt-get update; sudo apt-get install rsync

-------- #takes a short time

sudo rsync -ax --progress / /boot /mnt/target

-------- #takes longer

cd /mnt/target
sudo mount --bind /dev dev
sudo mount --bind /sys sys
sudo mount --bind /proc proc
sudo chroot /mnt/target
root@raspberrypi:/# rm /etc/ssh/ssh_host*

dpkg-reconfigure openssh-server

-------- root@raspberrypi:/# dpkg-reconfigure openssh-server
-------- Creating SSH2 RSA key; this may take some time ...
-------- xxxx xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx /etc/ssh/ssh_host_rsa_key.pub (RSA)
-------- Creating SSH2 DSA key; this may take some time ...
-------- yyyy yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy:yy /etc/ssh/ssh_host_dsa_key.pub (DSA)
-------- Creating SSH2 ECDSA key; this may take some time ...
-------- zzz zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz:zz /etc/ssh/ssh_host_ecdsa_key.pub (ECDSA)
-------- Creating SSH2 ED25519 key; this may take some time ...
-------- aaa aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa:aa /etc/ssh/ssh_host_ed25519_key.pub (ED25519)
-------- [ ok ] Restarting OpenBSD Secure Shell server: sshd.

exit

sudo umount dev
sudo umount sys
sudo umount proc

sudo sed -i "s,root=/dev/mmcblk0p2,root=/dev/sda2," /mnt/target/boot/cmdline.txt

sudo sed -i "s,/dev/mmcblk0p,/dev/sda," /mnt/target/etc/fstab

cd ~
sudo umount /mnt/target/boot
# umount: /mnt/target/boot: not mounted
sudo umount /mnt/target

sudo poweroff

===============================================================

https://www.raspberrypi.org/documentati ... des/msd.md

===============================================================
I also created images of the partitions to clone and works fine.

johnwallace123
Posts: 16
Joined: Tue Feb 28, 2017 12:35 am

Re: booting from usb

Thu Mar 23, 2017 5:29 pm

Having been through this recently, hopefully I can help. Check the following:
  • Is the USB boot mode OTP bit set? Check with "vcgencmd otpdump". You'll want to look at line 17.
  • Does it work with the microSD card in with ONLY the bootcode.bin file on the primary FAT partition? I've had some issues with the USB devices not being 100% compatible with the baked-in ROM
TogaDuck wrote:shouldn't /dev/sda be /dev/sda1 or /dev/sda2 since we created two different file systems earlier?
Because you don't specify the partition, the sed command will replace BOTH the /dev/sda1 and /dev/sda2 lines in the /etc/fstab. If you're concerned, you may want to hand-edit the /etc/fstab on the USB stick.

TogaDuck
Posts: 4
Joined: Sat Mar 18, 2017 3:46 am

Re: booting from usb

Thu Mar 23, 2017 8:08 pm

otp bit is set and it does boot with just bootcode.bin on the microsd card

johnwallace123
Posts: 16
Joined: Tue Feb 28, 2017 12:35 am

Re: booting from usb

Thu Mar 23, 2017 8:11 pm

Since it boots with just the bootcode.bin on the microsd card, I'd suggest either setting the USB timeout bit ("program_usb_timeout=1") or trying to use a different USB device.

I have personally not been successful completely removing the SD card either, but I suspect it may have been due to a fault of the USB devices that I was using (super cheap thumb drives).

TogaDuck
Posts: 4
Joined: Sat Mar 18, 2017 3:46 am

Re: booting from usb

Thu Mar 23, 2017 8:37 pm

I've tried with a super cheap thumb drive, a sandisk thumbdrive, an external seagate freeagent go flex hard drive and a toshiba external harddrive with no luck of booting without the microsd card

Return to “Troubleshooting”

Who is online

Users browsing this forum: Lahim, mandala17 and 51 guests