Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59419
| References | <510a8652-1097-4327-9dda-56454142cda4@googlegroups.com> <c8b18088-d97d-4022-95e1-b14ab3a29125@googlegroups.com> |
|---|---|
| Date | 2013-11-14 20:32 +1100 |
| Subject | Re: chroot to install packages |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2587.1384421553.18130.python-list@python.org> (permalink) |
On Thu, Nov 14, 2013 at 8:29 PM, Himanshu Garg <hgarg.india@gmail.com> wrote:
> I have written a script
>
> os.chroot("/lxc/test_container/rootfs")
> subprocess.call(["apt-key", "add", "/root/package.key"])
> subprocess.call(["apt-get", "update"])
>
> os._exit(0)
>
> Now, this script is working properly, entering the chroot jail and adding the apt key, but when the "apt-get update" command runs, it starts but throws me an error:
> "E: Unable to change to (unreachable)/lxc/test_container/ - chdir (2: No such file or directory)"
I'm not certain, but this might be due to chrooting without changing
directory. Unless os.chroot() does it for you, you'll want to
os.chdir("/") immediately afterwards. In any case, it's worth a try.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
chroot to install packages Himanshu Garg <hgarg.india@gmail.com> - 2013-11-13 06:31 -0800
Re: chroot to install packages Chris Angelico <rosuav@gmail.com> - 2013-11-14 10:40 +1100
Re: chroot to install packages Himanshu Garg <hgarg.india@gmail.com> - 2013-11-13 17:52 -0800
Re: chroot to install packages Chris Angelico <rosuav@gmail.com> - 2013-11-14 13:00 +1100
Re: chroot to install packages Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-14 02:12 +0000
Re: chroot to install packages Chris Angelico <rosuav@gmail.com> - 2013-11-14 13:26 +1100
Re: chroot to install packages Himanshu Garg <hgarg.india@gmail.com> - 2013-11-14 01:29 -0800
Re: chroot to install packages Chris Angelico <rosuav@gmail.com> - 2013-11-14 20:32 +1100
Re: chroot to install packages Himanshu Garg <hgarg.india@gmail.com> - 2013-11-14 01:41 -0800
csiph-web