Modify a prepackaged image and Use YUM to install software

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

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

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

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值