[Gllug] apt-get failing in chrooted python script...

general_email at technicalbloke.com general_email at technicalbloke.com
Mon Sep 6 05:37:01 UTC 2010


I'm updating a custom remastering script form Ubuntu 8.04 to 10.04 and 
shelling out to do the apt-get stuff (yes I know about subprocess, I'm 
lazy OK!). This used to work fine but with the newer Ubuntu it flops 
over with the following error...

E: Unable to change to 
/home/r0g/AAA_BACKED_UP/Code/projects/Techbench/remaster/workspace/ - 
chdir (2: No such file or directory)

The folder is outside the chroot so I'm not surprised it cant change to 
it, however I am surprised apt-get (supposedly running within a chroot) 
wants to cd to this folder. Manually chrooting in from a terminal works 
fine and apt-get completes without errors.

I'd be grateful if anyone has some insight into this, or ways I could 
begin debugging the problem. Code snippet follows...

Thanks,

Roger.

import os
squashfs = "/home/r0g/code/projects/Techbench/remaster/workspace/squashfs"

def oss( s ):
     r = os.system( s )
     if r:
         print "FAIL CODE :", r, "~", s
         raw_input("\nBreak recommended\n")
     else:
         print "SUCCESSFUL:", s


def apt_stuff():

     os.chroot(squashfs)
     print "My real and effective user ids are:", os.getuid(), os.geteuid()
     oss("mount /proc")
     oss("mount /sys")
     oss("mount -t devpts none /dev/pts")
     oss("apt-get -y update")

apt_stuff()

...
Get: 32 http://gb.archive.ubuntu.com lucid-updates/universe Sources 
[37.0kB]
Get: 33 http://gb.archive.ubuntu.com lucid-updates/multiverse Packages 
[3,771B]
Get: 34 http://gb.archive.ubuntu.com lucid-updates/multiverse Sources 
[1,508B]
Fetched 11.9MB in 16s (709kB/s)
E: Unable to change to 
/home/r0g/AAA_BACKED_UP/Code/projects/Techbench/remaster/workspace/ - 
chdir (2: No such file or directory)

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list