1

I deleted my boot partition several day ago and have not been able to recover it. To fix it, I installed the same image with the same parameters on a flash drive and then copied that boot partition on to my hard drive. I am now getting an error that indicates that the vmlinuz image searches for the root partition by uuid and it can find my hard drive. To make things more complicated, my hd is lvm+LUKS. Can I edit vmlinuz and initrd.img? Is there another way to fix this? Or should I abandon it and reinstall?

I am using 32-bit Debian Jessie and am able to access all remaining files on my hard drive.

Edit--I don't have my old vmlinuz or initrd.img, they were deleted.

1

Your boot parameters are handled by your boot loader passing an argument to vmlinuz when it launches. Assuming you are using grub, in grub.cfg there will be an argument for root= that should contain your UUID. Since your using LUKS the more difficult part is that there is probably an initramfs image that boots at startup and actually mounts and decrypts your partition and could quite possibly have the UUID stored inside the image.

The easiest recovery for this is to find a live distro with LUKS support and boot from it (Debian install typically has a recovery mode at livecd boot). Then mount your encrypted root, decrypt, mount boot and then chroot into the mounted partitions. Once in there you can rerun the ramdisk utility and see if that updates all your info. Make sure you mount /boot too before chrooting.

update-initramfs -c -k <kernel>
update-grub

Exit chroot, unmounted everything and reboot.

1

1) Boot from live CD

2) Create boot partition again like ext4

3) Install Linux images on your boot partition

sudo mount /dev/sdax /mnt/myroot (where sdax is your root partition)

sudo mount /dev/sday /mnt/myroot/boot (we need to mount boot because it is on another partition /dev/sday)

sudo mount ‐‐bind /dev /mnt/myroot/dev
sudo mount ‐‐bind /proc /mnt/myroot/proc
sudo mount ‐‐bind /sys /mnt/myroot/sys

Mount all of your other partitions /boot,/var,/usr,/tmp etc. Make sure you have mounted them all.

Copy resolv.conf

cp -L /etc/resolve.conf /mnt/debian-example/etc/resolve.conf

chroot

 sudo chroot /media/bin:/sbin:/usr/bin:/usr/sbin /mnt/tmp...

Reinstall missing kernel image

move initrd.img from root:

mv initrd.img initrd.img.OLD

install Linux image

apt-cache search 'linux-image'
apt-get install linux-image-x.x-generic

Replace linux-image-x.x-generic with yours.

restore grub

sudo grub-install /dev/sda

Reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.