3

I am attempting to update a broken Linux Mint 32 bit installation using chroot from a live cd. Different websites give different folders that need to be mounted before chroot.

The error I am trying to solve is here What folders to mount and why?

4

well; gentoo wiki is very nice in that respect; (assuming that you are booted to working environment like livecd/usb) first we assume your chroot system is on /dev/sdaX. so we go mount it:

mkdir -p /mnt/distro
mount /dev/sdaX /mnt/distro

if your chroot (problematic environment) has seprate /boot, /var or any other partitions we mount them like above.

root #mount -o bind /proc /mnt/distro/proc

then depend on what kind of system you are building (systemd or init ):

root #mount --rbind /sys /mnt/distro/sys 
root #mount --make-rslave /mnt/distro/sys 
root #mount --rbind /dev /mnt/distro/dev 
root #mount --make-rslave /mnt/distro/dev

if youare building init-based system like OpenRc don't do --make-rslave lines.

then to chroot in a right way do this:

root #chroot /mnt/distro /bin/env -i TERM=$TERM /bin/bash 
root #source /etc/profile 
root #export PS1="(chroot) $PS1"

Note; that your chroot environment may differ and /bin/env wasn't there. so it should be at usr/bin/env.

2
  • Thanks for the quick reply, I am using systemd, what will change must be made if I am using init?
    – One Face
    Jan 4 '15 at 15:23
  • first; it is regarding your chroot os. and if the os you want to chroot in uses systemd do the --make-rslave lines if not don't.
    – r004
    Jan 4 '15 at 15:29

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.