Jump to content

How to Recover the Contents of the /boot Folder


Go to solution Solved by Volo,

Recommended Posts

Posted

Long story short, I accidentally removed all the contents of the /boot folder 😢.

 

I'm running minimal Armbian 24.5.1 Bookworm with Linux 6.1.43-vendor-rk35xx on Orange pi 5 plus.

It all started with a failed apt update indicating there wasn't enough space in the boot partition. The update was trying to install 6.1.75-vendor-rk35xx kernel, so I decided to remove the old one from the boot to free up some space. Instead, I accidentally applied 'rm -r' to the entire /boot folder. My SBC is working fine now, but I'm afraid it won't boot on next restart, so I'm looking for a way to recover the files.

 

So far, I performed apt upgrade, which put the new 6.1.75-vendor-rk35xx kernel in the boot, but I'm not sure if it installed correctly - there was a warning that it couldn't be done automatically since there were no headers. I also copied armbianEnv.txt and boot.cmd from Armbian_24.5.3_Orangepi5-plus_bookworm_vendor_6.1.43_minimal.img so now armbianEnv.txt looks like below:

verbosity=1
bootlogo=false
console=both
overlay_prefix=rockchip-rk3588
fdtfile=rockchip/rk3588-orangepi-5-plus.dtb
rootdev=UUID=0af659d6-5b18-4106-9904-3ec2a1445b8a
rootfstype=ext4

 

Finally I used u-boot-tools to make boot.scr:

mkimage -C none -A arm -T script -d boot.cmd boot.scr

 

Did I miss anything, or am I good to try restarting the SBC and see how it goes 😅?

 

The original contents:

total 74660
    4 -rw-r--r-- 1 1003 1003      254 Jul 23 23:40 armbianEnv.txt
    4 -rw-r--r-- 1 root root     1536 Sep 10  2023 armbian_first_run.txt.template
   40 -rw-r--r-- 1 root root    38518 Sep 10  2023 boot.bmp
    4 -rw-r--r-- 1 1003 1003     3820 Sep 10  2023 boot cmd
    4 -rw-rw-r-- 1 root root     3892 Sep 10  2023 boot.scr
  240 -rw-r--r-- 1 root root   243278 May 20 15:52 config-6.1.43-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       24 Jul 24 00:44 dtb -> dtb-6.1.43-vendor-rk35xx
    4 drwxr-xr-x 3 root root     4096 Jun 12 12:21 dtb-5.10.160-legacy-rk35xx
    4 drwxr-xr-x 3 root root     4096 Jun 17 20:40 dtb-6.1.43-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       28 Jul 24 00:44 Image -> vmlinuz-6.1.43-vendor-rk35xx
15452 -rw-r--r-- 1 root root 15816813 Jul 24 00:30 initrd.img-6.1.43-vendor-rk35xx
   16 drwx------ 2 root root    16384 Sep 10  2023 lost+found
    4 drwxr-xr-x 2 root root     4096 Feb 23 21:28 overlay-user
 6836 -rw-r--r-- 1 root root  6998291 May 20 15:52 System.map-6.1.43-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       28 Jul 24 00:30 uInitrd -> uInitrd-6.1.43-vendor-rk35xx
15452 -rw-r--r-- 1 root root 15816877 Jul 24 00:30 uInitrd-6.1.43-vendor-rk35xx
36596 -rw-r--r-- 1 root root 37468672 May 20 15:52 vmlinuz-6.1.43-vendor-rk35xx

 

After recover:

total 74296
    4 -rw-r--r-- 1 root root      181 Jul 25 01:14 armbianEnv.txt
    0 -rw-r--r-- 1 root root        0 Jul 24 02:03 armbianEnv.txt.out
   40 -rw-r--r-- 1 root root    38518 Jul 25 00:41 boot.bmp
    8 -rw-r--r-- 1 root root     4159 Jul 25 00:13 boot.cmd
    8 -rw-r--r-- 1 root root     4231 Jul 25 00:35 boot.scr
  240 -rw-r--r-- 1 root root   243875 Jul 21 11:42 config-6.1.75-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       24 Jul 24 01:11 dtb -> dtb-6.1.75-vendor-rk35xx
    4 drwxr-xr-x 3 root root     4096 Jul 24 01:11 dtb-6.1.75-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       28 Jul 24 01:12 Image -> vmlinuz-6.1.75-vendor-rk35xx
15460 -rw-r--r-- 1 root root 15827858 Jul 24 01:12 initrd.img-6.1.75-vendor-rk35xx
 6756 -rw-r--r-- 1 root root  6917422 Jul 21 11:42 System.map-6.1.75-vendor-rk35xx
    0 lrwxrwxrwx 1 root root       28 Jul 24 01:12 uInitrd -> uInitrd-6.1.75-vendor-rk35xx
15460 -rw-r--r-- 1 root root 15827922 Jul 24 01:12 uInitrd-6.1.75-vendor-rk35xx
36316 -rw-r--r-- 1 root root 37186048 Jul 21 11:42 vmlinuz-6.1.75-vendor-rk35xx

 

 

Posted (edited)

Thank you for the link, but since my SBC is still working (at least until I reboot it), wouldn't it be easier to recover the boot by reinstalling the kernel using armbian-config? Wouldn't it place all the necessary files and symlinks in the boot?

Edited by Volo

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