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

general_email at technicalbloke.com general_email at technicalbloke.com
Tue Sep 7 23:17:51 UTC 2010


On 07/09/10 23:09, Bruce Richardson wrote:
> On Tue, Sep 07, 2010 at 06:40:24PM +0100, general_email wrote:
>    
>>
>> Not that I know of, AAA_BACKED_UP is separate filesystem that I have
>> mounted there but I don't think I have any symlinks in the path :/
>>      
> So how is that path comming to the attention of your script?  Are you
> running it from the AAA_BACKED_UP location?
>
>    

Yes, that's whats so weird.

I'm using os.chroot() like so...

os.chroot('/home/r0g/AAA_BACKED_UP/Code/projects/Techbench/remaster/workspace/squashfs')

The script seemingly manages to mount '/proc', '/sys' & '/dev/pts' OK, 
which I assume it wouldn't if I weren't already in the chroot but then I 
get the error...

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

Which of course there shouldn't be if the script is jailed in the first 
folder which leaves the question: why is it apt-get trying to change to 
a path outside the chroot and where did it find it!?

I've checked my /etc/apt/sources.list and there's nothing local in there 
and running os.listdir('/home') in the script confirms python (and 
presumably the whole os module) is seeing the jailed environment rather 
than my main system. I'm starting to wonder if it's apt.

Any suggestions as to how to continue debugging are more than welcome.

I thought next, short of installing python 3, I might try calling the 
apt-get command via the subprocess module instead.

Phew, gotta love a challenge eh? Thank god this is a personal project 
rather than anything work critical!

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




More information about the GLLUG mailing list