Using the installer to flash the kernel again
Every once in a while someone asks how they can use the Debian installer to access their system on disk to run commands, for example to write the kernel and ramdisk to flash again. This is particularly useful on headless NAS devices. So here's how to do it:
mkdir -p /target mount /dev/sda2 /target mount /dev/sda1 /target/boot mount --bind /dev /target/dev mount -t proc none /target/proc mount -t sysfs none /target/sys chroot /target /bin/sh # the prompt will change # make modifications to the system and regenerate the initramfs update-initramfs -u exit # the prompt will change again as you're leaving the chroot umount /target/sys umount /target/proc umount /target/dev umount /target/boot umount /target reboot