Jump to content

How to Chroot armbian on eMMC


Kalli Lowman

Recommended Posts

Hello i made a mistake when i was selecting an other kernel via armbian-config. I was powering off the board after the kernel change (which normally worked fine when i switched between dev and current) and this time something wrong happened i dont know what exactly but the VMLinuz and uinitram is missing in boot.

 

How can i chroot my Armbian system so re-run armbian-config and install the kernel properly?  I tried several other things,,.. copying the boot folder from a working install of armbian but i dont really know which kernel he wants.

 

The easiest thing might be chrooting... but i dont know how to chroot my emmc. I plugged it into the emmc adapter (microsd) and i now can access the filesystem with my linux notebook. 

Link to comment
Share on other sites

Look in the directory /lib/modules what the name of the directory with modules is there and you can simply copy the necessary files to the media in the /boot partition without any "chroot".

 

Alternatively, mount the image that you installed (or started) your system from. And just copy the /boot partition (its contents) from the image. After that, you can start the system with eMMC and perform the rest of the settings without losing the current ROOTFS file system.

Link to comment
Share on other sites

Hello balbes, no problem when i loose data... after i saw that it doesnt boot my first step was to make an image of the emmc ...  so i have many many tries :D... 

 

I already did the second thing you described, then it booted but became kernel panic. I think that i didnt choose the right kernel... 

 

But i will have a look at the /lib/modules/ now. 

 

When this does not help maybe chroot will help :o 

Link to comment
Share on other sites

I dont know, i tried so many variants and different releases...

 

