Live USB stick
From openSUSE
This page explains how to create a bootable openSUSE 10.3 USB stick. Also known as a LiveUSB
Other than Ubuntu- and Fedora-type systems, the initrd on SUSE-type live CDs is not directly suitable for booting from a USB stick. The openSUSE system image creator, KIWI, can produce initrd files for Live USB media, however. These differ e.g., in the linuxrc script and in the supplied kernel modules.
USB live booting and customization are dealt with in the KIWI project. Thanks cyberorg for your help on #opensuse-kiwi on freenode.
Contents |
How to create a bootable openSUSE 10.3 USB stick from a running openSUSE system
This howto is intended to show you the fastest way to get a bootable openSUSE 10.3 live USB stick. It assumes that you do NOT have the openSUSE 10.3 DVD available. This is a first draft, so please contribute/correct.
Prerequisites
You need a large amount of free space on your hard disk. 5 GB should be on the safe side. Also, you need a fast Internet connection when using these instructions since all packages for the USB stick will be downloaded from the net.
Install kiwi
- Install openSUSE 10.3 on hard disk (I would love to get rid of this step. After all, I want a bootable USB stick so that I don't need a HD installation.)
(I'm working on getting rid of this step, Using vmxbuilder to boot the live cd in vmware and installing from there.)
- Using Yast > Software Repositories > Add > Specify URL.. create a new repository of this
- Install from repo above or one-click:
Create the tree from which the compressed 700 MB file will be mastered (="physical extend")
- You can create the usbstick with either a DVD for the distribution or by downloading the most recent packages from the internet.
- The method for creating with a DVD is best if you don't have broadband access combined with a flat rate or if you are not sure that you get finished in one run and be done with it. Download the iso image for the Version desired and mount it locally with:
mkdir /mnt/my-distro mount -o loop /path-to-iso/my-distribution.iso /mnt/my-distro
Skip the following modifications to config.xml files and go straight to Clean up.
- The preferred way to create the USB stick is with recent packages from the internet. To do this edit change the repositories from DVD by editing both the following config.xml files:
/usr/share/kiwi/image/usbboot/suse-10.3/config.xml /usr/share/kiwi/image/kwliveCD-suse-10.3/config.xml
- In each of the above config.xml files, delete only the DVD repository and set yast2 repositories for oss and non-oss with the following pattern (as you will download 500Mb-600Mb, you probably want to substitute your local mirror in the above source paths. You can find your local mirror here or here):
<repository type="yast2"> <source path="http://download.opensuse.org/distribution/10.3/repo/oss/"/> </repository> <repository type="yast2" status="replaceable"> <source path="http://download.opensuse.org/distribution/10.3/repo/non-oss/"/> </repository>
- In /usr/share/kiwi/image/kwliveCD-suse-10.3/config.xml you can also set the update repository to the update repository on your local mirror:
<repository type="rpm-md" status="replaceable"> <source path="http://download.opensuse.org/update/10.3/"/> </repository>
- Make sure you either update the .checksum.md5 files present in the respective directories to reflect the modifications, or else plainly delete them. Otherwise kiwi will run almost to the end only to tell you it couldn't verify the config files, which is very time wasting.
cp .checksum.md5 .checksum.md5.old md5sum config.xml > .checksum.md5
- Clean up
rm -rf /tmp/kiwi*
- Run (replace KDE with GNOME if you want GNOME)
kiwi --prepare /usr/share/kiwi/image/kwliveCD-suse-10.3 --root /tmp/kiwi-tmp --add-profile KDE --logfile terminal
- If you get
error: 'adaptec-firmware' matches no packages
then probably you haven't set up the non-oss repository as described above.
- If all goes well, you should see
KIWI exited successfully done
Create the compressed 700 MB file (="system image") and initrd (="usbboot image")
If you have already created the file system and only want to create initrd then jump over this section and use the Option below!
- Run
mkdir /tmp/kiwi-image kiwi --type usb --create /tmp/kiwi-tmp -d /tmp/kiwi-image --logfile terminal
(This creates the compressed filesystem at /tmp/openSUSE-10.3-read-only.i686-2.5, basically by calling mksquashfs /tmp/kiwi-tmp/, plus an initrd)
- Plug in your usbstick and unmount it with a command like the following:
umount /dev/sdb umount /dev/sdb1 umount /dev/sdb2
- We now make the usbstick (Note: do not specify --bootstick-device, it will ask for it):
kiwi --bootstick /tmp/kiwi-image/initrd-usbboot-suse-10.3.i686-2.1.1.splash.gz --bootstick-system /tmp/kiwi-image/openSUSE-10.3.i686-2.5
Make sure you promptly cancel automount requests or the process will terminate with an error. If you are familiar with operating from a root console (without a desktop) then the process will be faster and there will not be any automount requests to worry about.
Congratulations - if all goes well, you now have a bootable openSUSE 10.3 USB stick!
Optional: To create the initrd (="usbboot image") ONLY
This step is only needed if you want to create ONLY the intrd, without re-creating the 700 MB compressed filesystem.
- Run
kiwi --prepare /usr/share/kiwi/image/usbboot/suse-10.3 --root /tmp/kiwi-live --logfile terminal kiwi --create /tmp/kiwi-live/ -d /tmp/
(This builds the initrd for the USB stick and puts it to /tmp/initrd-usbboot-suse-10.3.i686-2.1.1.gz)
- Copy initrd, kernel, and 700 MB filesystem to the USB stick and make it bootable:
kiwi --bootstick /tmp/initrd-usbboot-suse-10.3.i686-2.1.1.splash.gz --bootstick-system /tmp/openSUSE-10.3-read-only.i686-2.5
Key learnings
Kiwi partitions the live USB stick (e.g., 1 GB sda) as follows:
- /dev/sda1 /media/disk ext2 rw,nosuid,nodev 0 0 (21.3MB primary type=83 bootable)
- /dev/sda2 /ro_branch squashfs ro 0 0 (708MB primary type=83)
- /dev/sda3 /rw_branch ext2 rw 0 0 (310MB primary type=83)
Note well that the main 700 MB compressed filesystem is not a file in a vfat partition, but rather it is a partition itself!
Also note that the stick is set up in a "persistent" way per default, so that changes are written back to the USB stick at /dev/sda3 which contains also packages and stuff that doesn't fit into the 700+ MB initrd.
Remaining questions (FAQ)
(Please add to the list)
- Additional hints on Configuration can be found at Xen project. The following command helps you to extract a list of installed rpms in the config.xml format:
rpm -qa --queryformat "\<package name=\"%{NAME}\"/\>\n" >rpms.txt
- How can I include the madwifi driver from http://madwifi.org/suse/10.3/i586/
You will have to download the driver rpm (i.e. madwifi-kmp-default-0.9.3.3_2.6.22.9_0.4-0.1.i586.rpm ) to a local directory and insert that as source (rpm-dir) in the config.xml file. Also you need to add the driver to the packages section.
<repository type="rpm-dir"> <source path="/my/madwifi/rpm/dir/"/> </repository>
<package name="madwifi-kmp-default"/>
- Why is xvkbd open? How do I get rid of it?
- How can I (manually) convert a downloaded Live CD ISO into a bootable USB stick (without having to have openSUSE installed and without using Kiwi)?
There's a howto at http://www.pendrivelinux.com/2008/03/28/usb-suse-flash-drive-install/
- Wow thanx the above howto is much easier than this tutorial. Makes me wanna link it at the top so people dont waist there time with all the above steps. :)
- Why is fvwm2 part of the 1CD distribution?
- How do I change GRUB to get e.g. German as the default language for both keyboard and system?
Simply change
<locale>en_US.UTF-8</locale>
in the config.xml to
<locale>de_DE.UTF8</locale>
Since changes you make later are persistent, you may as well change /etc/X11/xorg.conf
- How can I know how much r/w space I have left?
mount /dev/sda3 /mnt df umount /mnt
- How can "persistency" (r/w) be disabled or set to r/o?
- How can I build a 32-bit image on a 64-bit system and
- How do I make the first partition a FAT partition so the stick also can be used for general data trasnfer between machines independant of operating system
- How can I add NVIDIA and ATI binary drivers?
You need to add them in
/usr/share/kiwi/image/usbboot/suse-xx.x/config.xml
in the section
<drivers type="drivers"> <file name="drivers/nvidia/*"/> <file name="drivers/ati/*"/>
- How can I change screen resolution to 1024x768?
References
- How to convert SUSE-type Live CDs into bootable USB sticks (by Simon Peter)
- How to convert Ubuntu-type Live CDs into bootable USB sticks (by probono)
- How to convert the Fedora-type Live CDs into bootable USB sticks (by probono)


