Modify a prepackaged image Posted: Mon, 08/09/2010 - 05:26
Hi all, I follow the instructions in the wiki about how to modify a prepackaged image to inall software.after #mkdir temp-mnt #losetup /dev/loop5 root.img #unt /dev/loop5 temp-mnt #chroot temp-mnt I can not use yum or apt-get to install software. how can I use yum ro apt-get? I need your help! Thank you!
cheers, lisiyang
Login or register to post comments
tbednar (Offline)
try mounting proc Posted: Mon, 08/09/2010 - 17:09
Hello,
Your chrooted environment is missing the proc file system. We will borrow that from the running host. The image is very likely not configured for the correct name resolution, so we need to borrow /etc/resolv.conf as well to be able to use literal IP addresses (domain names). To minimize changes to the image, you may try to skip the resolv.conf first and see if you need it.
So .... Just before executing the chroot command, you may wish to do the following:
mount -t proc /dev/proc temp-mnt/proc cp /etc/resolve.conf temp-mnt/etc
You should be able to do networking etc. after you chroot. You may get some complaints from Perl about locale etc., which I choose to ignore ;-) (fixing those is another topic altogether).
I hope this helps.
A couple of voo-doo-ish tips (avoids weirdness): 1) to be safe, unmount the proc system after you exit from chroot and before unmounting the image itself. (umount /dev/proc)2) type 'sync' at the command line before unmounting the image file (I had image file not to be updated after unmounting!) 3) when unmounting the image use 'unmount -d temp-mnt'. That will release the loopback device cleanly and that device will be available the next time around ... otherwise you will need to change the device number every time
Tomas
Login or register to post comments
lisiyang (Offline)
No space left on device Posted: Mon, 08/09/2010 - 23:40
hello, thank you very much for your reply! but i get a problem. when i run #mount -t proc /dev/proc temp-mnt/proc #chroot temp-mnt when i run ifconfig ,i can get the ip which is the same with the host machine. but when i run yum update ,it says no space left on device i think the file system has taken up the whole space .
Traceback (most recent call last): File "/usr/bin/yum", line 29, in yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 309, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 166, in main base.doLock() File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1173, in doLock while not self._lock(lockfile, mypid, 0644): File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 1229, in _lock os.write(fd, contents) OSError: [Errno 28] No space left on device
Do you know how to resolve the problem? thank you! cheers, lisiyang
Login or register to post comments
lisiyang (Offline)
thank you very much ! i can Posted: Tue, 08/10/2010 - 03:35
thank you very much ! i can usr yum to install software!
cheers, lisiyang
Login or register to post comments
graziano (Offline)
Hello, thanks Tomas: I did Posted: Fri, 08/27/2010 - 10:55
Hello,
thanks Tomas: I did integrate your comment into the wiki!
cheers graziano