4

I have a Disk Image but this Disk Image has not some packages like libjpeg. First of all I mount the Disk Image to directory and then I change root to this directory. Unfortunately apt-get update and apt-get install aren't working in chroot and I don't know what else to try. Following error happens when I run apt-get update and apt-get install :

bash: apt-get: command not found

How to solve this problem?

ali.329
  • 41

1 Answers1

8

Try this:

CHROOT_DRIVE=/dev/sda2 # or /dev/mmcblk1p2
CHROOT_PATH=/mnt/recovery # or /tmp/recovery # to have it auto cleanup on reboot
mkdir -p "${CHROOT_PATH}"
mount "${CHROOT_DRIVE}" "${CHROOT_PATH}"
mount -t sysfs none "${CHROOT_PATH}/sys"
mount -t proc none "${CHROOT_PATH}/proc"
mount --bind /dev/ "${CHROOT_PATH}/dev"
mount --bind /dev/pts "${CHROOT_PATH}/dev/pts"
mount -o bind /etc/resolv.conf "${CHROOT_PATH}/etc/resolv.conf"
chroot "${CHROOT_PATH}"

When you are done:

exit
umount -R "${CHROOT_PATH}"
muru
  • 197,895
  • 55
  • 485
  • 740
Firas
  • 81