Scanning mmc 0:1...
Dound /boot/extlinux/extlinux.conf
Retrieving file: /boot/extlinux/extlinux.conf
37 bytes read in 76 ms (0 Bytes/s)
select kernel
Enter choice: RCRIPT FAILED: continuing...
Found U-Boot script /boot/boot.scr
0949 bytes read in 103 ms (27.3 KiB/s)
## Executing script at 00500000
@oot script loaded from mmc 0
151 bytes read in 85 ms (1000 Bytes/s)
(* File not found /boot/uInitrd **
** File not found /boot/Image **
** File not found /boot/dtb/rockchip/rk3399-rock-pi-4.dtb **
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
** File not found /boot/dtb/rockchip/overlay/rockchip-fixup.scr **
@ad Linux ARM64 Image magic!
SCRIPT FAILED: continuing...

As all the place needed files are really located at /boot i cannot understand this message. 

Edited by Kalli Lowman
Link to comment
Share on other sites

I now replaced the simlinks and copied the files again and now i get this

 

Rcanning mmc 0:1...
ound U-Boot script /boot/boot.scr
0940 bytes read in 97 ms (29.3 KiB/s)
## Executing script at 00500000
Boot script loaded from mmc 0
002 bytes read in 80 ms (1000 Bytes/s)
6286443 bytes read in 499 ms (13.9 MiB/s)
20787712 bytes read in 1060 ms (18.7 MiB/s)
62736 bytes read in 343 ms (207 KiB/s)
2698 bytes read in 206 ms (12.7 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
## Executing script at 39000000
## Loading init Ramdisk from Legacy Image at 04000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    7286379 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Ramdisk to f5811000, end f5f03e6b ... OK
   reserving fdt memory region: addr=1f00000 size=78000
   Loading Device Tree to 00000000f5796000, end 00000000f5810fff ... OK

Starting kernel ...

But then nothing happens, thats the last thing i can see in the debug console, also HDMI does not put out anything and the OS does not boot. 

Link to comment
Share on other sites

32 minutes ago, Kalli Lowman said:

But then nothing happens, thats the last thing i can see in the debug console, also HDMI does not put out anything and the OS does not boot. 

The core starts. You need to wait about 10 minutes. This kernel is slowly unpacking Initrd.

Link to comment
Share on other sites

Hello, yes im using a rock pi 4b with emmc. 

 

I used my emmc usb adapter to access the filesystem from another linux system. 

 

As you mentioned above i have taken a look into /lib/modules and i saw  5.4.28-rockchip64

 

-> So i downloaded Armbian_20.02.7_Rockpi-4b_buster_current_5.4.28.7z unpacked it and mounted the img so that i can access the files.

-> Then i copied the files from the image (lib/modules* and /boot) to my emmc card. 

 

I also checked that the rootdev uuid in armbianENV.txt is the right one.

 

If you need further information please specify, then i can put more information into this thread. Im thankful that you take your time to help me.

 

 

 

-> what happened before

When i remember right... i changed from 20.02.11 to 20.02.8 (thats what i can see in apt cache) i downloaded "linux-image-current-rockchip64_20.02.11_arm64.deb" yesterday . And then i ran the firmware upgrade via armbian-config and then i powered the device off... maybe too early when it wasnt finished at all.

Edited by Kalli Lowman
Link to comment
Share on other sites

Hello, this is the content of the emmc (after i already copied the files from the image downloaded and extracted:

 

total 39020
drwxr-xr-x  6 root root     4096 Apr 29 17:45 .
drwxr-xr-x 24 root root     4096 Apr 29 16:01 ..
-rw-------  1 root root      102 Apr 29 17:45 armbianEnv.txt
-rw-r--r--  1 root root        0 Jun 24  2019 armbianEnv.txt.out
-rw-r--r--  1 root root      195 Apr 17 18:46 armbianEnv.txt.save
-rw-r--r--  1 root root      229 Apr 18 16:26 armbianEnv.txt.save.1
-rw-------  1 root root     1536 Mar 28 13:26 armbian_first_run.txt.template
-rw-------  1 root root    38518 Mar 28 13:26 boot.bmp
-rw-r--r--  1 root root     2877 Jun  6  2019 boot.cmd
-rw-------  1 root root     4882 Mar 28 13:26 boot-desktop.png
-rw-------  1 root root     2940 Mar 28 13:32 boot.scr
-rw-------  1 root root   189434 Mar 28 12:07 config-5.4.28-rockchip64
lrwxrwxrwx  1 root root       22 Apr 29 16:23 dtb -> dtb-5.4.32-rockchip64/
drwxr-xr-x  3 root root     4096 Mar 28 13:24 dtb-5.4.28-rockchip64
drwxr-xr-x  3 root root     4096 Apr 28 15:27 dtb-5.4.32-rockchip64
drwxr-xr-x  2 root root     4096 Apr 28 15:26 dtbs
-rwxr-xr-x  1 root root     1807 Oct 21  2019 hw_intfc.conf
lrwxrwxrwx  1 root root       25 Apr 29 16:23 Image -> vmlinuz-5.4.28-rockchip64
-rw-------  1 root root  7286379 Mar 28 13:33 initrd.img-5.4.28-rockchip64
-rw-r--r--  1 root root        0 Apr 18 13:29 .next
drwxr-xr-x  2 root root     4096 Apr 18 13:42 overlays
-rw-------  1 root root  4294688 Mar 28 12:07 System.map-5.4.28-rockchip64
lrwxrwxrwx  1 root root       25 Apr 29 16:24 uInitrd -> uInitrd-5.4.28-rockchip64
-rw-------  1 root root  7286443 Mar 28 13:33 uInitrd-5.4.28-rockchip64
-rw-------  1 root root 20787712 Mar 28 12:07 vmlinuz-5.4.28-rockchip64

 

Link to comment
Share on other sites

I have replaced the symlink now

 

Its not pointing to the right folder

 

lrwxrwxrwx 1 root root       22 Apr 29 18:05 dtb -> dtb-5.4.28-rockchip64/

lrwxrwxrwx 1 root root       22 Apr 29 18:05 dtb -> dtb-5.4.28-rockchip64/

 

 

This is the content of armbianEnv.txt

 

verbosity=1
overlay_prefix=rockchip
rootdev=UUID=3c50a1d1-71a5-4a0f-9899-099b17a1050b
rootfstype=ext4

 

Link to comment
Share on other sites

OMG its working... after i changed the DTB symlink it works!!! I think copying the files from the image to /lib/modules did the trick... I never did this before until you wrote me to do so and i think this solved the problem! It booted up and all is working again.. i might now try to update the kernel again

Link to comment
Share on other sites

I tried updating board firmware and kernel via armbian-config and i got the same result 

 

(now i know how to fix it) but why does that happen? 

 

This is what the debug console shows after i choose restart in armbian-config after Firmware Upgrade

 

Hn0    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Radxa ROCK Pi 4
`Nnp mode 5242c300.
normal boot
Ldt:   @`h0: ethernet@fe300000
itany key to stop autoboot:  0
CA`d did not respond to voltage select!
mmc_init: -95, time 10
bf@pch to partitions #0, OK
mmc0(part 0) is current device
Bc`lning mmc 0:1...
otl` /boot/extlinux/extlinux.conf
aprieving file: /boot/extlinux/extlinux.conf
"&bytes read in 81 ms (0 Bytes/s)
belect kernel
Enter choice: BHT FAILED: continuing...
NpnD U-Boot script /boot/boot.scr
 0$  bytes read in 102 ms (27.3 KiB/s)
## Executing script at 00500000
@OO` script loaded from mmc 0
 01 bytes read in 81 ms (1000 Bytes/s)
"File not found /boot/uInitrd **
 Dile not found /boot/Image **
&0724 bytes read in 330 ms (214.8 KiB/s)
 $98 bytes read in 210 ms (11.7 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
## Executing script at 39000000
@d Linux ARM64 Image magic!
SCRIPT FAILED: continuing...

 

Link to comment
Share on other sites

This is the content of boot -> seems as if some files are missing :O

 

total 96
 4 -rw------- 1 root root   151 Apr 28 15:28 armbianEnv.txt
 0 -rw-r--r-- 1 root root     0 Jun 24  2019 armbianEnv.txt.out
 4 -rw-r--r-- 1 root root   195 Apr 17 18:46 armbianEnv.txt.save
 4 -rw-r--r-- 1 root root   229 Apr 18 16:26 armbianEnv.txt.save.1
 4 -rw------- 1 root root  1536 Mar 28 13:26 armbian_first_run.txt.template
40 -rw------- 1 root root 38518 Mar 28 13:26 boot.bmp
 4 -rw-r--r-- 1 root root  2877 Jun  6  2019 boot.cmd
 8 -rw------- 1 root root  4882 Mar 28 13:26 boot-desktop.png
 4 -rw------- 1 root root  2940 Mar 28 13:32 boot.scr
 0 lrwxrwxrwx 1 root root    21 Apr 29 12:23 dtb -> dtb-5.4.32-rockchip64
 4 drwxr-xr-x 3 root root  4096 Mar 28 13:24 dtb-5.4.28-rockchip64
 4 drwxr-xr-x 3 root root  4096 Apr 29 12:21 dtb-5.4.32-rockchip64
 4 drwxr-xr-x 2 root root  4096 Apr 28 15:26 dtbs
 4 drwxr-xr-x 2 root root  4096 Apr 29 12:23 extlinux
 4 -rwxr-xr-x 1 root root  1807 Oct 21  2019 hw_intfc.conf
 0 lrwxrwxrwx 1 root root    25 Apr 29 16:23 Image -> vmlinuz-5.4.28-rockchip64
 4 drwxr-xr-x 2 root root  4096 Apr 18 13:42 overlays
 0 lrwxrwxrwx 1 root root    25 Apr 29 16:24 uInitrd -> uInitrd-5.4.28-rockchip64

 

It only changed DTB to point to 5.4.32 and added a new folder "dtb-5.4.32-rockchip64"

Edited by Kalli Lowman
Link to comment
Share on other sites

What i found out when i wanted to create another image of my emmc:

 

dd status=progress bs=512 if=/dev/mmcblk1 | pigz --fast > /home/kalli/eMMC_backup.img.gz - it was mmcblk1 all the time 

 

is that device name changed from mmcblk1 to mmcblk2, can you explain my why? Maybe this is also causing those weird problems.

 

Link to comment
Share on other sites

I see that he got some problems with the modules:

 

after i did apt-get update and upgrade he installed the 

 

5.4.3.2-rockchip64 but inside is only a build folder... in the old folder there are much more folders (5.4.28)

 

root@rockpi:/lib/modules/5.4.32-rockchip64# ls
build
root@rockpi:/lib/modules/5.4.32-rockchip64# cd ..
root@rockpi:/lib/modules# cd 5.4.28-rockchip64/
root@rockpi:/lib/modules/5.4.28-rockchip64# ls
kernel         modules.alias.bin  modules.builtin.bin      modules.dep      modules.devname  modules.softdep  modules.symbols.bin
modules.alias  modules.builtin    modules.builtin.modinfo  modules.dep.bin  modules.order    modules.symbols
root@rockpi:/lib/modules/5.4.28-rockchip64#

 

root@rockpi:/var/log/apt# apt-get install linux-image-current-rockchip64
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden NEUEN Pakete werden installiert:
  linux-image-current-rockchip64
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 22,1 MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 95,4 MB Plattenplatz zusätzlich benutzt.
Holen:1 https://apt.armbian.com buster/main arm64 linux-image-current-rockchip64 arm64 20.02.11 [22,1 MB]
Es wurden 22,1 MB in 4 s geholt (6.307 kB/s).
Vormals nicht ausgewähltes Paket linux-image-current-rockchip64 wird gewählt.
(Lese Datenbank ... 127748 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../linux-image-current-rockchip64_20.02.11_arm64.deb ...
Entpacken von linux-image-current-rockchip64 (20.02.11) ...
linux-image-current-rockchip64 (20.02.11) wird eingerichtet ...
update-initramfs: Generating /boot/initrd.img-5.4.32-rockchip64
update-initramfs: Converting to u-boot format
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf...
cp: der Aufruf von stat für '/usr/lib/linux-image-5.4.32-rockchip64' ist nicht möglich: Datei oder Verzeichnis nicht gefunden
run-parts: /etc/kernel/postinst.d/zz-update-extlinux exited with return code 1
dpkg: Fehler beim Bearbeiten des Paketes linux-image-current-rockchip64 (--configure):
 »installiertes linux-image-current-rockchip64-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück
Fehler traten auf beim Bearbeiten von:
 linux-image-current-rockchip64
E: Sub-process /usr/bin/dpkg returned an error code (1)

 

Edited by Kalli Lowman
Link to comment
Share on other sites

According to the log, errors occurred during installation. I don't know exactly what scripts are used in this core, so I don't know how to fix them properly. Try not updating the kernel (freeze it). Or try deleting the old kernel (For example, via synaptic or dpkg) before installing the new kernel.

Link to comment
Share on other sites

Okay... i got the next problem incoming... (i think when i reboot its bricked again...)

 

I cannot install linux-image-current-rockchip64...

 

 

It says CP cannot find /usr/lib/linux-image-5.4.49-rockchip64... i dont know why 


 

root@rockpi:~# apt-get install linux-image-current-rockchip64
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  linux-image-current-rockchip64
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/38.2 MB of archives.
After this operation, 97.2 MB of additional disk space will be used.
(Reading database ... 128592 files and directories currently installed.)
Preparing to unpack .../linux-image-current-rockchip64_20.05.7_arm64.deb ...
Unpacking linux-image-current-rockchip64 (20.05.7) over (20.02.11) ...
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf...
cp: cannot stat '/usr/lib/linux-image-5.4.49-rockchip64': No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-extlinux exited with return code 1
dpkg: warning: old linux-image-current-rockchip64 package post-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf...
cp: cannot stat '/usr/lib/linux-image-5.4.49-rockchip64': No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-extlinux exited with return code 1
dpkg: error processing archive /var/cache/apt/archives/linux-image-current-rockchip64_20.05.7_arm64.deb (--unpack):
 new linux-image-current-rockchip64 package post-removal script subprocess returned error exit status 1
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf...
Installing new extlinux.conf...
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 rw init=/sbin/init rootfstype=ext4 rootwait root=PARTUUID=B921B045-1DF0-41C3-AF44-4C6F280D3FAE

Creating new extlinux.conf...
Installing new extlinux.conf...
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-current-rockchip64_20.05.7_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

 

 

Edited by Kalli Lowman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines