Azitech

Azimout's Linux weblog

chroot

leave a comment »

To install/remove packages (or modify in general) on a Linux system that is unbootable, you can boot with a LiveCD, mount the underlying system’s root partition and then chroot to that mount point. After that, any commands will be run on the underlying system, rather than on the LiveCD…

Some actions (e.g. installing grub) require also the devfs, procfs and sysfs filesystems, so before chrooting, remember to also:

  • sudo mount -o bind /dev /mnt/dev
  • sudo mount -t proc none /mnt/proc
  • sudo mount -t sysfs none /mnt/sys

(I assume here that the root partition was mounted under /mnt)

Update 01.10.2010: if you’re using dhcp, networking will not work because /etc/resolv.conf will be empty. Add “nameserver 8.8.8.8” to that file

Advertisements

Written by azimout

23/02/2010 at 11:21

Posted in Reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: