Wednesday, April 23, 2008

Kiwi - live USB image

There's a description Live USB stick on opensuse.org which I pretty much followed.

First I installed:

kiwi-desc-livesystem-1.62-25.1
kiwi-desc-usbboot-2.38-34.1
kiwi-2.38-34.1
kiwi-tools-2.38-34.1

I choose the option "downloading the most recent packages from the internet".

/usr/share/kiwi/image/usbboot/suse-10.3/config.xml

and added the repository:

<repository type="yast2" status="replaceable">
<source path="ftp://mirrors.kernel.org/opensuse/distribution/10.3/repo/oss"/>
</repository>
<repository type="yast2" status="replaceable">
<source path="ftp://mirrors.kernel.org/opensuse/distribution/10.3/repo/non-oss/"/>
</repository>

I didn't set the update repository in
/usr/share/kiwi/image/kwliveCD-suse-10.3/config.xml

When I set the update repository to
<repository type="rpm-md" status="replaceable">
<source path="http://download.opensuse.org/update/10.3/"/>
</repository>
kiwi exited with the following error:

opensuse103:~ # kiwi --prepare /usr/share/kiwi/image/kwliveCD-suse-10.3 --root /media/vmware/kiwi-tmp --add-profile KDE --logfile terminalApr-22 04:59:15 <1> : Setting log file to: terminal
Apr-22 04:59:15 <1> : Reading image description... failed
Apr-22 04:59:16 <3> : Scheme validation failed failed
Apr-22 04:59:16 <3> : Element image has extra content: text

Apr-22 04:59:16 <3> : KIWI exited with error(s) done
opensuse103:~ #

Instead I replaced the entry with the same I had put in: /usr/share/kiwi/image/usbboot/suse-10.3/config.xml

There's only one .checksum.md5 file. It is in /usr/share/kiwi/image/usbboot/suse-10.3/
Copy it and create a new one with:

cp .checksum.md5 .checksum.md5.old
md5sum config.xml > .checksum.md5

Cleanup is only necessary if kiwi was run before, there wasn't anything to do here.
For anyone who already created the two directories: kiwi-tmp and kiwi-image a removal is recommended if you are going to use the same path. Remove these two directories with
rm -rf /tmp/kiwi*

(I actually created them in a different directory, so instead of /tmp, the image was on my USB drive /media/usb-dvd/

Finally, after all these preparations I run:

kiwi --prepare /usr/share/kiwi/image/kwliveCD-suse-10.3 --root /media/usb-dvd/kiwi-tmp --add-profile KDE --logfile terminal

Kiwi initiates downloading and installing all these RPMs. Good thing that progress is shown on the right hand of the screen:

-> ftp://mirrors.kernel.org/opensuse/distribution/10.3/repo/oss/suse/i586/tpctl-4.17-131.i586.rpm
tpctl-4.17-131.i586.rpm ########################################################################### [ 83%]
->

And finally at the end:

Apr-22 05:35:38 <1> : KIWI exited successfully



Then I continued to create the compressed image and initrd out of kiwi-tmp.

mkdir /media/usb-dvd/kiwi-image
kiwi --type usb --create /media/usb-dvd/kiwi-tmp -d /media/usb-dvd/kiwi-image --logfile terminal


Now it was time to plug in my usbstick and unmounted it with:

umount /dev/sdd

There was no other partition on the drive. If there is so, then "mount" will show them.


To create the bootstick enter:

kiwi --bootstick /media/usb-dvd/kiwi-image/initrd-usbboot-suse-10.3.i686-2.1.1.splash.gz --bootstick-system /media/usb-dvd/kiwi-image/openSUSE-10.3.i686-2.5

Following messages appeared on the screen:

opensuse103:/media/usb-dvd # kiwi --bootstick kiwi-image/initrd-usbboot-suse-10.3.i686-2.1.1.splash.gz --bootstick-system kiwi-image/openSUSE-10.3.i686-2.5
Apr-22 05:14:50 <1> : Creating boot USB stick from: kiwi-image/initrd-usbboot-suse-10.3.i686-2.1.1.splash.gz...
Apr-22 05:14:50 <2> : Can't open log port: 9000 skipped
Apr-22 05:14:52 <1> : Creating initial boot structure done
Apr-22 05:14:54 <1> : Importing grub stages for stick boot done
Apr-22 05:14:57 <1> : Found following removable USB devices:
Apr-22 05:14:57 <1> : ---> 5B8110A091D0 at /dev/sdd
Apr-22 05:14:57 <1> : Your choice (enter device name):


Enter the device name output in the last but one line. In my case: /dev/sdd.

Apr-22 05:14:57 <1> : Your choice (enter device name): /dev/sdd

Kiwi partitioned the stick and dumped the image to the stick:

Apr-22 05:17:12 <1> : Creating partition table on: /dev/sdd done
Apr-22 05:17:26 <1> : Rereading partition table on: /dev/sdd done
Apr-22 05:17:30 <1> : Dumping initrd image to stick done
Apr-22 05:17:35 <1> : Dumping system image to stick
Apr-22 05:19:29 <1> : Installing grub on USB stick done
Apr-22 05:19:30 <1> : Removing HAL lock done
Apr-22 05:19:30 <1> : KIWI exited successfully

Kiwi created the following partitions:

/dev/sdd1 on /media/disk-2 type ext2 (rw,nosuid,nodev)
/dev/sdd3 on /media/disk-3 type ext2 (rw,nosuid,nodev)
/dev/sdd2 on /media/disk-4 type squashfs (rw,nosuid,nodev)

/dev/sdd2 is the compressed image, initrd and kernel.
/dev/sdd3 contains packages and stuff that doesn't fit into the 700+ MB initrd. It's read/writable so that thing that get written to the USB stick are put here.
/dev/sdd1 is the boot partition, including grub.

Boot a machine with the usbstick plugged in, don't forget to set the BIOS to boot from USB and you'll get a LIVE opensuse 10.3 on a USB stick.

No comments:

Post a Comment