Orange Pi 5 - Boot from NVME

I will ask our developer. @MichaIng to have a look

1 Like

I took down the latest kernel package from from our APT servers.

@helmer
Which kernel version does the system on the SD card have? The previous or the new one?

Can you check whether really none of the two expected SPI devices exist?

ls -l /dev/mtdblock0 /dev/mtd0

And in case the SD card still runs the old kernel, can you upgrade to the new one and check whether the NVMe device /dev/nvme0n1p1 is still accessible?

EDIT: Maybe this one is related, where it seems with the new kernel, the NVMe drive is not detected at all: OPI 5+ 16GB random fails with NVMe - Orange Pi 5 Plus - Armbian Community Forums

Thanks for the quick response!

The new kernel is on the SD card:
“Linux DietPi 6.1.75-vendor-rk35xx #1 SMP Wed Oct 9 05:12:23 UTC 2024 aarch64 GNU/Linux”

I recreated the SD card today.
This means that access to the NVME is possible after mounting /dev/nvme0n1p1.

/dev/mmcblk1p1/boot:
lrwxrwxrwx 1 root root 28 Oct 11 06:46 Image -> vmlinuz-6.1.75-vendor-rk35xx

/dev/nvme0n1p1/media/boot:
lrwxrwxrwx 1 root root 28 Oct 11 05:47 Image -> vmlinuz-6.1.75-vendor-rk35xx

root@DietPi:/# ls -l /dev/mtdblock0 /dev/mtd0
crw------- 1 root root 90, 0 Oct 11 13:53 /dev/mtd0
brw-rw---- 1 root disk 31, 0 Oct 11 13:53 /dev/mtdblock0

Therefore I don’t think that the NVME is not recognized. When starting, the kernel is loaded from the NVME. After that, however, access to the root partition is not possible.

root@DietPi:/# dmesg |grep nvme
[ 13.855308] nvme nvme0: pci function 0004:41:00.0
[ 13.855357] nvme 0004:41:00.0: enabling device (0000 -> 0002)
[ 13.871666] nvme nvme0: missing or invalid SUBNQN field.
[ 13.897784] nvme nvme0: allocated 128 MiB host memory buffer.
[ 13.907261] nvme nvme0: 8/0/0 default/read/poll queues [ 13.911893] nvme0n1: p1 [ 3030.505174] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Quota mode: none.
root@DietPi:/# lsblk 
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS 
sda 8:0 0 1.8T 0 disk 
└─sda1 8:1 0 1.8T 0 part 
mtdblock0 31:0 0 16M 0 disk 
mmcblk1 179:0 0 59.7G 0 disk 
└─mmc blk1p1 179:1 0 59.7G 0 part / 
nvme0n1 259:0 0 476.9G 0 disk 
└─nvme0n1p1 259:1 0 476.9G 0 part /media
root@DietPi:/usr/lib/linux-u-boot-vendor-orangepi5# lspci -k
0004:40:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3588 (rev 01)
Kernel driver in use: pcieport
0004:41:00.0 Non-Volatile memory controller: Kingston Technology Company, Inc. OM3PDP3 NVMe SSD (rev 01)
Subsystem: Kingston Technology Company, Inc. OM3PDP3 NVMe SSD
Kernel driver in use: nvme

About the SPI devices: And in dietpi-config “Update SPI bootloader” does still not show up :thinking:. Can you show this:

cat /usr/lib/u-boot/platform_install.sh

EDIT: Ah, found it already. The script changed a little. Will fix it for upcoming release.

About NVMe boot: The kernel etc are loaded from the NVMe, obviously, but this is done by the bootloader, which comes with its own drivers etc. But the kernel itself, or the init system, then does not find the device anymore. Actually I think it is the kernel.

Can you compare the /boot/dietpiEnv.txt rootdev entry (on the NVMe) with the actual UUID of the NVMe drive?

