Removing packages that broke the system

From MEPIS Documentation Wiki

Jump to: navigation, search

If you broke your system, don't worry, you don't necessarily have to reinstall it all over again (although that is not very hard to do either)

  1. boot your system with the Live CD, use the root account to log in.
    • if you have more than one Linux partition, you can also do this from there
  2. mount your root partition from the harddisk
  3. open konsole and as root type: chroot /mnt/partitionname where, of course, the partition name is the root partition name (e.g., chroot /mnt/sda2)
    • if don't get a command prompt and you get errors like: bash: /dev/null: Permission denied press CTRL-C to stop them.
    • if you get this error message chroot: cannot run command `/bin/bash': Permission denied you need to mount the partition with "exec" parameter, you can remount it with this command: mount -o remount,exec /mnt/partitionname
  4. use apt-get (or dpkg) to remove apt-get remove packagename or reinstall a package apt-get remove packagename --reinstall

To have a working network in the chrooted environment you need to use these commands before you use chroot command:

mount /dev /mnt/partitionname/dev --bind
mount /sys /mnt/partitionname/sys --bind
mount /proc /mnt/partitionname/proc --bind
cp /etc/resolv.conf /mnt/partitionname/etc

(replace partitionname with the actual name of your partition)

Personal tools
In other languages