MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.84k stars 496 forks source link

Boot from USB Raspberry pi Menu Option #3752

Closed davidjmorin closed 4 years ago

davidjmorin commented 4 years ago

Would love to see this option in the config menu. I updated today and no joy.

Does dietpi have a step by step on how to do this with current Version?

I have looked all around and only found ones for raspberry os.

Joulinar commented 4 years ago

Hi,

many thanks for your question. There isn't such an option available via DietPi options. There are different ways described by Raspberry Foundation depending on your devices.

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md

MichaIng commented 4 years ago

The easiest way is to flash the image to the USB drive directly, on RPi3+ and RPi4 this works OOTB. All ways to move the boot partition afterwards are not that save, best is dd cloning the SD card from an external system.

On RPi3 non-plus as described on the RPi docs, this OTP bit needs to be set to allow USB boot. This can be done via dietpi-config as well, but since it's an RPi3-nonplus-only option, it's also only shown there πŸ˜‰. All models prior to RPi3 do not support USB boot, hence moving the root partition only (not the boot partition) is the best you can do, e.g. via dietpi-drive_manager.

davidjmorin commented 4 years ago

Has dietpi been updated so that stable will update when running the update?

Ive tried following https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md#usbmassstorageboot but it never updates.

root@DietPi:~# sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader /stable/pieeprom-2020-06-15.bin /usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found


