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

general_email at technicalbloke.com general_email at technicalbloke.com
Tue Sep 14 13:21:30 UTC 2010


On 12/09/10 09:18, Bruce Richardson wrote:
> On Sun, Sep 12, 2010 at 05:20:08AM +0100, general_email at technicalbloke.com wrote:
>    
>> Yep, you're both right...
>>
>> os.chroot(squashfs)
>> print os.getcwd()
>>   >>>  /home/r0g/AAA_BACKED_UP/Code/projects/Techbench/remaster/workspace
>> os.chdir("/")
>> print os.getcwd()
>>   >>>  /
>>      
> Labouring the point a little, the reason I wanted you to test what was
> happening with the current directory rather than just jump to testing
> what would happen if you set the directory is because you should always
> want to have unambiguously identified the issue before fixing it.  If
> you just apply fixes till one works, you can never be sure if you
> addressed an issue directly or if some side effect of your actions
> resolved the problem (in which case the fix may not work again in
> another situation) or even if you simply masked the problem (in which
> case it'll probably resurface at the most inconvenient point).
>
>    

Indeed. Turns out that's how chroot has always worked in the os and 
python simply wraps the os function without any special sauce of its 
own. Actually reading the man page it's quite clear that one must change 
directory after calling the chroot command. There's no mention of that 
in the python docs but I guess the assumption is that the stuff the os 
module calls is already pretty well documented by the host os and that 
people coding for that platform should know that! (which I do now ;)

Thanks for your help and advice,

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




More information about the GLLUG mailing list