Thicket data repository for the EEG
1{
2 "id": "https://anil.recoil.org/notes/installing-ubuntu-on-xenserver",
3 "title": "Installing Ubuntu on XenServer",
4 "link": "https://anil.recoil.org/notes/installing-ubuntu-on-xenserver",
5 "updated": "2008-07-02T00:00:00",
6 "published": "2008-07-02T00:00:00",
7 "summary": "<p>I thought I\u2019d kick off my Citrix blog with a question I get pretty often\nfrom Linux enthusiasts: how to install unsupported Linux distributions\non <a href=\"https://xenserver.com\">XenServer</a> 4.1.</p>\n<p>The most common solution people find is to use the "Other Install Media"\ntemplate, insert the distribution installation CD, and find that the\nmouse cursor doesn\u2019t work when they boot into X11. The reason for this\nis that they are using the hardware-assisted emulation mode of\ninstalling Linux. In this mode (dubbed \u201cHVM\u201d), all input and output is\nemulated, and in particular the mouse interface uses the USB tablet\ninterface. If the distribution doesn\u2019t include a driver for USB tablets,\nthen no mouse will appear.</p>\n<p>Windows guests run at high-speed in HVM mode due to the installation of\nthe XenServer tools which install <a href=\"http://xen.org/files/summit_3/xen-pv-drivers.pdf\">high-speed\ndrivers</a>, but these\nare not necessary for Linux distributions since they can be run in\n<a href=\"http://en.wikipedia.org/wiki/Paravirtualization\">para-virtualized</a> mode\n(dubbed \u201cPV\u201d). This involves obtaining a Xen-enabled PV kernel from the\ndistribution, and modifying the VM record in XenServer to boot into this\nkernel instead of HVM mode. The XenServer built-in templates for popular\ndistributions such as RHEL, CentOS or SUSE Linux already automate all\nthis and are in PV mode from the installer onwards.</p>\n<p>In the remainder of this post, I\u2019ll explain how to take a distribution\nwithout direct support (<a href=\"http://www.ubuntu.com/\">Ubuntu</a>\n<a href=\"https://wiki.ubuntu.com/HardyHeron\">8.04</a>), get it installed in HVM\nmode on XenServer 4.1, and convert it to PV mode with a XenCenter\ngraphical console.</p>\n<ul>\n<li>\n<p>Download the "<a href=\"http://www.ubuntu.com/GetUbuntu/download\">Alternative Installation\nCD</a>". The main\ninstallation CD uses graphical mode, which won't install as well in\nHVM mode due to the use of esoteric 16-bit mode instructions for the\ngraphics operations. The 16-bit emulation mechanisms vary between\nprocessors (with better support on AMD chips, and a software\ninstruction emulator required on Intel VT chips). However, the\nUbuntu alternate CD uses a text-based installer which works fine.</p>\n</li>\n<li>\n<p>Create a new VM on the XenServer 4.1 host using the "Windows Server\n2003" template. This template is set up with a sensible set of\nhardware emulation flags and default disks, and so is a good base\nfor the HVM installation of Ubuntu as well. Attach the Ubuntu ISO\nyou just downloaded to the VM, and proceed to install Ubuntu as\nnormal. You should install it onto the first disk, to make the\nsubsequent steps in this guide easier.</p>\n</li>\n<li>\n<p>When the installation is finished, reboot the VM (don't forget to\ndetach the installation ISO first). It should boot up in HVM mode\ninto the graphical login screen. The XenCenter display will show it\nas not being optimized, which is fine. At this stage, I prefer to\nwork via a remote command-line using SSH. Open up a Terminal from\nUbuntu, and run "<code>sudo apt-get install openssh-server</code>". Then find\nout the VM's IP address with "<code>ifconfig eth0</code>", and then connect to\nit remotely. Alternatively, you can continue to type in the commands\ndirectly into the terminal as well.</p>\n</li>\n<li>\n<p>On the Ubuntu guest, you now need to install the latest Xen version\nof the Ubuntu kernel:</p>\n<ul>\n<li>Install the Linux kernel virtual package with\n"<code>sudo apt-get install linux-image-xen</code>". This is a virtual\npackage which pulls in the latest Xen kernel and modules, in my\ncase <code>2.6.24.19.21</code>.</li>\n<li>You now need to workaround a\n<a href=\"http://www.mail-archive.com/grub-devel@gnu.org/msg06024.html\">bug</a>\nin grub. Due to the switch in recent versions of Linux to work\nwith the hypervisor-independent\n<a href=\"http://xen.xensource.com/files/xensummit_4/xen-paravirt_ops_Fitzhardinge.pdf\">paravirt_ops</a>\ninterface, <code>update-grub</code> doesn't update the grub configuration\nwith your newly installed Xen kernel. To fix this:\n<ul>\n<li>\n<p>Open <code>/boot/grub/menu.lst</code> in your favourite editor.</p>\n</li>\n<li>\n<p>Scroll to the bottom to the kernel list, and find the entry\nwhich looks like:</p>\n<pre><code>title Ubuntu 8.04, kernel 2.6.24-16-generic\nroot (hd0,0)\nkernel /boot/vmlinuz-2.6.24-16-generic root=UUID=<uuid> ro quiet splash\ninitrd /boot/initrd.img-2.6.24-16-generic\nquiet\n</code></pre>\n</li>\n<li>\n<p>Add a new entry which is similar to this, but change all\nreferences to the <code>2.6.24-16-generic</code> to the Xen kernel. In\n<code>/boot</code> I have <code>vmlinuz-2.6.24-19-xen</code>, so my new entry\nlooks like:</p>\n<pre><code>title Ubuntu 8.04, kernel 2.6.24-19-xen\nroot (hd0,0)\nkernel /boot/vmlinuz-2.6.24-19-xen root=UUID=<uuid> ro quiet splash\ninitrd /boot/initrd.img-2.6.24-19-xen\nquiet\n</code></pre>\n</li>\n<li>\n<p>Also edit the <code>default</code> entry in the <code>menu.lst</code> to match the\nnumber of the kernel you just added. I set mine to 3, since\nit is the fourth entry in the list and the indexing starts\nfrom 0.</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p>When this is done, shut down the guest but do not reboot it just\nyet. You first need to edit the VM record for your Ubuntu VM to\nconvert it to PV boot mode. From the control domain console of your\nXenServer:</p>\n<ul>\n<li>Determine the UUID of the Ubuntu VM by using the <code>xe</code> CLI:\n<ul>\n<li><code>xe vm-list name-label=Ubuntu params=uuid --minimal</code> : this\nwill print out the UUID of the VM named "Ubuntu". If you are\nlogged into the control domain, pressing the <code><tab></code> key\nwill perform auto-completion of UUIDs in subsequent XE\ncommands, so you don't need to keep typing it in every time!</li>\n<li><code>xe vm-param-set uuid=<uuid> HVM-boot-policy=</code> : this will\nclear the HVM boot mode from the VM.</li>\n<li><code>xe vm-param-set uuid=<uuid> PV-bootloader=pygrub</code> : this\nwill switch the VM to using to the pygrub bootloader which\nstarts the guest in PV mode by examining its filesystem for\nkernel.</li>\n<li><code>vm vm-param-set uuid=<uuid> PV-args="console=tty0 xencons=tty"</code>\n: this configures the kernel boot arguments to display the\nlogin console on the correct TTY, so that it shows up in the\nXenCenter console.</li>\n</ul>\n</li>\n<li>Next, you need to flag the root disk of the VM as bootable so\nthat pygrub knows where to look for the PV kernel:\n<ul>\n<li><code>xe vm-disk-list uuid=<uuid></code> and look for the UUID of the\nVBD for the disk. VBD stands for "Virtual Block Device" and\nrepresents how to map the virtual disk into the virtual\nmachine.</li>\n<li><code>xe vbd-param-set uuid=<vbd uuid> bootable=true</code> will set\nthe root disk VBD to be bootable.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p>You should be all set now! If you boot up the Ubuntu VM, it should\nstart up in text-mode with the high-speed PV kernel. If it doesn't\nwork due to an incorrect grub configuration, you can use the\n<code>xe-edit-bootloader</code> script in the XenServer control domain to edit\nthe <code>grub.conf</code> until it works.</p>\n</li>\n<li>\n<p>The next step is to install the XenServer tools within the guest, so\nthat metrics such as the network interface IP addresses are recorded\nand reported from XenCenter. To do this:</p>\n<ul>\n<li>Due to a portability issues with the default shell in Ubuntu\n(<a href=\"http://en.wikipedia.org/wiki/Debian_Almquist_shell\">dash</a>),\nyou will need to replace it by:\n<code>sudo apt-get -y install bash && sudo dpkg-reconfigure dash</code>.\nWe've actually fixed this issue in future releases of XenServer,\nbut for XenServer 4.1 you will need to use <code>bash</code>.</li>\n<li>Attach the XenServer Tools ISO into the VM, and mount it into\nthe guest with <code>sudo mount /dev/xvdd /mnt</code></li>\n<li>Install the tools with\n<code>sudo dpkg -i /mnt/Linux/xe-guest-utilities_4.1.0-257_i386.deb</code>.</li>\n<li>The warnings about the VM being unoptimized should disappear,\nand additional information such as the IP address of the guest\nshould appear in XenCenter.</li>\n</ul>\n</li>\n<li>\n<p>In order to access the Ubuntu installation via the graphical\nconsole, you need to configure it to run\n<a href=\"http://www.realvnc.com/\">VNC</a> on the external network interface.\nXenCenter polls the guest to see if it is listening on the VNC port\n5900, and offers the option to switch to the graphical console if it\nfinds it. I followed the excellent instructions on this <a href=\"http://ubuntuforums.org/showpost.php?p=4963842&postcount=1\">forum\npost</a>.\nTo summarise them:</p>\n<ul>\n<li>\n<p><code>sudo apt-get install vnc4server xinetd</code> : to install the\nrequired packages</p>\n</li>\n<li>\n<p>Edit <code>/etc/gdm/gdm.conf</code> and uncomment the\n<code>RemoteGreeter=/usr/lib/gdm/gdmlogin</code> line, set the key\n<code>Enable=true</code> in the <code>[xdcmp]</code> section.</p>\n</li>\n<li>\n<p>Install a new service file for <code>xinetd</code> into\n<code>/etc/xinetd.d/Xvnc</code> with the following contents:</p>\n<pre><code>service Xvnc\n{\n type = UNLISTED\n disable = no\n socket_type = stream\n protocol = tcp\n wait = no\n user = nobody\n server = /usr/bin/Xvnc\n server_args = -inetd -query localhost -geometry 1024x768 -depth 16 -cc 3 -once -SecurityTypes=none -extension XFIXES\n port = 5900\n}\n</code></pre>\n</li>\n<li>\n<p>The major difference from the forum poster is to run it on port\n5900, and not to restrict it to just localhost (since XenCenter\nalso needs to connect to it).</p>\n</li>\n<li>\n<p>Finally, restart the <code>xinetd</code> service by running\n<code>sudo /etc/init.d/xinetd restart</code>.</p>\n</li>\n</ul>\n</li>\n</ul>\n<p>Once you're done with this installation, you can shut down the VM and\nconvert it to a template. Any exports or clones will continue to run in\nPV mode, since the XenServer XVA export format records all of the\nmetadata required to re-create the VM records.</p>\n<p>Enjoy the Ubuntu on XenServer experience! Remember to report any issues\nyou have with the in-guest packages on the Ubuntu support forums, or\njust give them positive feedback.</p>\n<p>PS: many thanks to Andrew Peace and Ian Campbell for assistance. May\ntheir Linux beards remain long and uncut.</p>",
8 "content": "<p>I thought I\u2019d kick off my Citrix blog with a question I get pretty often\nfrom Linux enthusiasts: how to install unsupported Linux distributions\non <a href=\"https://xenserver.com\">XenServer</a> 4.1.</p>\n<p>The most common solution people find is to use the "Other Install Media"\ntemplate, insert the distribution installation CD, and find that the\nmouse cursor doesn\u2019t work when they boot into X11. The reason for this\nis that they are using the hardware-assisted emulation mode of\ninstalling Linux. In this mode (dubbed \u201cHVM\u201d), all input and output is\nemulated, and in particular the mouse interface uses the USB tablet\ninterface. If the distribution doesn\u2019t include a driver for USB tablets,\nthen no mouse will appear.</p>\n<p>Windows guests run at high-speed in HVM mode due to the installation of\nthe XenServer tools which install <a href=\"http://xen.org/files/summit_3/xen-pv-drivers.pdf\">high-speed\ndrivers</a>, but these\nare not necessary for Linux distributions since they can be run in\n<a href=\"http://en.wikipedia.org/wiki/Paravirtualization\">para-virtualized</a> mode\n(dubbed \u201cPV\u201d). This involves obtaining a Xen-enabled PV kernel from the\ndistribution, and modifying the VM record in XenServer to boot into this\nkernel instead of HVM mode. The XenServer built-in templates for popular\ndistributions such as RHEL, CentOS or SUSE Linux already automate all\nthis and are in PV mode from the installer onwards.</p>\n<p>In the remainder of this post, I\u2019ll explain how to take a distribution\nwithout direct support (<a href=\"http://www.ubuntu.com/\">Ubuntu</a>\n<a href=\"https://wiki.ubuntu.com/HardyHeron\">8.04</a>), get it installed in HVM\nmode on XenServer 4.1, and convert it to PV mode with a XenCenter\ngraphical console.</p>\n<ul>\n<li>\n<p>Download the "<a href=\"http://www.ubuntu.com/GetUbuntu/download\">Alternative Installation\nCD</a>". The main\ninstallation CD uses graphical mode, which won't install as well in\nHVM mode due to the use of esoteric 16-bit mode instructions for the\ngraphics operations. The 16-bit emulation mechanisms vary between\nprocessors (with better support on AMD chips, and a software\ninstruction emulator required on Intel VT chips). However, the\nUbuntu alternate CD uses a text-based installer which works fine.</p>\n</li>\n<li>\n<p>Create a new VM on the XenServer 4.1 host using the "Windows Server\n2003" template. This template is set up with a sensible set of\nhardware emulation flags and default disks, and so is a good base\nfor the HVM installation of Ubuntu as well. Attach the Ubuntu ISO\nyou just downloaded to the VM, and proceed to install Ubuntu as\nnormal. You should install it onto the first disk, to make the\nsubsequent steps in this guide easier.</p>\n</li>\n<li>\n<p>When the installation is finished, reboot the VM (don't forget to\ndetach the installation ISO first). It should boot up in HVM mode\ninto the graphical login screen. The XenCenter display will show it\nas not being optimized, which is fine. At this stage, I prefer to\nwork via a remote command-line using SSH. Open up a Terminal from\nUbuntu, and run "<code>sudo apt-get install openssh-server</code>". Then find\nout the VM's IP address with "<code>ifconfig eth0</code>", and then connect to\nit remotely. Alternatively, you can continue to type in the commands\ndirectly into the terminal as well.</p>\n</li>\n<li>\n<p>On the Ubuntu guest, you now need to install the latest Xen version\nof the Ubuntu kernel:</p>\n<ul>\n<li>Install the Linux kernel virtual package with\n"<code>sudo apt-get install linux-image-xen</code>". This is a virtual\npackage which pulls in the latest Xen kernel and modules, in my\ncase <code>2.6.24.19.21</code>.</li>\n<li>You now need to workaround a\n<a href=\"http://www.mail-archive.com/grub-devel@gnu.org/msg06024.html\">bug</a>\nin grub. Due to the switch in recent versions of Linux to work\nwith the hypervisor-independent\n<a href=\"http://xen.xensource.com/files/xensummit_4/xen-paravirt_ops_Fitzhardinge.pdf\">paravirt_ops</a>\ninterface, <code>update-grub</code> doesn't update the grub configuration\nwith your newly installed Xen kernel. To fix this:\n<ul>\n<li>\n<p>Open <code>/boot/grub/menu.lst</code> in your favourite editor.</p>\n</li>\n<li>\n<p>Scroll to the bottom to the kernel list, and find the entry\nwhich looks like:</p>\n<pre><code>title Ubuntu 8.04, kernel 2.6.24-16-generic\nroot (hd0,0)\nkernel /boot/vmlinuz-2.6.24-16-generic root=UUID=<uuid> ro quiet splash\ninitrd /boot/initrd.img-2.6.24-16-generic\nquiet\n</code></pre>\n</li>\n<li>\n<p>Add a new entry which is similar to this, but change all\nreferences to the <code>2.6.24-16-generic</code> to the Xen kernel. In\n<code>/boot</code> I have <code>vmlinuz-2.6.24-19-xen</code>, so my new entry\nlooks like:</p>\n<pre><code>title Ubuntu 8.04, kernel 2.6.24-19-xen\nroot (hd0,0)\nkernel /boot/vmlinuz-2.6.24-19-xen root=UUID=<uuid> ro quiet splash\ninitrd /boot/initrd.img-2.6.24-19-xen\nquiet\n</code></pre>\n</li>\n<li>\n<p>Also edit the <code>default</code> entry in the <code>menu.lst</code> to match the\nnumber of the kernel you just added. I set mine to 3, since\nit is the fourth entry in the list and the indexing starts\nfrom 0.</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p>When this is done, shut down the guest but do not reboot it just\nyet. You first need to edit the VM record for your Ubuntu VM to\nconvert it to PV boot mode. From the control domain console of your\nXenServer:</p>\n<ul>\n<li>Determine the UUID of the Ubuntu VM by using the <code>xe</code> CLI:\n<ul>\n<li><code>xe vm-list name-label=Ubuntu params=uuid --minimal</code> : this\nwill print out the UUID of the VM named "Ubuntu". If you are\nlogged into the control domain, pressing the <code><tab></code> key\nwill perform auto-completion of UUIDs in subsequent XE\ncommands, so you don't need to keep typing it in every time!</li>\n<li><code>xe vm-param-set uuid=<uuid> HVM-boot-policy=</code> : this will\nclear the HVM boot mode from the VM.</li>\n<li><code>xe vm-param-set uuid=<uuid> PV-bootloader=pygrub</code> : this\nwill switch the VM to using to the pygrub bootloader which\nstarts the guest in PV mode by examining its filesystem for\nkernel.</li>\n<li><code>vm vm-param-set uuid=<uuid> PV-args="console=tty0 xencons=tty"</code>\n: this configures the kernel boot arguments to display the\nlogin console on the correct TTY, so that it shows up in the\nXenCenter console.</li>\n</ul>\n</li>\n<li>Next, you need to flag the root disk of the VM as bootable so\nthat pygrub knows where to look for the PV kernel:\n<ul>\n<li><code>xe vm-disk-list uuid=<uuid></code> and look for the UUID of the\nVBD for the disk. VBD stands for "Virtual Block Device" and\nrepresents how to map the virtual disk into the virtual\nmachine.</li>\n<li><code>xe vbd-param-set uuid=<vbd uuid> bootable=true</code> will set\nthe root disk VBD to be bootable.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p>You should be all set now! If you boot up the Ubuntu VM, it should\nstart up in text-mode with the high-speed PV kernel. If it doesn't\nwork due to an incorrect grub configuration, you can use the\n<code>xe-edit-bootloader</code> script in the XenServer control domain to edit\nthe <code>grub.conf</code> until it works.</p>\n</li>\n<li>\n<p>The next step is to install the XenServer tools within the guest, so\nthat metrics such as the network interface IP addresses are recorded\nand reported from XenCenter. To do this:</p>\n<ul>\n<li>Due to a portability issues with the default shell in Ubuntu\n(<a href=\"http://en.wikipedia.org/wiki/Debian_Almquist_shell\">dash</a>),\nyou will need to replace it by:\n<code>sudo apt-get -y install bash && sudo dpkg-reconfigure dash</code>.\nWe've actually fixed this issue in future releases of XenServer,\nbut for XenServer 4.1 you will need to use <code>bash</code>.</li>\n<li>Attach the XenServer Tools ISO into the VM, and mount it into\nthe guest with <code>sudo mount /dev/xvdd /mnt</code></li>\n<li>Install the tools with\n<code>sudo dpkg -i /mnt/Linux/xe-guest-utilities_4.1.0-257_i386.deb</code>.</li>\n<li>The warnings about the VM being unoptimized should disappear,\nand additional information such as the IP address of the guest\nshould appear in XenCenter.</li>\n</ul>\n</li>\n<li>\n<p>In order to access the Ubuntu installation via the graphical\nconsole, you need to configure it to run\n<a href=\"http://www.realvnc.com/\">VNC</a> on the external network interface.\nXenCenter polls the guest to see if it is listening on the VNC port\n5900, and offers the option to switch to the graphical console if it\nfinds it. I followed the excellent instructions on this <a href=\"http://ubuntuforums.org/showpost.php?p=4963842&postcount=1\">forum\npost</a>.\nTo summarise them:</p>\n<ul>\n<li>\n<p><code>sudo apt-get install vnc4server xinetd</code> : to install the\nrequired packages</p>\n</li>\n<li>\n<p>Edit <code>/etc/gdm/gdm.conf</code> and uncomment the\n<code>RemoteGreeter=/usr/lib/gdm/gdmlogin</code> line, set the key\n<code>Enable=true</code> in the <code>[xdcmp]</code> section.</p>\n</li>\n<li>\n<p>Install a new service file for <code>xinetd</code> into\n<code>/etc/xinetd.d/Xvnc</code> with the following contents:</p>\n<pre><code>service Xvnc\n{\n type = UNLISTED\n disable = no\n socket_type = stream\n protocol = tcp\n wait = no\n user = nobody\n server = /usr/bin/Xvnc\n server_args = -inetd -query localhost -geometry 1024x768 -depth 16 -cc 3 -once -SecurityTypes=none -extension XFIXES\n port = 5900\n}\n</code></pre>\n</li>\n<li>\n<p>The major difference from the forum poster is to run it on port\n5900, and not to restrict it to just localhost (since XenCenter\nalso needs to connect to it).</p>\n</li>\n<li>\n<p>Finally, restart the <code>xinetd</code> service by running\n<code>sudo /etc/init.d/xinetd restart</code>.</p>\n</li>\n</ul>\n</li>\n</ul>\n<p>Once you're done with this installation, you can shut down the VM and\nconvert it to a template. Any exports or clones will continue to run in\nPV mode, since the XenServer XVA export format records all of the\nmetadata required to re-create the VM records.</p>\n<p>Enjoy the Ubuntu on XenServer experience! Remember to report any issues\nyou have with the in-guest packages on the Ubuntu support forums, or\njust give them positive feedback.</p>\n<p>PS: many thanks to Andrew Peace and Ian Campbell for assistance. May\ntheir Linux beards remain long and uncut.</p>",
9 "content_type": "html",
10 "author": {
11 "name": "Anil Madhavapeddy",
12 "email": "anil@recoil.org",
13 "uri": "https://anil.recoil.org"
14 },
15 "categories": [],
16 "rights": "(c) 1998-2025 Anil Madhavapeddy, all rights reserved",
17 "source": "https://anil.recoil.org/news.xml"
18}