root@DietPi:/usr/bin# sudo apt update
Hit:1 https://downloads.plex.tv/repo/deb public InRelease
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:3 https://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
Get:4 https://archive.raspberrypi.org/debian buster/main armhf Packages [331 kB]
Fetched 378 kB in 2s (163 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@DietPi:/usr/bin# sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  rpi-eeprom rpi-eeprom-images
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 359 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://archive.raspberrypi.org/debian buster/main armhf rpi-eeprom all 7.12-1 [353 kB]
Get:2 https://archive.raspberrypi.org/debian buster/main armhf rpi-eeprom-images all 7.12-1 [6372 B]
Fetched 359 kB in 1s (316 kB/s)
(Reading database ... 55885 files and directories currently installed.)
Preparing to unpack .../rpi-eeprom_7.12-1_all.deb ...
Unpacking rpi-eeprom (7.12-1) over (7.11-1) ...
Preparing to unpack .../rpi-eeprom-images_7.12-1_all.deb ...
Unpacking rpi-eeprom-images (7.12-1) over (7.11-1) ...
Setting up rpi-eeprom (7.12-1) ...
Job for rpi-eeprom-update.service failed because the control process exited with error code.
See "systemctl status rpi-eeprom-update.service" and "journalctl -xe" for details.
Setting up rpi-eeprom-images (7.12-1) ...
root@DietPi:/usr/bin#

On Wed, Sep 2, 2020, 6:08 AM Joulinar <notifications@github.com> wrote:

> Hi,
>
> many thanks for your question. There isn't such an option available via
> DietPi options. There are different ways described by Raspberry Foundation
> depending on your devices.
>
>
> https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md
>
> β€”
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/MichaIng/DietPi/issues/3752#issuecomment-685548545>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACHXEP43CTIP5UWMLZV4AITSDYKRTANCNFSM4QSR7H6A>
> .
>
davidjmorin commented 4 years ago
-- A start job for unit rpi-eeprom-update.service has begun execution.
--
-- The job identifier is 749.
Sep 02 18:02:37 DietPi rpi-eeprom-update[6234]: /usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found
Sep 02 18:02:37 DietPi systemd[1]: rpi-eeprom-update.service: Main process exited, code=exited, status=127/n/a
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit rpi-eeprom-update.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 127.
Sep 02 18:02:37 DietPi systemd[1]: rpi-eeprom-update.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit rpi-eeprom-update.service has entered the 'failed' state with result 'exit-code'.
Sep 02 18:02:37 DietPi systemd[1]: Failed to start Check for Raspberry Pi EEPROM updates.
-- Subject: A start job for unit rpi-eeprom-update.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit rpi-eeprom-update.service has finished with a failure.
--
-- The job identifier is 749 and the job result is failed.
davidjmorin commented 4 years ago
[  OK  ] APT update
root@DietPi:/mnt/mydrive# G_AGI rpi-eeprom rpi-eeprom-images flashrom libraspberrypi-bin raspberrypi-bootloader
[ INFO ] APT install for: rpi-eeprom rpi-eeprom-images flashrom libraspberrypi-bin raspberrypi-bootloader, please wait...
[  OK  ] APT install for: rpi-eeprom rpi-eeprom-images flashrom libraspberrypi-bin raspberrypi-bootloader
root@DietPi:/mnt/mydrive# G_AG_CHECK_INSTALL_PREREQ binutils
[ INFO ] Checking for required APT packages: binutils
[  OK  ] All required APT packages are already installed.
root@DietPi:/mnt/mydrive# rpi-eeprom-update -a
/usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found
root@DietPi:/mnt/mydrive#
Joulinar commented 4 years ago

@davidjmorin can I ask a question? On what Raspberry Pi model you are? because rpi-eeprom-update is working on RPi4 only.

davidjmorin commented 4 years ago

raspberry pi4 4gb

bbsixzz commented 4 years ago

rpi-eeprom-update is not working on two of my RPi4 4GB after the latest update:

/usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found

Joulinar commented 4 years ago

hmm on my RPi4B 4GB it's working fine

root@DietPi4:~# rpi-eeprom-update
BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad
root@DietPi4:~#

Question: Are you using 32bit or 64bit image?

bbsixzz commented 4 years ago

apt update and apt upgrade produced Unpacking rpi-eeprom (7.12-1) over (7.11-1) ... but same result after reboot.

[EDIT]

32-bit

davidjmorin commented 4 years ago

hmm on my RPi4B 4GB it's working fine

root@DietPi4:~# rpi-eeprom-update
BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad
root@DietPi4:~#

Question: Are you using 32bit or 64bit image?

root@DietPi:~# rpi-eeprom-update /usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found root@DietPi:~# This is 32bit

Joulinar commented 4 years ago

I have installed version 7.10-1 still.

root@DietPi4:~# dpkg -l rpi-eeprom
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==================================
ii  rpi-eeprom     7.10-1       all          Raspberry Pi 4 boot EEPROM updater
root@DietPi4:~#

But it's offered as update.

root@DietPi4:~# apt list --upgradable
Listing... Done
rpi-eeprom-images/testing 7.12-1 all [upgradable from: 7.11-1]
rpi-eeprom/testing 7.12-1 all [upgradable from: 7.10-1]
root@DietPi4:~#

Maybe some bug on latest version of rpi-eeprom

davidjmorin commented 4 years ago

I have installed version 7.10-1 still.

root@DietPi4:~# dpkg -l rpi-eeprom
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==================================
ii  rpi-eeprom     7.10-1       all          Raspberry Pi 4 boot EEPROM updater
root@DietPi4:~#

But it's offered as update.

root@DietPi4:~# apt list --upgradable
Listing... Done
rpi-eeprom-images/testing 7.12-1 all [upgradable from: 7.11-1]
rpi-eeprom/testing 7.12-1 all [upgradable from: 7.10-1]
root@DietPi4:~#

Maybe some bug on latest version of rpi-eeprom

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==================================
ii  rpi-eeprom     7.12-1       all          Raspberry Pi 4 boot EEPROM updater

Odd mine is different

Joulinar commented 4 years ago

Looks like 7.12 is buggy one?

davidjmorin commented 4 years ago

Looks like 7.12 is buggy one?

Very possible. Gonna squash this attempt for now. Hopefully this gets fixed soon.

bbsixzz commented 4 years ago

I should prolly not update the eeprom so often, this is what you get :[

Joulinar commented 4 years ago

Unfortunately something we can't influence from DietPi side. 😒

Joulinar commented 4 years ago

found this issue. But not sure if this exactly same or similar https://github.com/raspberrypi/rpi-eeprom/issues/211

MichaIng commented 4 years ago

Do you guys actually have the hexdump command? which hexdump This commit is the culprit which adds hexdump command but does not add the related package as dependency, does it?: https://github.com/raspberrypi/rpi-eeprom/commit/eea80bc4ab45821319265662c23cf4f33180eda4#diff-86eaef688a7bf372514e072950593ed7

apt install bsdmainutils
Joulinar commented 4 years ago

@MichaIng would it make sense to downgrade eeprom to 7.10 ?

cd /tmp
wget http://archive.raspberrypi.org/debian/pool/main/r/rpi-eeprom/rpi-eeprom_7.10-1_all.deb
dpkg -i ./rpi-eeprom_7.10-1_all.deb

πŸ€”

At least on my test it was working. But you are the expert πŸ˜„

root@DietPi4:~# rpi-eeprom-update
/usr/bin/rpi-eeprom-update: 271: /usr/bin/rpi-eeprom-update: hexdump: not found
root@DietPi4:~# cd /tmp/
root@DietPi4:/tmp# wget http://archive.raspberrypi.org/debian/pool/main/r/rpi-eeprom/rpi-eeprom_7.10-1_all.deb
--2020-09-02 22:17:08--  http://archive.raspberrypi.org/debian/pool/main/r/rpi-eeprom/rpi-eeprom_7.10-1_all.deb
Resolving archive.raspberrypi.org (archive.raspberrypi.org)... 176.126.240.84, 176.126.240.86, 176.126.240.167, ...
Connecting to archive.raspberrypi.org (archive.raspberrypi.org)|176.126.240.84|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 351188 (343K) [application/x-debian-package]
Saving to: β€˜rpi-eeprom_7.10-1_all.deb’

rpi-eeprom_7.10-1_all.deb             100%[=========================================================================>] 342.96K   508KB/s    in 0.7s

2020-09-02 22:17:14 (508 KB/s) - β€˜rpi-eeprom_7.10-1_all.deb’ saved [351188/351188]

root@DietPi4:/tmp# dpkg -i ./rpi-eeprom_7.10-1_all.deb
dpkg: warning: downgrading rpi-eeprom from 7.12-1 to 7.10-1
(Reading database ... 83296 files and directories currently installed.)
Preparing to unpack ./rpi-eeprom_7.10-1_all.deb ...
Unpacking rpi-eeprom (7.10-1) over (7.12-1) ...
Setting up rpi-eeprom (7.10-1) ...
root@DietPi4:/tmp# rpi-eeprom-update
BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad
root@DietPi4:/tmp#
MichaIng commented 4 years ago

Bug reported: https://github.com/raspberrypi/rpi-eeprom/issues/215

Joulinar commented 4 years ago

@MichaIng we are on 32bit not 64bit. As far as I can see you linked following. Does it makes a difference

This is part of the bsdmainutils package: https://packages.debian.org/buster/amd64/bsdmainutils/filelist

MichaIng commented 4 years ago

It's the same for armhf and all other architectures and the same for Raspbian as well, but Raspbian doesn't have such a nice online portal to view package details πŸ˜‰.

From Bullseye on, the command has been moved into the bsdextrautils package, but that is pulled in as dependency by bsdmainutils then, so installing the first solves it on all distros: https://packages.debian.org/bullseye/bsdmainutils


But just to be sure there is not second issue, installing the package solves it, right?

Joulinar commented 4 years ago

as I don't want to play that much on my RPi4 (prod), I was testing it on my RPi3B+. And yes it seems to be fixed by installing bsdmainutils

root@DietPi3:/tmp# dpkg -l rpi-eeprom
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==================================
ii  rpi-eeprom     7.12-1       all          Raspberry Pi 4 boot EEPROM updater
root@DietPi3:/tmp#
root@DietPi3:/tmp# systemctl status rpi-eeprom-update.service
● rpi-eeprom-update.service - Check for Raspberry Pi EEPROM updates
   Loaded: loaded (/lib/systemd/system/rpi-eeprom-update.service; enabled; vendor preset: enabled)
   Active: active (exited) since Wed 2020-09-02 22:36:23 CEST; 2s ago
  Process: 1309 ExecStart=/usr/bin/rpi-eeprom-update -a (code=exited, status=0/SUCCESS)
 Main PID: 1309 (code=exited, status=0/SUCCESS)

Sep 02 22:36:23 DietPi3 systemd[1]: Starting Check for Raspberry Pi EEPROM updates...
Sep 02 22:36:23 DietPi3 systemd[1]: Started Check for Raspberry Pi EEPROM updates.
MichaIng commented 4 years ago

Although on RPi3 there is no EEPROM, this RPi4 only πŸ˜‰.

Joulinar commented 4 years ago

I know πŸ˜‰ but I could have it installed anyway. Just to play around with this.

MichaIng commented 4 years ago

Yes, also I cannot see an explicit exit path for non-RPi4 models, I guess some of the EEPROM firmware version checks will give an empty output to make the script exit gracefully without applying something.

Joulinar commented 4 years ago

correct, it's running but don't do anything on the RPi3B+

MichaIng commented 4 years ago

I just opened a PR to add the dependency: https://github.com/raspberrypi/rpi-eeprom/pull/216

Joulinar commented 4 years ago

ok rpi-eeprom has been fixed on version 7.13-1. Thx @MichaIng for your time on this.

root@DietPi4:~# dpkg -l rpi-eeprom
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==================================
ii  rpi-eeprom     7.13-1       all          Raspberry Pi 4 boot EEPROM updater
root@DietPi4:~#
root@DietPi4:~# rpi-eeprom-update
BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu Apr 16 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad
root@DietPi4:~#
MichaIng commented 4 years ago

Great, thanks to the RPi devs for the quick release. Also the final solution was IMO the best possible, moving to a command that is part of essential coreutils so that no additional dependency was required anymore πŸ‘. I mark this as closed.