我有一个磁盘映像,但这个磁盘映像没有 libjpeg 之类的软件包。首先,我将磁盘映像挂载到目录,然后将根目录更改为此目录。不幸的是,apt-get update
在apt-get install
chroot 中无法正常工作,我不知道还能尝试什么。当我运行apt-get update
并时发生以下错误apt-get install
:
bash: apt-get: command not found
如何解决这个问题呢?
答案1
尝试这个:
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}"
完成后:
exit
umount -R "${CHROOT_PATH}"