Debian In An Extend


Stuckie

Member
Joined
Apr 7, 2004
Messages
492
Age
38
Location
Tired, and sleeping in the basement...
Website
www.stuckieworld.net
Heya!

-- For First Time Readers --

You're probably going "ARGH! so many pages and a huge amount of information to read!" about now.. but don't fret!
The vast majority of these pages have been development back and forth between several people and myself as we work out the kinks in the Extend Utils.

While reading it all is possibly a good idea, it's not hugely necessary.. a quick run down is as follows:
I used a chroot environment to get a Debian terminal running within Angstrom. I then extended this and got X running. I then had a look at Arch and Ubuntu and had some small successes with them.
Due to somewhat popular demand at the time, I had a further look into Ubuntu and made some headway, before giving up due to Ubuntu's custom services giving me some headaches and I ended up hitting a brick wall in terms of progress.
I then went back to the Extend Utils suite and updated it from a bunch of hard-coded scripts, to what is essentially a mount script generator, and that's where we are at today :)

Documentation for the Extend Utils suite, with a better layout than spread all about these posts, is available on the Wiki here: http://pandorawiki.org/Extend_Utils

And now back to our regular scheduling...

----------------------------

Tonight's mental hack, is getting an install of Debian up and running on the Pandora within Angstrom itself :)
This is sneaky, as it means we get all the drivers for us loaded up in the kernel, and can just chroot into the Debian shell to do whatever we need/want.

2010-06-22-215041_800x480_scrot.png

And that's 28209 Packages Listed, if you're wondering ;)

Firstly, if you haven't been watching my exploits in Developer's Corner with my crazy extend overlay system stuff, you wont know what this Extend business is.
Basically, it's a loop back file formatted as ext2/ext3/reiserfs/your-favourite-filesystem, that's then mounted as normal - hence "loop back."
It's great for doing all sorts of little hacks like this, and as a rather nice way of keeping versioned backups of file systems should you be hacking away through the twilight hours, and bugger stuff up *cough* ;)

Some quick terminology as to what you're about to face.
We're doing a debootstrap. This is a funky thing that Debian has which allows you to install a full working base of Debian to a folder. Magic, isn't it?
We then do a chroot into this. This literally "CHanges ROOT" to another folder. This means that our normal root / changes from Angstrom to our Debian one. It's also handy for security reasons, should you want to lock people to a certain folder hierarchy.
It's a bit strange to get your head around if you come from a Windows only background, so I suggest some googling if you want to know more :)

Anyway, back to getting Debian on our favourite mini laptop.
If you just want to USE this, jump to the bottom of this post for the Quick Start stuff.. if you'd rather follow through the mind of a mad man, read on to build yours from scratch!
I highly advise you to use an extend file... as big as you can get away with, to be perfectly honest. The absolute smallest you'll be able to get away with is 256Mb, and you wont be installing much afterwards!
So grab the extendutils.pnd and two of the pre-formatted extend files here: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/
Unzip the extend files somewhere on your card ( careful, it will expand to the size it says! ) and stick the PND in your favourite place.
Call up Extend Root in the System Menu on XFCE, and select your Extend file ( this one can be quite small if you want. )
Go through the Zenity prompts, and when you get to the Terminal, check we have everything by typing: mount ... this should show you all the mounts, of which there should be a crap load of AUFS mounts all over the place.
Next we want to do the same but with a Home Extend ( this is the one you want to be as big as you can! )
Once the terminal pops up, type "mount" again, and you should see the extra /home entry.

