Rootserver Sponsor

webtropia"

Donations

Please support your operating system's further development:

donate"

News

Blog

Blog: Booting aptosid

Contributed by bfree on Jul 18, 2011 - 03:50 PM

When aptosid is released, a new set of iso files hit the mirrors making available the latest entry point to the rolling aptosid cycle. The first step is to boot up the system shipped in those iso files and there are numerous ways to do this. I am going to run through the main options with a brief explanation of why and how you might want to use each method. Much of this is covered in the aptosid manual. Some information is new though and not yet covered there while other sections are a more unusual and may never be covered there.

Optical Media

The first and most obvious way to boot the iso is simply to burn it to optical media. You should take care to select to burn it with DAO and at the slowest speed possible to ensure a reliable disk, having first checked that the iso file you downloaded is correct by verifying the checksum.

If you boot the optical media on a computer with a traditional bios, you should be greeted with the graphical gfxboot theme which is supplied on top of isolinux. From this menu you can select your preferred language which will automatically select the default keyboard layout and timezone for the languages main country and captial city. Should you need to you can also choose a keyboard or timezone which will be used instead of the default for the language you have selected. There are also menu options to let you choose some other boot options like toram or md5sum or firmware.

If you boot the same media on a computer which tries EFI booting first then you will be greeted by a simple text grub2 menu. If you want to install aptosid so that it will boot using EFI, you need to boot the live media by EFI and seeing this grub2 menu lets you know you are doing so. The grub2 menu is much simpler then the graphical gfxboot menu, but it does support the same range of languages, keyboards and timezones via the "Localisation" menu.

No matter what method you use to boot, you can specify the language, keyboard and timezone manually by adjusting the kernel command line (which should already include "boot=fll"). For example, I could choose to alter mine to say "lang=en_GB keytable=ie tz=Europe/Dublin" if I wanted to use the en_GB language but with my local keyboard and timezone settings. In fact I simply enter "lang=en_IE" which uses the en_IE language instead and gives me the correct keyboard and timezone without any extra messing. The system knows about a lot more "languages" (really locales) than just those listed in the boot menus, such as a wide range of es_* for latin america and if your language doesn't work as should be expected for your locale I'm sure we can fix it for the next release if you let us know.

isohybrid

The iso files aptosid releases are post-processed with the isohybrid tool. What this does is allow you to raw write the iso image onto a disk to make that disk bootable. Unfortunately this type of booting will only work with traditional BIOS systems and NOT with EFI. Preparing a usb stick this way is as easy as: cat aptosid.iso > /dev/sdX

When you boot a stick prepared this way (on a BIOS system) you will be presented with the same graphical gfxboot menu as is used when booting from optical media. The only difference is that you should notice that the "Source" menu at the bottom of the screen will default to "Hard Disk" instead of CD/DVD. This means that the system will be booted with "fromhd" as an argument on the kernel command line.

fll-iso2usb

aptosid includes a usb stick installer which will setup a stick to boot with grub. As long as you can get into an aptosid system (live or installed) to run this tool it is the easiest way to make a full featured bootable aptosid stick.

syslinux

If you want to boot using EFI without burning optical media, then you need a vfat partition containing a portable EFI bootloader (/efi/boot/bootx64.efi). The aptosid amd64 isos include such a file and a grub configuration which it can load. To prepare a stick to boot this way, simply copy the contents of the aptosid iso to the root of a vfat formatted usb stick. You should also mark the partition as bootable using a disk partitioning tool.

Of course simply copying the files onto a vfat usb stick will not let you boot it on a traditional bios system, however it is quite easy to enable this using syslinux and install-mbr. All you need to do is run (without the stick being mounted):

syslinux -i -d /boot/isolinux /dev/sdXN
install-mbr /dev/sdX
A stick prepared this way will boot both by EFI to the plain grub2 menu and by traditional bios to the graphical gfxboot menu.

One of the advantages of having a stick created this way, as oppossed to a raw stick created thanks to isohybrid, is that you can edit the boot files on the stick to add your preferred options automatically. For traditional BIOS systems you can edit the /boot/isolinux/syslinux.cfg file and/or the /boot/isolinux/gfxboot.cfg file. For EFI systems you can edit the /boot/grub/x86_64-efi/grub.cfg file.

Persistence

As the stick is writable, you can also enable persistence and/or add firmware to the stick. For persistence you need to create a file which contains an ext filesystem which can be loop mounted. You can do this with a couple of commands like (to create a 512MiB persistence file with your stick mounted as /your/stick):

dd if=/dev/zero of=/your/stick/aptosid/aptosid-rw bs=1M count=512
mkfs.ext2 /your/stick/aptosid/aptosid-rw
tune2fs -c 0 /your/stick/aptosid/aptosid-rw
Now you can select persistence at boot time either from the graphical menu or manually by adding "persist" to the kernel command line. If you want to enable it by default you can edit your boot configuration files as described above.

Firmware

For firmware, you simply place the data you want to add to the live systems /lib/firmware in a directory called /aptosid/firmware on your stick. You can enable this at boot time by selecting Yes from the graphical "Driver" menu or manually by adding "firmware" to the kernel command line. Again if you want to enable it by default you can edit your boot configuration files as described above.

Both persist and firmware can use files placed in different locations on the disk, for example if the file for persistence is in the root of the stick and called persist.img you can simply use "persist=/persist.img" and likewise for firmware in a directory named fw you could use "firmware=/fw".

