[Toybox] chroot command

Rob Landley rob at landley.net
Tue Aug 6 23:00:57 PDT 2013


On 08/02/2013 06:12:28 PM, Dave wrote:
> Hi guys,
> 
> Many thanks for the terrific work on toybox.  I just saw the video by  
> Mr. Landley
> on the toybox home page, and I was blown away by the vision of the  
> future of the
> phone, and the trenchant analysis of the state of the GPL ecosystem.
> 
> Usually when I have a software problem I will write a pointed email  
> to a list
> like this detailing exactly what went wrong and asking for help.   
> This is a bit
> more broad and you might decide it doesn't belong in your forum.
> 
> I decided the other day to install Debian on my Motorola Milestone 2  
> phone.
> The typical way to do this is with a loopback mounted file that  
> contains  a
> prepackaged distribution that is almost always Ubuntu.  Here is one  
> here:
> http://androlinux.com/android-ubuntu-development/how-to-install-ubuntu-on-android/
> If you surf the web you will find a dozen web sites like this.
> 
> I rapidly determined that my phone has a locked bootloader

Not much I can do about that. (Same for the boot roms on the XBOX and  
Playstation.)

> and I could not replace the kernel with one that supported loop file  
> systems.
> ( I have since learned that I can ,theoretically at least, compile  
> loop support as
> a loadable module.  Incidentally, what is the point of locking the  
> bootloader if
> you let people load modules?).

With Pointy Hair Linux (excuse me, Red Hat Enterprise) they  
cryptographically sign modules and only load ones that the signature  
matches. Meaning you have to rootkit
your own kernel, or just not use that.

> I partitioned 3GB of an SDcard as ext3 and found debootstrap in a  
> .deb and tried
> to run it.  I wish I had kept a log of all the problems I had because  
> there where
> dozens of them. I eventually gave up and dded the partition to a  
> redhat machine
> and debootstraped it with the aid of qemu. Now I have a Debian  
> install, so I put
> it back on the phone and fired it up.  Or tried to.  Chroot didn't  
> work. It says:
> 
> bash-4.1# chroot .
> chroot .
> Segmentation fault
> 
> Not terribly informative.  It struck me that it was looking for  
> /bin/sh.  I ran
> strings on busybox and it looks like it is hardcoded in there.  So I  
> setup a
> symlink in /bin ( this will be erased on reboot by the way). No dice.

Up until this point, I thought you were submitting a bug report for  
toybox chroot. I'm _guessing_ that's not what you're doing?

> Normally my next move would be to run strace on chroot to find the  
> issue, but it
> looks like I don't have strace.

http://landley.net/aboriginal/bin/strace-armv5l

> Not having any diagnostic tools to work with, I tried replacing  
> busybox with
> toybox. Still no dice.

Same segfault?

Most likely what's happening is that the binary it's chrooting _to_ is  
segfaulting, possibly due to an ABI mismatch. (binflat vs ELF, EABI vs  
OABI, armv7l vs armv5l,
who knows?)

> So, long story short, Debian is not working on my phone.
> 
> In the course of doing all this I got to thinking about what problem  
> I was
> setting out to solve in the first place.  Putting Debian on your  
> phone has some
> cool factor, but isn't the phone running Linux already?

Not necessarily a useful one.

> What do I hope to get out of it?  More to the point, the  
> inconvenience  of
> running in a chroot takes away from some of the enjoyment of running  
> desktop
> apps on my phone. What applications exactly did I hope to run on the  
> phone?
> Well, there's octave, wireshark, gimp, ssh server and maybe eclipse.  
> Just
> checking the google store, it looks like octave and wireshark are  
> already
> there, gimp is in progress and ssh was one of the first apps  
> ported.   Eclipse
> is not likely to be ported to android any time soon, but doing  
> development on
> eclipse an a 3.5 inch screen is going to get old in a hurry.

Hence the "plug in a bigger monitor via usb" part of the talk. But that  
doesn't
mean the current generation of phones is a usable dev environment _yet_.

> This brings up another point. The entire thing with the phone is that  
> it
> benefits from a symbiotic relationship with servers.  The client  
> server
> paradigm was practically invented for the phone.

Not really.