lsblk -o NAME,UUID /dev/nvme0n1
root@DietPi:~# cat /usr/lib/u-boot/platform_install.sh
DIR=/usr/lib/linux-u-boot-vendor-orangepi5
write_uboot_platform () 
{ 
    local logging_prelude="";
    [[ $(type -t run_host_command_logged) == function ]] && logging_prelude="run_host_command_logged";
    if [[ -f $1/rksd_loader.img ]]; then
        ${logging_prelude} dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none;
    else
        if [[ -f $1/u-boot.itb ]]; then
            ${logging_prelude} dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none;
            ${logging_prelude} dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none;
        else
            if [[ -f $1/uboot.img ]]; then
                ${logging_prelude} dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none;
                ${logging_prelude} dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none;
                ${logging_prelude} dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none;
            else
                echo "Unsupported u-boot processing configuration!";
                exit 1;
            fi;
        fi;
    fi
}
write_uboot_platform_mtd () 
{ 
    if [[ -f $1/rkspi_loader.img ]]; then
        dd if=$1/rkspi_loader.img of=$2 conv=notrunc status=none > /dev/null 2>&1;
    else
        echo "SPI u-boot image not found!";
        exit 1;
    fi
}
setup_write_uboot_platform () 
{ 
    if grep -q "ubootpart" /proc/cmdline; then
        local tmp=$(cat /proc/cmdline);
        tmp="${tmp##*ubootpart=}";
        tmp="${tmp%% *}";
        [[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2> /dev/null);
        [[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null);
        [[ -n $dev ]] && DEVICE="/dev/$dev";
    fi
}
root@DietPi:~# lsblk -o NAME,UUID /dev/nvme0n1
NAME        UUID
nvme0n1     
└─nvme0n1p1 15710500-2fe4-40f8-9579-50060014a118

root@DietPi:~# cat /media/boot/dietpiEnv.txt |grep rootdev
rootdev=UUID=15710500-2fe4-40f8-9579-50060014a118

How can I go back to the old kernel?
The following files are in the /boot directory:

root@DietPi:/media/boot# ls -la
total 61860
drwxr-xr-x  4 root root     4096 Oct 11 05:47 .
drwxr-xr-x 18 root root     4096 Aug 26 02:16 ..
-rw-r--r--  1 root root        0 Oct 11 05:47 .next
lrwxrwxrwx  1 root root       28 Oct 11 05:47 Image -> vmlinuz-6.1.75-vendor-rk35xx
-rw-r--r--  1 root root  7371614 Oct  9 10:37 System.map-6.1.75-vendor-rk35xx
-rw-r--r--  1 root root     2692 Jun 10 19:20 boot.cmd
-rw-r--r--  1 root root     2764 Jun 10 19:24 boot.scr
-rw-r--r--  1 root root   244742 Oct  9 10:37 config-6.1.75-vendor-rk35xx
drwxr-xr-x  4 root root     4096 Aug 26 02:16 dietpi
-rw-r--r--  1 root root    18092 Jun  9 20:54 dietpi-LICENSE.txt
-rw-r--r--  1 root root    16109 Jun  9 20:54 dietpi-README.md
-rw-------  1 root root     3950 Jan  1  2021 dietpi-wifi.txt
-rw-r--r--  1 root root    17869 Jul  4 12:58 dietpi.txt
-rw-r--r--  1 root root      302 Jul  8 06:30 dietpiEnv.txt
lrwxrwxrwx  1 root root       24 Oct 11 05:47 dtb -> dtb-6.1.75-vendor-rk35xx
drwxr-xr-x  3 root root     4096 Oct 11 05:47 dtb-6.1.75-vendor-rk35xx
-rw-r--r--  1 root root  8240416 Oct 11 05:47 initrd.img-6.1.75-vendor-rk35xx
lrwxrwxrwx  1 root root       28 Oct 11 05:47 uInitrd -> uInitrd-6.1.75-vendor-rk35xx
-rw-r--r--  1 root root  8240480 Oct 11 05:47 uInitrd-6.1.75-vendor-rk35xx
-rw-r--r--  1 root root 39152128 Oct  9 10:37 vmlinuz-6.1.75-vendor-rk35xx

First of all, to fix the SPI bootloader update option:

apt install patch
cd /boot
curl -sSf 'https://github.com/MichaIng/DietPi/commit/64af7e9.patch' | patch -p1
dietpi-config

Please test whether this helps, just to rule it out. If not, to downgrade the kernel on the NVMe system mounted to /media on the SD card system:

cd /tmp
apt update
apt download linux-{image,dtb}-vendor-rk35xx
dpkg -i --root=/media linux-*.deb

Sorry for the late reply.

Update SPI bootloader : Flash current U-Boot to /dev/mtdblock0 does not work. The kernel is not loaded - no boot screen.

I tried it twice. The system seems to be dead.

Booting from the SD card, the kernel download does not work:

root@DietPi:/tmp# apt download linux-{image,dtb}-vendor-rk35xx
E: Can't find a source to download version '24.11.0-trunk-dietpi1' of 'linux-dtb-vendor-rk35xx:arm64'
E: Can't find a source to download version '24.11.0-trunk-dietpi1' of 'linux-image-vendor-rk35xx:arm64'

Both needs to be done from the SD card system, of course. Did you run an apt update before apt download ...?

Yes - both after booting from the SD card. Before that, of course, do “apt update”.

root@DietPi:/tmp# cat /etc/apt/sources.list
deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb https://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
and

new try:

root@DietPi:/tmp# cat /etc/apt/sources.list
deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb https://deb. debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware 
deb https://deb.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware

Simply put it into a code block

1 Like

Please just retry. I just needed to refresh the repository anyway, it should work now.

1 Like

Thank you very much for your support!
I did the following:

root@DietPi:~# mount /dev/nvme0n1p1 /media
mount: (hint) your fstab has been modified, but systemd still uses
the old version; use 'systemctl daemon-reload' to reload.

root@DietPi:~# systemctl daemon-reload

 root@DietPi:~# ls /media/
bin boot dev etc home lib lost+found media mnt opt ​​proc root run sbin srv sys tmp usr var 

root@DietPi:~# cd /tmp

root@DietPi:/tmp# ls

root@DietPi:/tmp# apt update
Hit:1 https://deb.debian.org/debian bookworm InRelease
Hit:2 https://deb.debian.org/debian bookworm-updates InRelease
Hit:3 https://dietpi.com/apt bookworm InRelease
Hit:4 https://dietpi.com/apt all InRelease
Hit:5 https://deb.debian.org/debian-security bookworm-security InRelease
Hit:6 https://deb.debian.org/debian bookworm-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

root@DietPi:/tmp# apt download linux-{image,dtb}-vendor-rk35xx
E: Can't find a source to download version '24.11.0-trunk-dietpi1' of 'linux-dtb-vendor-rk35xx:arm64'
E: Can't find a source to download version '24.11.0-trunk-dietpi1' of 'linux-image-vendor-rk35xx:arm64'

Can I download the files manually?

I’m driving all day today, so I won’t be able to look further until tomorrow - maybe this evening.

WTH, can you try this:

curl -sSf https://dietpi.com/apt/dists/all/orangepi5/binary-arm64/Packages | grep Version:

Good morning!
Here is the output of the command:

root@DietPi:/tmp# curl -sSf https://dietpi.com/apt/dists/all/orangepi5/binary-arm64/Packages | grep Version:
Version: 24.5.0-trunk
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk
Version: 24.8.0-trunk-dietpi1
Version: 24.5.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1
Version: 24.8.0-trunk-dietpi1

I tried something else. I found the image of Dietpi on my PC from the beginning of July 2024. I used it to create a new SD card and boot without Ethernet.
Then I ran dietpi-config > “Advanced Options” > “Update SPI bootloader”.
Then the OrangePi 5 boots from the NVME again and then gives up again.
After “apt update” I ran “apt download linux-{image,dtb}-vendor-rk35xx”. Result:

Get:1 https://dietpi.com/apt all/orangepi5 arm64 linux-dtb-vendor-rk35xx arm64 24.8.0-trunk-dietpi1 [2036 kB]
Get:2 https://dietpi.com/apt all/orangepi5 arm64 linux-image-vendor-rk35xx arm64 24.8.0-trunk-dietpi1 [30.6 MB]
Fetched 32.7 MB in 4s (8259 kB/s)

"root@DietPi:/tmp# dpkg -i --root=/media linux-.dtb" then doesn’t work - message:
dpkg: error: cannot access archive 'linux-
.dtb’: No such file or directory

Then I tried: “dpkg -i --root=/media linux-*.deb”.
Result:
“dpkg: unrecoverable fatal error, aborting: unknown system group ‘messagebus’ in statoverride file; the system group got removed before the override, which is most probably a packaging bug, to recover you can remove the override manually with dpkg-statoverride”

Now I’m unsure what to do.

So the package list did not contain the 25.11.0 version anymore. Then I have no idea why APT tried to download it. Maybe cleaning the lists would have helped:

/boot/dietpi/func/dietpi-set_software apt clean

Oh right, .deb file extension of course.

About the error, maybe dpkg with --root given checks statoverrides on the host but users in the defined root. I would consider this a dpkg but. Can you check:

cat /var/lib/dpkg/statoverride
cat /media/var/lib/dpkg/statoverride
grep messagebus /etc/passwd /media/etc/passwd

And this this work?

cd /tmp
export DPKG_ROOT='/media'
dpkg -i --root=/media linux-*.deb
unset DPKG_ROOT

Else, ugly but should work:

cp -a /var/lib/dpkg/statoverride /var/lib/dpkg/statoverride.bak
dpkg-statoverride --remove /usr/lib/dbus-1.0/dbus-daemon-launch-helper
dpkg -i --root=/media linux-*.deb
mv /var/lib/dpkg/statoverride.bak /var/lib/dpkg/statoverride