Site Tools


change_root

This is an old revision of the document!


How to recover a broken rootfs or an unbootable bootimg

DRAFT

Don't panic, there is solutions buried to go back on the right way, especially of if you have made backups of your partitions.

Chroot

no idea if someone else finds this useful … in case:

So you accidentially f$.§#ed up your system and you want an easy way to manipulate files or fix the system…

One possibility is to install e.g. Ubuntu 11.10 described here to a spare SD card you have lying around.

From that SD card you can then chroot to your system on the emmc or the other way round (in case you want to have a devel system and one for daily use/multiple OS'/…).

- Unmount the partition you want to chroot to:

  sudo umount /media/<mointpoint of the desired partition>
e.g. sudo umount /media/6ca3f514-dc34-4230-a997-ebe156d108c0

- mount that partition to /mnt:

  sudo mount /dev/<desired partition (unmounted above)> /mnt
e.g. **sudo mount /dev/mmcblk0p7 /mnt** for rootfs installed in eMMC

- mount additional stuff (dev/sys/proc):

  sudo mount -o bind /dev /mnt/dev
  sudo mount -o bind /sys /mnt/sys
  sudo mount -t proc /proc /mnt/proc

- chroot

  sudo chroot /mnt /bin/bash

You can now tweak your system. (e.g. you can install additional stuff from the repositories, you could run update-initramfs or do whatever it is you need to be doing).

For working internet you need to write some nameserver to /etc/resolv.conf (e.g. nameserver 8.8.8.8) (DNS by google).

To boot the changerooted system natively on next boot instead of what you're running off off now you just need to run

sudo update-initramfs -u

Chroot from initramfs

TODO based on initramfs of Ubuntu bootimg.

Flash another kernel

if for an unknow reason SOSBOOT is unable to read your rootfs (for example NILFS2 or BTRFS filesystem) just after flashing a new kernel with a filesystem module which isn't loaded by initrd, you ended with an unbootable system and you are in chicken-egg trouble… One possible solution, is to rebuild a kernel with this filesystem type module builtin. Then backup your broken partition 6 image with putusb or nvflash. Make a copy of this backup and use abootimg to update it with this new kernel:

abootimg -u /tmp/copy-of-partition_6.img -k .../arch/arm/boot/zImage

and download it back to your AC100 with putusb or nvflash, then reboot and correct your rootfs or your bootimg according to make again bootable your AC100 with the last refinement.

change_root.1329954671.txt.gz · Last modified: 2012/02/23 00:51 by armelf