extlinux

Booting with EFI means you must use a vfat formatted partition. If you plan to use persistence and do not plan on booting using EFI, then it is nicer to use an ext filesystem rather than vfat, as it means you do not have to set a limit on the size of your persistent data when you create the stick, it will be stored in a normal directory on the stick and can use up as much or as little space as you want.

To make a ext device bootable with extlinux you again start by copying the contents of the iso to the root of the stick. If you are using aptosid to prepare this device, then you will need to use apt-get to install extlinux now. Then with the device mounted on /your/stick run the command:

cp /your/stick/boot/isolinux/syslinux.cfg /your/stick/boot/isolinux/extlinux.conf
extlinux -i /your/stick/boot/isolinux
install-mbr /dev/sdX
Again you should mark the partition as bootable using a partitioning tool.

This stick will now boot on normal BIOS systems with the same graphical gfxboot menu. You can edit the boot configuration files or add firmware just like with the syslinux stick described above. There is no need to prepare anything to use persistence, you just need to provide "persist" on the command line. If you want to have multiple persistent setups on the one stick (or just store them in a specific location) then you can specify the path to the directory on the stick to use for the data as part of the persist command, so if you wanted to put them in a directory called "mine" you would add "persist=/mine" to the boot command line.

pxelinux

The final tool in the syslinux family is pxelinux, which allows network booting. I've written about this before so I'll just point those interested to the original document.

grub2

Another alternative if you are already using grub (partitcularly on aptosid) is to use the grub2-fll-fromiso package from aptosid. To use this simply install the package, edit /etc/default/grub2-fll-fromiso, to point it to your iso files and add any preferred boot options, and finally run update-grub. This way you can simply throw iso files onto a drive, update-grub and boot them from your existing grub bootloader without having to copy any files.

If you want to manually setup aptosid to boot with grub instead of a member of the syslinux family of bootloaders then you can use the grub.cfg files inside the iso as a basis for setting things up. There are two different grub.cfg files in the iso (not counting those embedded in the efi bootloaders), one for normal bios systems (/boot/grub/grub.cfg) and one for efi (/boot/grub/x86_64-efi/grub.cfg).

EFI

There is one more option for EFI systems, using the grub2 EFI program from the iso directly. If you have an existing EFI booting system with a vfat formatted EFI System Partition, then you could create a directory in this partition under it's EFI directory and copy the /efi/boot/bootx64.efi file from the iso to it. At this point hopefully you will be able to use an EFI shell or boot menu from your motherboard to select to boot this file.

For this file to work, you will need a copy of the /boot/grub/x86_64-efi/ directory on a drive as the EFI program will look for this directory and use it to load it's grub configuration and further modules. There is a file in this directory on the iso which reflects the uuid of the iso and so the EFI program will only use the directory which corresponds to the original iso it came from and not try to access another systems /boot/grub/x86_64-efi.

fromiso

Apart from the grub2-fll-fromiso mentioned above the other options all extract the contents of the iso to the target device. If you want to keep the actual original iso on the device instead then you only need the /boot partition (and /efi if you want it to be EFI bootable) as long as you add the name of the iso on the stick into the boot options via the fromiso option. If your iso is on the root of the stick named a.iso then simply "fromiso=/a.iso" is all you need.

Conclusion

As always, "there is more then one way to do it". The purpose of this piece was to help explain to those who are trying to figure out how they can boot aptosid on their own hardware the options available. For most cases burning an optical disk or creating an isohybrid stick is the sanest and easiest approach. For EFI where you can't use an optical disk then simply copying the iso contents to a vfat formatted stick is the quick approach. If you can't run the aptosid usb installer tool or if you want the graphical boot menu tweaked to your own liking (and perhaps with firmware or persistence) or if you want a device that can boot with BIOS and EFI systems, then syslinux or extlinux can help you out. Finally if you need to netboot that should be covered by pxelinux.

Notes

EFI

Booting

Only the amd64 editions of aptosid support booting with EFI. The testing has been extremely limited thanks to a lack of EFI hardware amongst the aptosid developers. It is unlikely that it will work with Apple hardware as it uses a non-standard EFI.

Installing

The GUI for the installer has not been updated but if your install meets all the following conditions:

  1. Booted using efi (you will see a plain grub menu when you boot the live media)
  2. Have a vfat formatted EFI system partition on a GPT disk (type EF00 in gdisk)
  3. Are not installing to a usb disk
then your bootloader will be an efi program (grub2) which will be installed to /efi/aptosid in the EFI system partition and your EFI system partition will be mounted at /boot/efi in the installed system.

Unetbootin

I briefly looked at unetbootin the other night. It doesn't work if you just provide it with an aptosid iso. The problem is that it uses syslinux but doesn't pick up the graphical boot menu which automatically detects if fromhd is needed to boot (and usually adds the "quiet" boot command line option). I think a stick made with it would work if you edited it's syslinux.cfg to add "fromhd quiet" after "boot=fll" however it will not be as nice as if you can follow the simple syslinux instructions above.

Thanks

I have to take this chance to thank the grub and syslinux developers and the Debian developers who package them for sid, without whose superb work the above piece would have been a lot shorter and with a lot less useful options.

Comments

Comments on this post can be made in this thread in the aptosid forum.