The Altboot FAQ
coredump April 3rd, 2006
- What is altboot?
- And what can I do with it?
- Where do I find the latest version?
- So, how do I go about booting off SD or CF?
- How do I create my own loop-images?
- Can I create my own tar.gz rootfs for installation?
- What are the benefits and disadvantages of loop-files over direct installs?
- How do I create a real filesystem on my card?
- How can I use an already existing loop-image?
- So when I boot a loop-image, what happens to the rest of my free space on the SD / CF card?
- How can I boot from a NFS drive?
- Can I dual-boot between Cacko / $Some-other-distribution and OZ?
- But why is booting another kernel such a big deal for dual-boot?
- When I configure to boot off SD / CF, what happens when I remove the card?
- I am getting two altboot menus when booting off SD or CF / altboot is looping
- I am getting a lot of I/O errors when booting off SD or CF
What is altboot?
Altboot is a replacement for /sbin/init.sysvinit. It intercepts the normal booting sequence right after the kernel is booted. At this point (which I prefer to call runlevel “-1″), the (hard-coded) root partition is mounted ro and that’s it. There is only one process running: /sbin/init (which is altboot in this case). Intercepting at this early stage allows us to do all kinds of magic with the system. Like moving the rootfs to another device (like a SD or CF card, USB-Storage devices or even a network share), boot into another runlevel (ie: runlevel 2 for a boot w/o GUI) or pass custom INIT parameters. We can even replace the running kernel with another one by using the kexec tools.
And what can I do with it?
The most common usage of altboot is to move your normal rootfs (flash) somwhere else, like a SD or CF card. Altboot supports booting of loop-image files (a loop-image is a complete “partition” inside a single file. You mount it with the “-o loop” option and hence the name “loop-image”) and real “direct” installations off any supported media.
But the best thing of all is that you can have as many different loop-images on the same card as you like. You can then select the one you wish to use on boot-up.
Supported media: SD / MMC, CF, NFS and USB-Storage (kernel 2.4 on SL-Cxxxx only currently)
Where do I find the latest version?
The latest version of altboot can be obtained from oz.hentges.net. Please keep in mind that “latest” means “Developer Snapshot”. The latest stable realease will be made available in your distributions upgrade feed.
So, how do I go about booting off SD or CF?
In order to boot off SD or CF you’ll have to install a bootable filesystem on that media first. You can either use a loop-image (one file containing a complete installation) or install directly onto the card. Both ways are supported by altboot.
What are the benefits and disadvantages of loop-files over direct installs?
A loop-file is a single file containing a complete installation. So if you want to backup your OS, you simply copy that one file to a safe place and you are set. The disadvantage is that a loop-file always has a fixed size which is determined during creation of that file. Resizing an existing loop-file is possible but not covered by this FAQ.
How do I create my own loop-images?
Starting with OpenZaurus 3.5.4 this has become easier than you might think =). The fastest way to create your very own loop-image is to download a “tar.gz” rootfs from the “tarballs” (example link for Collie SL-5500) directory. As you may have guessed, the tar.gz file contains a complete installation with all the files you’d normally find in a flashable initrd.bin file. Copy this file onto your SD or CF card but do not rename it. The filename must end in “rootfs.tar.gz” or altboot won’t recognize it.
Once the file is in place reboot your PDA. Right after the kernel has loaded, altboot will show a timeout, waiting 4 seconds for user input. Activate altboots menu within 4 seconds by pressing any key and select “Install RootFS from tar.gz” from the Advanced menu. Now follow the instructions. You may install directly onto the card or use a loop-image. If you go for a loop-image you should choose a size greater than 100Mb.
Please keep in mind that you can create multiple loop-images on the same card but you can create (obviously) only one direct install per media. Also, backing up a single loop-image containing your whole OS is a lot easier than copying hundres of files from a direct install (and it’s way, way, waaayyyy less error-prone!)
After the installation has finished, select “Boot from SD” or “Boot from CF” from the altboot menu.
Can I create my own tar.gz rootfs for installation?
Well, this is really beyond the scope of this FAQ, but yes, you can. The tar.gz only contains a complete installation (the complete content of /), no magic inolved. A few things to remember:
- Do not copy /tmp, /proc, /var, /sys and /mnt but create empty directories instead
- Populate the content of /mnt manually, the other folder should stay empty
- Delete /etc/pointercal and /home/* from the image to get the configration wizzard on first-boot
How do I create a real filesystem on my card?
As creating a loop-image and creating a real installation is an almost identical process, please see How do I create my own loop-images? for instructions.
How can I use an already existing loop-image?
- Create a new directory called “boot-images” on your CF or SD card.
- Rename your loop-image so that the filename ends in “-rootfs.bin”
- Copy the renamed loop-image into the boot-images directory (example: /media/card/boot-images/opie-image-rootfs.bin)
- Reboot your Z and select “Boot from SD” or “Boot from CF” from the altboot menu
So when I boot a loop-image, what happens to the rest of my free space on the SD / CF card?
Your SD / CF card will be available from /media/card or /media/cf like usual.
How can I boot from a NFS drive?
First thing is to setup your NFS server to export a folder to your Z. Next you’ll have edit your ROM’s /etc/fstab and configure the nfs drive. A sample entry of /etc/fstab looks like this:
mhcln01:/oe-hentges/OpenEmbedded/tmp/rootfs /media/nfs/oe-hentges nfs defaults,noauto 0 0
You can enter multiple NFS shares, altboot will let you choose which one you want to use during boot.
Altboot handles the NFS folder just like any other media. So to boot a loop-image from that folder it has to be placed into a subfolder called “boot-images” (in this example that would be /media/nfs/boot-images).
Can I dual-boot between Cacko / $Some-other-distribution and OZ?
Please keep in mind that while altboot does enable you to use multiple root partitions / installations it does (currently) not allow you to boot another kernel. To load a different kernel than the one flashed, the kexec tools are required. Currently this is only possible with kernel 2.6 so your device must support this kernel.
Also, since I am coding altboot on an Akita / SL-C1000 (on which kernel 2.6 makes the flash unreadable for kernel 2.4 without reflashing - nope I am not kidding) kexec has not been implemented in altboot, yet. That shouldn’t be too difficult tho.
But why is booting another kernel such a big deal for dual-boot?
Because each and every distribution out there requires you to run the exact same kernel, including commandline options, configuration and exact same version as the kernel it was shipped with. You simply can’t run a kernel 2.4 based OS with a kernel 2.6 and vice-versa.
Trust me when I say: It won’t work.
When I configure to boot off SD / CF, what happens when I remove the card?
Your Z will probably cry about a missing loop-image (or direct install) since your last setting (the SD or CF card) is remembered and booted automatically. During boot activate the menu and select [1] normal boot to boot from your default root partition (usually from flash)
I am getting two altboot menus when booting off SD or CF / altboot is looping
The second altboot prompt is coming from the installation on your SD / CF card. Do not open the second altboot prompt, and if you do, select [1] for Normal Boot. Do not try to use any other options (booting into init=/bin/sh works tho)
I am getting a lot of I/O errors when booting off SD or CF
Usually the media is at fault here. Either your SD or CF card has a broken filesystem, is about to die, or doesn’t like to be formatted with ext2. Try the following as a last resort:
- Zero out the media (dd if=/dev/zero of=$devicefile-of-SD-or-CF-card )
- Create a new ext2 filesystem (mkfs.ext2 -m0 $devicefile-of-SD-or-CF-card )
- Reinstall and check if the errors are gone
- If you are still getting the error messages, format the card with VFAT and install into a loop-file.
- As a last resort buy another SD / CF card
Hello there, after installing successfully a “real filesystem” from
http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4/images/collie/tarballs/gpe-image-3.5.4-collie.rootfs.tar.gz
on a Zaurus SL5500, I get the following odd message after issuing “ipkg update” on the system booted from my sd card (after fixing the broken resolv.conf file):
root@collie:~# /media/cf/ipkg update
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4//feed/base/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.2RcZ5Z/base.gz: No such file or directory
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4/feed/gpe/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.V9nvyJ/gpe.gz: No such file or directory
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4//feed/machine/collie/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.AKEHyM/machine.gz: No such file or directory
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4//feed/upgrades/machine/collie/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.2jGO61/machine-upgrades.gz: No such file or directory
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4//feed/upgrades/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.oSohdx/upgrades.gz: No such file or directory
Downloading http://ewi546.ewi.utwente.nl/mirror/www.openzaurus.org/official/unstable/3.5.4/feed/x11/Packages.gz
file_move: ERROR: failed to rename /tmp/ipkg-Sq3DSr/Packages.gz to /tmp/ipkg.AD60Av/x11.gz: No such file or directory
An error ocurred, return value: 6.
The directory /tmp/ipkg-Sq3DSr does not exist. Downloading the files manually by wget works, and I didn’t have any problems to use ipkg update and ipkg upgrade when booting GPE 3.5.4 from the Zaurus ROM.
Do you have any suggestions?
Thanks, Ulf
I dunno what’s wrong there. ipkg update / upgrade works fine via NFS boot here. Maybe “strace’ing” ipkg could bring some insights.
altboot on tosa, v1.0.6-rc1. Creating an gpe-loopfile and booting seems to be ok. But after a while (and aftr installing filemanager and abiword) altboot is not able to boot with the message. “mkdir -p /media/image/media/ROM failed” - what is happening?
sebastian: Please bzip2 the loop-image and send it to oe (AT) hentges (DOT) net. Also make sure there’s no personal stuff in there ;)
This had me stumped, so I’ll share to save anyone else the pain.
Copy the *.rootfs.tar.gz file to the ROOT of the SD card, I initially had it in boot-images folder
Perhaps I’m just a bit simple ;-)
I have a Zaurus SL-5500, a 128 MB Kingston Compact Flash card, and a 512 MB SanDisk SD card.
I can successfully install OZ on the Zaurus directly using the CF card, an initrd.bin, and a zImage file.
I can also use altboot and a downloaded .tar.gz file to make the Zaurus boot from the CF card.
However, I cannot get it to boot from the SD card.
This is what I see:
Creating [collie-sd-rootfs.bin] (122Mb) on [/media/card]
Please wait…
122+0 records in
122+0 records out
Creating an ext2 filesystem on collie-sd-rootfs.bin…done
Mounting loopfile…ok
Installing rootfs, please wait…ok
Syncing drives…done
losetup: ioctl: LOOP_CLR_FD: No such device or address
Press to bring up the altboot menu
altboot v1.0.5
[1] Normal Boot
[2] Don’t launch GUI
[3] Boot SD card
[4] Boot CF card
[5] Advanced
Please choose one of the above [1]: 3
/sbin/init.altboot: 9: cannot create /etc/altboot.conf: No space left on device
Mounting rootfs rw…ok
Note: /proc already mounted
Generating device files…ok
Note: /media/card is already mounted
Note: No INIT [/sbin/init.sysvinit] found on target
Using [collie-sd-rootfs.bin]
Setting up lookback (/dev/loop0) for collie-sd-rootfs.bin
Pivoting root…Success
mount: /proc/mounts: No such file or directory
Calling INIT
exec: 394: /usr/sbin/chroot: not found
I found that with no SD card inserted, the “Install RootFS..” script fails. I only have a CF card. I commented the line in /etc/altboot-menu/Advanced/70-Install… that tries to mount the SD card and the process was able to continue.
OZ 3.5.4 , SL-5500
awesome work, altboot is really really userfriendly!
just one question: does it/will it support also booting from the microdrive?
If you have more than one file with “rootfs” in the name in the root directory of your cards, you will get an “ERROR no rootfs.tar.gz found” message. Make sure you have exactly one rootfs.tar.gz file for altboot to find. Put any other files with “rootfs” in the name in a seperate directory until you are ready to install them.
Configuration: Collie/SL-5500 and OZ 3.5.4, with SanDisk 512Mb
I was/am suffering from the same symptom as in FAQ #16.
After booting from SD-card I tried to shutdown the Z from the opie gui and it would hang after a little while. Then I’d switch it off with the “Battery-switch” and reboot it. Once the boot loader was done, every file it tries to read from my SD card gives an I/O-error.
When switching to terminal 1 and running reboot (instead of gui-shutdown), you’ll see that the maintenance prompt comes up, and ask for “root password for maintainance or CTRL-D for normale startup”. The shutdown process won’t continue until this prompt is cleared.
Does anyone know how to remove this prompt?
It shows up just after stopping SD Services, so I assume it has some thing to do with unmounting the SD card or pivoting the root back to internal memory.
I’m having difficulty installing the altboot ipk.
I’m attempting installation on a Sharp 3.13 ROM. (My right gut is screaming at me that this file probably won’t work in this environment, but I can barely hear it over my own screams about my just-dislocated ankle. Grr.)
I’m getting the error msg that the file is not in gzip format.
I’m getting the same error whether I use the CF or SD.
Thoughts?
I’m running the sl-5500 and a DLink dcf-660w wifi CF card.
The loop image install worked fine and everything is ‘almost’ peachy. The wifi card works when I boot directly into the the ROM but if I boot off the sd card into the loop image then I get no wifi.
After having this problem for a while, it did work once but I can’t see that I did anything significantly different, then after the next reboot it wouldn’t work again.
OZ shows a card inserted message correctly, but I get nothing useful from ifconfig or iwconfig.
Any ideas would be greatly appreciated..
I think some of the problems people are having with I/O errors could be an indication of the SD card not being properly unmounted.
Let me suggest two tips:
Before you get started, go into the altboot configuration file and select the item that says that it will check the file system before each boot. (You might have to have e2fsprogs-e2fsck installed on ROM for this to work.)
After you first create the loop image, don’t try to boot it immediately, instead select ‘1′ boot as normal, then unmount the SD card and reboot and THEN try ‘3′ boot from sd.
I have exactly the same problem described in comment 10–After installing opie as a loop filesystem (opie-image-3.5.4-collie.rootfs.tar.gz) on my SD card, everything ran fine the first time, then froze up during the first shutdown, and would no longer boot from SD. I’ll post a solution if I can find one..
How do I go about installing altboot? I copy it to a CF card, but it doesnt come up like other ipk install files. I dont see any specific instructions for setting and configuring this.
re: comment 16
Did you try something like “ipkg install altboot*.ipk” ?
I have installed altboot and altboot.conf. /sbin/init is mow a link to altboot. I have a ….rootfs.tar.gz in the root of my SD card. I do not get any prompt at start up asking me to make a chose for what to boot. This is a 5600 with OZ 3.5.4.2.