Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59419

Re: chroot to install packages

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.050
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'error:': 0.07; 'throws': 0.09; 'afterwards.': 0.16; 'apt': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'garg': 0.16; 'jail': 0.16; 'runs,': 0.16; 'subject:install': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'starts': 0.20; 'written': 0.21; 'command': 0.22; 'directory.': 0.24; 'script': 0.25; 'skip:" 20': 0.27; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'changing': 0.37; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'skip:o 30': 0.61; "you'll": 0.62; 'such': 0.63; 'worth': 0.66; 'due': 0.66; 'certain,': 0.84; '"apt-get': 0.91; 'try.': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=XptO83SMIsPvg7L35LWUhm/jpMyvtpjgFvy7yhXL5Cc=; b=F1bPjpGTJc4RG7EK5vsoT6/TgQgOA/QTpOsmtZsmm818aLieX0ujioRQl8wa50gKMq kJ657OTvRGjtQKEtZCPxnwCJf2kSEdOqrUqzks3BJjDogEdobZC7lKmpuldMTAB9oIsQ tnhUBcMP889sBvBugEwtvSQqY4EADcg1KhJpm1pDS+n+PIfe7hPoUD09iTwXBYg4kyw9 obFolJqrsId/mZogZPygHpa5s66bEHB9OReeJZj8/nlz3u5L+ljcRraVFJo+oaPmzf6F qBqkb3kVv+CdJZsCZdYFbcUgSMSI7827xAwGOcg+CVKKDwEXYHpOg+Tj8gl/l6o5G/kV buBQ==
MIME-Version 1.0
X-Received by 10.66.2.234 with SMTP id 10mr425048pax.39.1384421549769; Thu, 14 Nov 2013 01:32:29 -0800 (PST)
In-Reply-To <c8b18088-d97d-4022-95e1-b14ab3a29125@googlegroups.com>
References <510a8652-1097-4327-9dda-56454142cda4@googlegroups.com> <c8b18088-d97d-4022-95e1-b14ab3a29125@googlegroups.com>
Date Thu, 14 Nov 2013 20:32:29 +1100
Subject Re: chroot to install packages
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2587.1384421553.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384421553 news.xs4all.nl 15897 [2001:888:2000:d::a6]:46561
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59419

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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