> I have had the phone for several years and I have been happy with  
> just using
> the ssh client and using a web browser, because every single thing  
> that I want
> to see or use is available from one or the other.  I don't even get  
> my mail
> on the phone.  The web-mail works fine.  Denninger wrote a piece the  
> other
> day about cell phones as desktop replacements :
> http://market-ticker.org/akcs-www?post=222877

Nice of him to notice:

http://www.slate.com/blogs/business_insider/2013/07/21/microsoft_windows_monopoly_three_charts_that_show_its_demise.html

> It looks OK as far as it goes, but I think it ignores the reality of  
> ubiquitous
> computing. Cell phones, or tablets ( or even laptops) don't need to  
> be self
> hosting if they are always connected to the network and there are  
> servers
> available. Moreover, look at the relative sizes of these partitions:
> 
> Filesystem 	Size 	Used 	Free 	Blksize
> /dev 	237M 	44K 	237M 	4096
...
> /system                     296M
> /mnt/sdcard/debian 283M
> 
> A full featured Debian is the same size as Android! What is the point  
> of
> reinventing the wheel?

Why didn't the original IBM PC just run Vax VMS if the hardware was  
going to become as powerful as a Vax a few years later?

> Isn't this the problem space that netbsd was invented to solve?

As far as I can tell netbsd wasn't invented to solve any particular  
problem, it was invented for bragging rights.

> Is the entire exercise just about making something palatable to  
> Google?

No, it's about outrunning  
http://www.slate.com/blogs/moneybox/2013/04/10/pc_sales_tumble_by_the_largest_amount_ever.html  
given that  
http://tech.fortune.cnn.com/2013/02/06/apple-samsung-profit-share/ is  
the current market reality. So you either side with Apple or you side  
with Samsung or you do not participate in the transition at all.

> Denninger is pushing the blackberry hard. I'm inclined to agree in  
> principle.

It's about as relevant as Nokia's winphones.

Remember the rise of the microcomputer when there was the TI 99/4a and  
the Coleco Adam and the Atari ST and the Commodore Amiga and it  
eventually boiled down to PC vs Apple?

You're talking about the Amiga. It does not _matter_.

> The only reason I don't change is that I don't like the blackberry  
> keyboard.
> Think about it, you are throwing over the C library, the guts of the  
> /etc
> directory, the entire user-land, why cling to the kernel?  What is it  
> you like
> about it?

That kernel has driver support from the hardware vendors willing to  
preinstall it. Remember how lack of driver support and preinstalls  
killed OS/2?

(Also, I'm not up for writing a new kernel right now.)

> Is it the license? You just made a powerful case that the license was  
> dead.

I liked the GPL. I miss the GPL. I _defended_ the GPL probably longer  
than I should have:

http://sf.geekitude.com/content/pros-and-cons-gnu-general-public-license-linucon-2005

But there's no such thing as _the_ GPL anymore. There are multiple  
incompatible forks preventing each other from reusing code, and  
copyleft doesn't _work_ when you fragment it.

I didn't kill the GPL, the FSF did. I'm just acknowledging what  
happened and getting on with my life, after several years of pondering  
how to deal with the unpleasant situation the FSF imposed upon my  
community.

> Why are you helping the same people that would be perfectly happy to  
> waterboard
> Snowden for the rest of his natural?

Non sequitur?

Google waterboards snowden? The NSA <strike>could be stopped</strike>  
would pay the slightest attention to copyleft? Everybody shouting  
"freedom" from Lawrence Lessig to RMS to Che Guevara to Lindon Larouche  
to the guy from braveheart all mean exactly the same thing when they  
say it and failure to kowtow to any one of them means the terrorists  
win?

Here's how useless copyleft has become (and this is coming from the guy  
who started the BusyBox lawsuits). The glibc maintainer for the past  
decade, Ulrich Drepper, left Red Hat to go work at Goldman Sachs  
instead. This is a company that never returns GPL modifications  
upstream, and there's nothing anybody can do about it because they  
don't distribute binaries outside the company. If you make too many  
waves in the company, they will press criminal charges against their  
own programmers to make examples of them:

   http://rajivsethi.blogspot.com/2013/08/the-spider-and-fly.html

And you think copyleft is a defense against the _NSA_? *boggle*

That's too clueless for words. I'm going to stop paying attention to  
this thread now.

Rob
 1375855257.0


More information about the Toybox mailing list