TIP: Getting rid of common errors in chroot mode
In lot of my previous posts, I have mentioned using “chroot” to do different things. However, while you are in chroot, depending upon your actions, you might get see some error messages which are usually non-fatal and will let you do whatever you are trying to do (in general). Although in general it is a good idea to fix them for the sake of completeness.
Problem
Following are some of the error messages that you might see while in chroot:
Searching for GRUB installation directory ... found: /boot/grub
User postinst hook script [update-grub] exited with value 1
dpkg: error processing linux-image-2.6.30-8-bpo50-test (--install):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-2.6.30-8-bpo50-test
or
Unpacking bzip2 (from .../bzip2_1.0.5-6_i386.deb) ...
Processing triggers for man-db ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up binutils (2.20.1-15) ...
Setting up bzip2 (1.0.5-6) ...
Setting up linux-source-2.6.34 (2.6.34-1~experimental.2) ...
root@debian:~# ls
Solution
The way to get rid of these messages is by giving the following commands once you chroot into a system partition. For example, let’s say you want to chroot into a Linux partition on /dev/hda5. So you would do something like:
debian:~# mount /dev/hda5 /mnt
debian:~# chroot /mnt
After that give the following two additional commands (not from the chrooted partition but on the system from which you are chrooting) :
debian:~# mount -o bind /dev /mnt/dev
debian:~# mount -t proc none /mnt/proc
That’s it!


Email Subscription









April 8th, 2012 at 10:35 am
I found this page while searching for an answer to the openpty() error.
The funny thing is, that i mounted proc and dev and still get this message, when installing a new kernel and purging the old one with apt-get.
So i’m asking if you might have an solution to that.
Reply to this comment
June 9th, 2012 at 9:19 pm
Your post helped me a lot! I had a problem with my data and I was trying to fix it with the SystemRescueCd but was blocked with this error.
Thanks a lot!
Reply to this comment
October 30th, 2012 at 7:51 pm
Thanks for this page.
I hit this problem while trying to set up Code::Blocks under a chrooted directory sytem.
Without your help, I’d never have got it compiled.
Regards,
Phil
Reply to this comment