{"id":51,"date":"2010-05-31T08:16:00","date_gmt":"2010-05-30T22:16:00","guid":{"rendered":"https:\/\/www.serenux.com\/?p=51"},"modified":"2021-01-14T08:21:40","modified_gmt":"2021-01-13T22:21:40","slug":"howto-get-an-ubuntu-live-cd-to-boot-off-a-pxe-server","status":"publish","type":"post","link":"https:\/\/www.serenux.com\/index.php\/2010\/05\/31\/howto-get-an-ubuntu-live-cd-to-boot-off-a-pxe-server\/","title":{"rendered":"HowTo: Get an Ubuntu Live CD to boot off a PXE server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Following my article about&nbsp;<a href=\"https:\/\/web.archive.org\/web\/20150317040032\/http:\/\/www.serenux.com\/2010\/05\/howto-setup-your-own-pxe-boot-server-using-ubuntu-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">creating your own PXE network boot server<\/a>, here is the first practical use you can put it to \u2013 taking the Ubuntu Live CD and turning it into a network-bootable version!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Network booting the Live CD has obvious advantages \u2013 aside from booting faster than CD (especially on a gigabit network), it is indispensable as an emergency boot medium in a workplace environment, especially for broken Windows systems, and allows for Ubuntu effortless installations on netbook PC\u2019s that don\u2019t have optical drives and saves you having to have a USB stick handy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Pre-requisites<\/strong><\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>You need a working Linux PXE boot server. Doesn\u2019t have to be Ubuntu, but it needs to be Linux. You cannot use a Windows PXE server.<\/li><li>An Ubuntu 10.04 Live CD ISO or physical CD. Can be the 32-bit or 64-bit ISO, but you can also setup both of them at once!<\/li><li>At least 700MB of drive space on your PXE server, more if you want to have more than one CD available.<\/li><li>This tutorial was put together using Ubuntu Server 10.04 Lucid Lynx, but should work with all future releases and older versions to at least Ubuntu Server 8.04 Hardy Heron.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>Getting it together<\/strong><\/em><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Login to your PXE server and mount the CD or ISO image (in this example we are copying the 32-bit disc). Assuming the CD is mounted at \/media\/cdrom, copy the CD\u2019s files to your server as follows:<br><br><code>$ sudo mkdir -p \/srv\/tftp\/ubuntu-livecd-boot\/i386<br>$ sudo mkdir -p \/srv\/ubuntu-livecd\/i386<br>$ sudo cp -av \/media\/cdrom\/* \/srv\/ubuntu-livecd\/i386<br>$ sudo cp -av \/media\/cdrom\/.disk \/srv\/ubuntu-livecd\/i386<br>$ sudo cp -av \/media\/cdrom\/casper\/initrd.lz \/srv\/tftp\/ubuntu-livecd-boot\/i386<br>$ sudo cp -av \/media\/cdrom\/casper\/vmlinuz \/srv\/tftp\/ubuntu-livecd-boot\/i386<\/code><\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\"><li>(if you want to setup the 64-bit disc, then replace all instances of \u201ci386\u2033 with \u201camd64\u2033, or you can setup both architectures by setting up both directories)<br><\/li><li>Make sure the permissions of the files to be loaded by TFTP are correct:<br><br><code>$ sudo chmod 777 -R \/srv\/tftp<\/code><br><\/li><li>The astute of you will have noticed that we have copied the Ubuntu CD outside of the TFTP directory and that we have made a separate copy of only two of the disc\u2019s files inside the TFTP directory. Why is this? Well, the\u00a0<em>vmlinuz<\/em>\u00a0and\u00a0<em>initrd.lz<\/em>\u00a0files are the only files that TFTP will need to download to get started with the boot process. After that, we will use NFS to deliver the rest of the Live CD, so let\u2019s set that up:<br><br><code>$ sudo apt-get install nfs-kernel-server<\/code><br><br>Note: I should point out that the files that are copied to the NFS share do not have to be on the PXE server. The NFS server can be any box as NFS is not related to PXE at all.<br><\/li><li>Once that is installed, we need to define an NFS share. This is done in the NFS exports file, so let\u2019s get that into a text editor:<br><br><code>$ sudo nano \/etc\/exports<\/code><br><\/li><li>Add the following line to the bottom of the file:<br><br><code># Ubuntu Live CD files for PXE booting<br>\/srv\/ubuntu-livecd\/i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *(ro,async,no_root_squash,no_subtree_check)<\/code><br><br>\u2026if you are setting up the 64-bit version, replace \u201ci386\u2033 with \u201camd64\u2033, or if setting up both architectures, list it as follows:<br><br><code># Ubuntu Live CD files for PXE booting<br>\/srv\/ubuntu-livecd\/i386\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 *(ro,async,no_root_squash,no_subtree_check)<br>\/srv\/ubuntu-livecd\/amd64 \u00a0\u00a0\u00a0\u00a0\u00a0 *(ro,async,no_root_squash,no_subtree_check)<\/code><br><br>A breakdown of the parameters on the right is as follows:<ul><li>The asterisk means \u201cshare with everyone on this network, regardless of who they are\u201d.<\/li><li>The \u201cro\u201d parameter means to share the data as read-only.<\/li><li>The \u201casync\u201d parameter allows the NFS server to reply before data is written to the share. Since it\u2019s mounted as read-only anyway, the parameter is only there to keep NFS\u2019 syntax happy.<\/li><li>The \u201cno_root_squash\u201d parameter means to allow the NFS client to use the mount as a root filesystem, otherwise it\u2019s mounted as \u201cnobody\u201d instead of \u201croot\u201d. Since the LiveCD is essentially a diskless client, we need to be able to define the NFS mount as a root volume.<\/li><li>The \u201cno_subtree_check\u201d parameter helps to speed up transfers. Normally NFS will check to see if a requested file exists in an exported sub-directory. This slows things down, so turning this off means the only check that is made is that the requested file exists on the exported filesystem. Subtree checking can also cause issues when an open file is renamed, but since the export is read-only, this is irrelevant.<br><\/li><\/ul><\/li><li>Save your changes with CTRL+X, then \u201cY\u201d and then Enter.<br><\/li><li>Now have NFS re-read its export file and begin sharing the specified directories with:<br><br><code>$ sudo exportfs -a<\/code><br><\/li><li>We\u2019re nearly ready to rock and\/or roll. All we need to do now is prepare the PXE boot menu to launch the Live CD for us. Assuming you followed by previous tutorial and your boot menu file is called\u00a0<em>mybootmenu.cfg<\/em>:<br><br><code>$ sudo nano \/srv\/tftp\/mybootmenu.cfg<\/code><br><\/li><li>Assuming your NFS server\u2019s IP address is 192.168.0.10, insert the following lines for a 32-bit Live CD entry:<br><br><code>label Live CD 32-bit<br> \u00a0\u00a0\u00a0 kernel ubuntu-livecd-boot\/i386\/vmlinuz<br> \u00a0\u00a0\u00a0 append boot=casper netboot=nfs nfsroot=192.168.0.10:\/srv\/ubuntu-livecd\/i386 initrd=ubuntu-livecd-boot\/i386\/initrd.lz -- splash quiet<\/code><br><br>\u2026and if you are doing 64-bit, you can replace or add as a separate menu option the following:<br><br>label Live CD 64-bit<br> \u00a0\u00a0\u00a0 kernel ubuntu-livecd-boot\/amd64\/vmlinuz<br> \u00a0\u00a0\u00a0 append boot=casper netboot=nfs nfsroot=192.168.0.10:\/srv\/ubuntu-livecd\/amd64 initrd=ubuntu-livecd-boot\/amd64\/initrd.lz &#8212; splash quiet<br><br>The\u00a0<em>kernel<\/em>\u00a0line is the actual kernel that is loaded to run the session. The\u00a0<em>append<\/em>\u00a0line tells the boot process several things. First up, the\u00a0<em>casper<\/em>\u00a0directory contains the boot files (a SquashFS image in the case of the Live CD), the root of the NFS file system is located on the server with the IP\u00a0<em>192.168.0.10<\/em>\u00a0under the path\u00a0<em>\/srv\/ubuntu-livecd\/i386<\/em>\u00a0(or\u00a0<em>amd64<\/em>) and that the image to fire up the RAM disk with is located under\u00a0<em>ubuntu-livecd\/i386\/initrd.lz<\/em>\u00a0and finally we have advised the boot process to suppress console messages and display the splash screen while loading. From this point on, the\u00a0<em>initrd.lz<\/em>\u00a0is extracted and will grab the SquashFS image from the\u00a0<em>casper<\/em>\u00a0directory via NFS, extract it and commence running it. All other files that the disc needs to do its thing (such as when installing Ubuntu from the Live environment) are also provided by the NFS share.<br><\/li><li>Save your changes by pressing CTRL+X, then \u201cY\u201d and then Enter.<br><\/li><li>You\u2019re now ready to go \u2013 reboot your PXE workstation and you should now see an entry for your Live CD. Upon choosing it, your system should fire up with the Live environment! Once booted, you can even do an Ubuntu install to the PC you started on as though you\u2019d booted from a CD or USB device!<br><br><a href=\"https:\/\/web.archive.org\/web\/20150317040032\/http:\/\/www.serenux.com\/wp-content\/uploads\/2010\/05\/MultibootPXE.png\"><\/a><\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20150317040032im_\/http:\/\/www.serenux.com\/wp-content\/uploads\/2010\/05\/MultibootPXE-300x224.png\" alt=\"\"\/><figcaption>The PXE boot menu<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Enjoy!\u00a0<img decoding=\"async\" src=\"https:\/\/web.archive.org\/web\/20150317040032im_\/http:\/\/www.serenux.com\/wp-content\/themes\/grey-opaque\/images\/smilies\/icon_smile.gif\" alt=\"Smilie: :)\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following my article about&nbsp;creating your own PXE network boot server, here is the first practical use you can put it to \u2013 taking the Ubuntu Live CD and turning it into a network-bootable version! Network booting the Live CD has obvious advantages \u2013 aside from booting faster than CD (especially on a gigabit network), it [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":1,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/51\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}