Right, assuming all our AUFS binds are in place ( if not, reboot and try again.. I've noticed that uncleanly mounted PND files tie up a /dev/loop slot, and we need a few of them for the binding to work with a loop back file. ) we can get down to business: sudo opkg update && sudo opkg install dpkg
This will update the opkg cache and install dpkg.
** NOTE ** I don't know if this is just my hacky setup or not, but I found that after jumping from clean install to HotFix 2, opkg complained about the boost library list not existing. To fix this, you'll need to force an uninstall of boost and a reinstall of it: sudo opkg remove boost --force-depends && sudo opkg install boost --force-depends ... the install with force-depends is probably not necessary, but I did it anyway.

Once dpkg is installed, there's a few other things it needs... it doesn't seem to install cleanly for whatever reason so: sudo touch /var/dpkg/status && sudo touch /var/dpkg/available .. this'll stop it complaining these files don't exist.

Now we need to grab debootstrap: wget -c http://ftp.uk.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.10lenny1_all.deb ( or your favourite mirror )
We can't just do a sudo dpkg -i debootstrap_1.0.10lenny1_all.deb ... as much as that would've made things so much easier for us. Instead: sudo dpkg -x debootstrap_1.0.10lenny1_all.deb debootstrap
This extracts the contents to ./debootstrap.
sudo cp -R ./debootstrap/* /
Now we've just copied the contents to root ( effectively a forced install. )

Let's get our bootstrap going!
sudo debootstrap lenny pandebian
You could use sid, if you prefer.
This will take a while to do, so go make a sandwich.

Finished?
You have effectively installed Debian into a folder called "pandebian" in an extend file, congratulations!
So, what can we do with this?
sudo chroot pandebian /bin/bash
You're now in your Debian space...
apt-get update
apt-get install whatever-the-smeg-i-like

BUT HOLD UP! NOT SO FAST!

This install isn't finished yet!
exit

We need to bind some parts of our main system into our shell to be able to fully use it:
sudo mount -o bind /dev pandebian/dev
sudo mount -o bind /dev/pts pandebian/dev/pts
sudo mount -o bind /dev/shm pandebian/dev/shm
sudo mount -o bind /proc pandebian/proc
sudo mount -o bind /proc/bus/usb pandebian/proc/bus/usb
sudo mount -o bind /sys pandebian/sys
sudo mount -o bind /tmp pandebian/tmp

( Now there's some stuff for a script! )

Now let's go for it!
sudo chroot pandebian /bin/bash

For a test, let's install synaptic.
This is a good one as it'll pull down all manner of crap that we'll end up needing sooner or later.
sudo apt-get install synaptic

This is where you see that getting as big an Extend as you can pays off.. 253mb this is going to eat up! After downloading ~80mb! ( don't worry if your WiFi is flaky and it dies.. apt-get will resume from where it left off .. mine died in the middle of it, and I had to do the Disable/Enable WiFi trick for it to come back up. )
Suffice to say, this'll take a while.. so go make some food.. I suggest Cantonese Chicken and Egg Fried Noodles.
Once it's done, however, you do have an install of X, and enough bits and pieces of everything to get going. This is a bit superfluous as after all, you have X running already in Angstrom.. but one day you may actually be installing Debian on the NAND, now how cool would it be to just take your Extend file and go *splat* with everything you've installed and setup? :) So there's a bit of method in that madness!

Anyway, you've probably wined and dined, and synaptic's finished installing.. so let's run it: synaptic
Synaptic is great as it's a GUI method of package management on Debian... so you can point'n'click your installs :)

Should you be tired of messing with Debian (seriously?), you really should clean up the binds once you've exited the chroot jail:
exit
sudo umount pandebian/dev
sudo umount pandebian/dev/pts
sudo umount pandebian/dev/shm
sudo umount pandebian/proc
sudo umount pandebian/proc/bus/usb
sudo umount pandebian/sys
sudo umount pandebian/tmp

And we're done!
Simple :)

Now, here's one I made earlier! ... SURPRISE! You actually already have the tools to do so, they're in the ExtendUtils.pnd :)
My ExtendUtils has been updated to cope with Debian Extend files.. these are just standard Extend files but they have the above debootstrap done.
Calling Mount Debian Extend will create a mount point in /tmp, do all the bindings, then call up a Terminal and chroot straight in for you. UnMount Debian Extend will do what you think as well ( or it'll try to.. unmounting doesn't always play ball, so you may need to give it some loving - hit it with a stick! )
I also come bearing gifts of two Extend files to play with:
512mb Debian Lenny: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/debian-lenny.512MbExtend.zip
1gb Debian Sid: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/debian-sid.1GbExtend.zip
1gb Debian Sid with Synaptic: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/debian-sid-synaptic.1GbExtend.zip ( cause I'm nice, and it took absolutely AGES )
There is of course, nothing stopping you mounting these and "cp -R * /newExtend/" to a bigger one, or to an external Hard Drive, or gigantic USB Stick, or whichever :) Assuming it's a Linux friendly formatted partition, of course!

You may wonder why Lenny is only 512mb.. I only have 2Gig SD cards and I was doing both at the same time + my dev environment extend ( which is 512mb as well ) so I had no space left! As I said, nothing is stopping you from copying it over into a bigger Extend file, or to an actual Linux formatted partition of some description.

It's a bit fiddly, but you now have Debian running on your Pandora inside Angstrom.
You have full access to Debian's archives, with the added benefit of all the driver support from your standard Pandora install available ( may need to symlink some things, but least it's there! )
If you bugger something up in Debian, it's just as easy to delete the Extend file, and start again. Simple. Just how it should be :)

One important thing to note: by default, you're logged in as root.
Now, although you're in a chroot jail and shouldn't be able to cause much harm, it's still a good idea to add yourself as a user with the "adduser" command, as we do bind a lot of system critical areas from Angstrom into Debian.

Brownie points for the first lunatic to high jack the bootup process to load up their Debian Extend file and head into X that way, with whatever Desktop Environment they've grabbed and have the PowerVR demos running ( and documented it, of course! share the wealth and all that ;) ) Considering KDE4 seems to have an armel port, this could be interesting!

Anyway, this is just a start.. there's bound to be something I missed ( perhaps you need to symlink the omap3 driver stuff into Debian for it to pick it up, for instance ) but, I think it's a great start! and certainly something else to fiddle with :)

Quick Start.
You'll need this: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/extendutils.pnd
And This: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/debian-sid-synaptic.1GbExtend.zip
There'll be other debian extend files in the folder here: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev just pick what you want to start with.. I suggest one with synaptic pre-installed unless you're upto other stuff.

Extract that to an SD of at least 1Gb in size, call System->Mount Debian Extend and follow the prompts.
Welcome to your Debian System in an Extend :)
 
Holy shit. That's a lot to digest and understand, but I know one thing: This is awesome!

I don't quite get how this is Debian inside the Pandora? Can you explain that one for me? What advantages are there to just using dpkg within Angstrom?

I'm downloading all this now anyhow. :D
 
I didn't read your whole post... but this looks great :)

Remind me of debian running on the N800 !
I am pretty sure it's the same method beeing used (chroot and all)
 
It actually is Debian.. it's a full debootstrap.. it uses much of the same stuff you've already been abusing, just does a chroot jail and binds some of the important bits and pieces in for Debian to pick up on.

It's not quite virtualisation, basically it's "I'm moving my environment into this root filesystem rather than my current one" .. so you need to ensure that when you chroot into something, it's properly configured, else it just doesn't work. It was quite handy when 64bit Linux was first around, and you needed a 32bit chroot jail to run 32bit apps.

Why is this better than dpkg on Angstrom? you have aptitude to manage your dependencies and there's 28209 packages now ready and waiting for you to grab. That and, like the other Extends, if you mess it up, just delete the file and start again :)

Speaking of abuse...
2010-06-22-231027_800x480_scrot.png

Bit mad to control with the default control setup.. but that's why we can redefine stuff ;)

Oh and told you you'd like it SomeGuy ;)
 
This is totally crazy, and that's why I love it.

I raise a glass to you, fellow mad bastard!

You should put some small info in there about what chroot and debootstrap actually are, since I had to read up on it before you post made any sense ;)

Right, off to try this out.

Edit: I was just thinking, if you streamlined all of this into a snazzy interface and an extend with Ubuntu on it (mostly Debian right?) you would earn massive kudos round these parts. I think Paddy would have your babies for starters. B)

If that's possible, I think we should start customising an ARM Ubuntu to be Pandora friendly. I lot of people would love that. Could be the start of a new alternative distro?

If people want a bootable version off SD, we could just completely cheat by having the official firmware on there and using all of this in a bootup script! Like you say, we'd have all the drivers and whatnot. To make the file smaller, we could take each firmware version and strip out XFCE and various other stuff.
 
Well, I've a Ubuntu RootFS compiling away just now, so let's see what mess I make of that! ;)
For the most part though, it's essentially going to be exactly what you get here... there's still the issue of killing Angstrom's X and starting the chroot X ( that could be fun, haven't tried it yet.. I literally typed the guide up as I was doing it for the second time to ensure I got everything! ;) )

And oi, my crappy zenity-calling scripts not good enough for you? :p streamlined snazzy interface my arse, this is dodgy hacky stuff! ;)
Seriously though, it needs a bit more testing to ensure everything works.. I'm only assuming the drivers'll work as they did when I used to do 64/32bit chroot jails, but may need some symlink help.. however, as Abuse just kinda worked, that's quite encouraging!
 
Stuckie said:
Well, I've a Ubuntu RootFS compiling away just now, so let's see what mess I make of that! ;)
For the most part though, it's essentially going to be exactly what you get here... there's still the issue of killing Angstrom's X and starting the chroot X ( that could be fun, haven't tried it yet.. I literally typed the guide up as I was doing it for the second time to ensure I got everything! ;) )

And oi, my crappy zenity-calling scripts not good enough for you? :p streamlined snazzy interface my arse, this is dodgy hacky stuff! ;)
Seriously though, it needs a bit more testing to ensure everything works.. I'm only assuming the drivers'll work as they did when I used to do 64/32bit chroot jails, but may need some symlink help.. however, as Abuse just kinda worked, that's quite encouraging!

I meant for other people for whom Ubuntu means something. I'm quite happy to mess around in plain Debian myself!

When I say streamlined, I mean for non hackers... non technical Ubuntu users! Something like the interface for Wubi? Prfff, you know what I meant! ;)

Just waiting for the file to copy across to my SD at the moment...

What's on there by default? I'm gonna be manually doing the debs since the WIFI won't connect. Is the USB ethernet on the Pandora working yet? Well, you can bet that tommorow (when I connect to wifi elsewhere) I'll be firing up Apt/Synaptic like never before!
 
Last edited by a moderator:
And i am all for having babies right now ! yer i am clearing the 4gb sd for this right now ,can't wait to get my hands on some debs :p great work Stuckie.
 
SomeGuy99 said:
What's on there by default? I'm gonna be manually doing the debs since the WIFI won't connect. Is the USB ethernet on the Pandora working yet? Well, you can bet that tommorow (when I connect to wifi elsewhere) I'll be firing up Apt/Synaptic like never before!

Well depending on which one you downloaded.. either just the base Debian stuff, or enough to get Synaptic up and running.
Thought it'd be best to leave the package selection up to the users :)

Sucks about the Wifi, as you're still going to be in dependency hell tracking them all down :\
I haven't tried USB ethernet either to comment on it.

If wanted, I could do a 4Gb Extend with this Debian SID in it? means there's the 1Gb and the 4Gb one to start with :)
 
Last edited by a moderator:
Man! Apropos! Now we're cooking.

Can we add a link back to the host filesystem in /host maybe? That's how Wubi does it. Then we can access (for example) our original home folders. Same with the SD cards... I have some .deb files I'd like to attempt to install.

Can I just drop them in the debian folder?

Stuckie said:
SomeGuy99 said:
What's on there by default? I'm gonna be manually doing the debs since the WIFI won't connect. Is the USB ethernet on the Pandora working yet? Well, you can bet that tommorow (when I connect to wifi elsewhere) I'll be firing up Apt/Synaptic like never before!

Well depending on which one you downloaded.. either just the base Debian stuff, or enough to get Synaptic up and running.
Thought it'd be best to leave the package selection up to the users :)

Sucks about the Wifi, as you're still going to be in dependency hell tracking them all down :\
I haven't tried USB ethernet either to comment on it.

If wanted, I could do a 4Gb Extend with this Debian SID in it? means there's the 1Gb and the 4Gb one to start with :)

Well I've being doing the depedency tracking thing already for IPK and Deb files. It sucks, yes!

A 4gb extend would be smashing. Might as well go for broke. B)

It would be easier (save on bandwidth) if I copy the contents of this one into another 4GB extend. What's the procedure for that?
 
Last edited by a moderator:
Does my card need to be formatted in ext ? it's currently empty fat32 ,i don't have linux installed so could i format it in the pandora using gparted ? - is gparted in the angstrom repo come to think about it.
 
paddy said:
Does my card need to be formatted in ext ? it's currently empty fat32 ,i don't have linux installed so could i format it in the pandora using gparted ? - is gparted in the angstrom repo come to think about it.

No formatting needed. These are loopback files, and can exist on Fat32 etc!

Gparted isn't in the Angstrom repo... but you could always mount Debian and install it through Synaptic. See what I did there? B)
 
Last edited by a moderator:
Stuckie said:
No you don't, that's what these Extend files are for - they're full file systems wrapped in a file :)
You can collect them, like Pokemon! (or maybe not *cough*)

Ninja'd in my own thread...

The 4gb Extend with Debian sid and synaptic pre-installed is uploading now.

Like I said, it saves having to download it all again if I copy the existing one into a new extend. I don't know how though.

I had an idea for a frontend for all this, are you okay with me drawing/posting a mockup?

Gotta mount 'em all! Oh no wait... that sounds sick. :blink:
 
Last edited by a moderator:
Copying into a new extend is really easy:
mkdir mount1 mount2
sudo mount -o loop old.extend mount1
sudo mount -o loop new.extend mount2
sudo cp -R mount1/* mount2/
sudo umount mount1 mount2
rm -rf old.extend

Done :) This may be slow as treacle on the Pandora.. might want to do it offline on a desktop PC instead and copy the new extend over!
Feel free to mock up a front end if you like :) may take a while for me to get to actually doing it ( possibly this weekend ) but I agree it could be good, and might be able to replace the entire ExtendUtils suite I have.
 
I need a 2gb Extend with Debian sid and synaptic for my card (perfect size for me ,so i could do this if i download the 2gb extend and follow the instructions,im getting the 1gb with deb and syn to try first.


So grab the extendutils.pnd and two of the pre-formatted extend files -so i need two files the extend and the one with synaptics as well ?
 
That's only if you're following the guide completely from scratch.. otherwise, you only need the quick start stuff - extendutils and one of the debian extends.

I've a 2Gb one uploading as well.. should I head off to bed before notifying that it's done, it'll be in this folder structure: http://www.stuckiegamez.co.uk/apps/pandora/SimpleDev/
 
Back
Top