Differences
This shows you the differences between two versions of the page.
— | system_rescue_cd_xen [2016/07/14 23:49] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== System Rescue CD Xen ====== | ||
+ | * [[Xen]] | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | Booting into a livecd using Xen as a para-virtualized guest is impossible with just the ISO alone. Xen does provide CD support, but a kernel is still required to boot into an OS. That's accomplished by extracting the kernel from the ISO first, and then into the image. | ||
+ | |||
+ | In the examples below, here's the filesystem structure I use in this guide: | ||
+ | |||
+ | * ''/ | ||
+ | * ''/ | ||
+ | * ''/ | ||
+ | * ''/ | ||
+ | |||
+ | Another consideration is that I only cover the amd64 kernel here. | ||
+ | |||
+ | Before anything else, get the kernel and initrd that the live CD uses. Mount the ISO as a loop device, and read-only: | ||
+ | |||
+ | < | ||
+ | mkdir /mnt/iso | ||
+ | mount -o loop,ro systemrescuecd-x86-4.8.0.iso /mnt/iso | ||
+ | cp / | ||
+ | </ | ||
+ | |||
+ | That's all that's needed from the ISO here, so it can be unmounted. | ||
+ | |||
+ | < | ||
+ | umount /mnt/iso | ||
+ | </ | ||
+ | |||
+ | Next, you will need to boot into a SystemRescueCd ISO somewhere else, so that you can go through the build process of [[http:// | ||
+ | |||
+ | Boot into the livecd, and mount a drive at ''/ | ||
+ | |||
+ | < | ||
+ | mount /dev/sdaX /mnt/custom | ||
+ | </ | ||
+ | |||
+ | On the ISO, there is a file named '' | ||
+ | |||
+ | Fortunately, | ||
+ | |||
+ | < | ||
+ | sysresccd-custom extract | ||
+ | </ | ||
+ | |||
+ | When that's done, there are only two files that will need to be modified on our custom filesystem. | ||
+ | |||
+ | Edit ''/ | ||
+ | |||
+ | < | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | The second file to be modified is ''/ | ||
+ | |||
+ | < | ||
+ | hvc0 | ||
+ | </ | ||
+ | |||
+ | That's it for all the changes! | ||
+ | |||
+ | Now, build your new customized '' | ||
+ | |||
+ | < | ||
+ | sysresccd-custom squashfs | ||
+ | </ | ||
+ | |||
+ | And finally, the complete ISO (with a custom volume name): | ||
+ | |||
+ | < | ||
+ | sysresccd-custom isogen beandog | ||
+ | </ | ||
+ | |||
+ | Your final ISO will be found in ''/ | ||
+ | |||
+ | That solves the problem of creating a Xen-guest-friendly ISO, but we still need to create a configuration file for Xen to use. | ||
+ | |||
+ | We'll walk through the settings. | ||
+ | |||
+ | When booting a guest, there are two options -- either use a bootloader such as '' | ||
+ | |||
+ | Here's the start of ''/ | ||
+ | |||
+ | < | ||
+ | name = ' | ||
+ | kernel = '/ | ||
+ | ramdisk = '/ | ||
+ | </ | ||
+ | |||
+ | The Xen guest emulates a CD drive, and we attach the ISO to the block device that it would have in it. You can specify the emulated device name. In this case, I'm using '' | ||
+ | |||
+ | < | ||
+ | disk = [' | ||
+ | </ | ||
+ | |||
+ | If you're adding other drives to access from the CD (which you most likely are), then you'll need to tell the config to boot from the CD drive first: | ||
+ | |||
+ | < | ||
+ | boot = ' | ||
+ | </ | ||
+ | |||
+ | Booting off of that will now get you a console on a Xen guest with a login prompt. SystemRescueCd will scramble the root password by default, so you cannot log in as user root directly from the console. We can work around that by passing kernel parameters to the kernel that will then be processed by the OS, and allow you to log in with that user. | ||
+ | |||
+ | There' | ||
+ | |||
+ | < | ||
+ | extra = ' | ||
+ | </ | ||
+ | |||
+ | Boot into the ISO, and you'll now be good to go! | ||
+ | |||
+ | < | ||
+ | xl create / | ||
+ | </ | ||
+ | |||
+ | From the kernel parameters earlier, one way you can make your life simpler is by having the OS send a DHCP request to get on the network. Just add '' | ||
+ | |||
+ | As a final note, here's an example working Xen guest configuration file that I use. | ||
+ | |||
+ | < | ||
+ | name = ' | ||
+ | kernel | ||
+ | ramdisk = '/ | ||
+ | extra = ' | ||
+ | disk = [' | ||
+ | boot = ' | ||
+ | memory | ||
+ | vcpus = 1 | ||
+ | vif = [' | ||
+ | </ |