Installing LinuxMCE on VM via KVM on Ubuntu 10.10 Server

From LinuxMCE
Revision as of 18:32, 13 October 2012 by Mcefan (Talk | contribs)

Jump to: navigation, search

Installation

Version Status Date Updated Updated By
710 Unknown N/A N/A
810 still testing 9th february 20101 JoakimL
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

This is based on daballiemo's Installing_LinuMCE_on_Virtual_Machine_via_KVM#KVM: To baldly go where (almost) no man has gone before

<<< This is not complete yet, follow at own risk>>>

In this overview I will try to follow the installation path to get LCME 8.10 into a virtual machine on Ubuntu 10.10 which uses USB devices from the host.


Machine details first:

  • Motherboard: MSI K9N Neo V3 with BIOS 2.61
  • CPU: AMD AM2 4400+
  • 2 Gb DDR-2 Memory
  • 1 onboard GbE Nic
  • 1 PCI-E GbE Nic
  • 1 Hauppauge WinStick Nova T2


lspci
00:00.0 RAM memory: nVidia Corporation MCP65 Memory Controller (rev a3)
00:01.0 ISA bridge: nVidia Corporation MCP65 LPC Bridge (rev a3)
00:01.1 SMBus: nVidia Corporation MCP65 SMBus (rev a1)
00:01.2 RAM memory: nVidia Corporation MCP65 Memory Controller (rev a1)
00:02.0 USB Controller: nVidia Corporation MCP65 USB Controller (rev a3)
00:02.1 USB Controller: nVidia Corporation MCP65 USB Controller (rev a3)
00:07.0 Audio device: nVidia Corporation MCP65 High Definition Audio (rev a1)
00:08.0 PCI bridge: nVidia Corporation MCP65 PCI bridge (rev a1)
00:09.0 IDE interface: nVidia Corporation MCP65 IDE (rev a1)
00:0a.0 IDE interface: nVidia Corporation MCP65 SATA Controller (rev a3)
00:0b.0 PCI bridge: nVidia Corporation Device 045b (rev a1)
00:0c.0 PCI bridge: nVidia Corporation MCP65 PCI Express bridge (rev a1)
00:0d.0 PCI bridge: nVidia Corporation MCP65 PCI Express bridge (rev a1)
00:0e.0 PCI bridge: nVidia Corporation MCP65 PCI Express bridge (rev a1)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:0a.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
04:00.0 VGA compatible controller: nVidia Corporation G86 [GeForce 8500 GT] (rev a1)

Step 1) Install Ubuntu 10.10 server 64 bit


Step 2) Make the system current:

 sudo apt-get update
 sudo apt-get upgrade


Step 3) Add some management tools:

I use webmin to give my server a fixed ip address and perform other administrative tasks.

apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl
wget http://mirrors.kernel.org/ubuntu/pool/universe/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb
sudo dpkg -i libmd5-perl_2.03-1_all.deb
sudo wget http://sourceforge.net/projects/webadmin/files/webmin/1.520/webmin_1.520_all.deb/download
sudo dpkg -i download
sudo apt-get install -f

I use MidNight Commander for file stuff

apt-get install mc


Step 4) Getting the right kernel and parameters

Install the required tools and packages, so open a terminal and type the following,

sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev

Step 7) Booting with the new kernel

Add the options to enable IOMMU in the kernel commandline

edit /etc/default/grub

new: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on,igfx_off,pass-through"
old: #GRUB_CMDLINE_LINUX_DEFAULT="quiet"

update the booting menu

update-grub

and reboot

sudo reboot

Step 8) Deinstall networkmanager

sudo apt-get remove network-manager

Step 9) Setup your network, change /etc/network/interfaces to look like this

<< this needs modification, remote console cannot be used during setup if there's no local network >>

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The first bridge interface
auto bridge_ext
iface bridge_ext inet static
address 0.0.0.0 #no external access without going through DCERouter first
netmask 255.255.255.0
broadcast 10.0.0.255 
gateway 10.0.0.138
bridge_ports eth0
bridge_stp off
bridge_maxwait 5
# The second bridge interface
auto bridge_int
iface bridge_int inet static
address 192.168.80.240
netmask 255.255.255.0
broadcast 192.168.80.255
gateway 192.168.80.1
bridge_ports eth1
bridge_stp off
bridge_maxwait 5

With the above the host will use dcerouter as its way into the internet and thus the protection offered by the firewall. The host has no direct access to the 10.0.0.0 network.


Step 10) Install Linuxmce

sudo apt-get install virt-manager

Add user to administer you virtual machines to the libvirtd group

sudo adduser xxx libvirtd

Since there's no GUI on the server, run Virtual machine manager on another computer. Enable SSH connection for the manager by running this on the client:

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub xxx@your_server

Install viewer on the client

sudo apt-get install virt-viewer

Download the LMCE ISO file with:

mkdir /home/xxx/lmce
cd /home/xxx/lmce
wget http://linuxmce.iptp.org/snapshots/LinuxMCE-8.10-23645-i386.iso^C

Start installation

sudo virt-install --connect qemu:///system --name DCErouter --ram 1024 --file /var/lib/libvirt/images/lmce810.img --cdrom /home/joakim/lmce/LinuxMCE-8.10-23645-i386.iso  --os-type linux --os-variant generic24 -k sv --vnc --vncport 5901

Start a VNC viewer on you other computer:

virt-viewer -c qemu+ssh://192.168.1.78/system DCErouter

<< This is as far as I get. There's obviously a bug which makes Ubuntu 8.10 go into a 100% CPU loop, causing my CPU to become too hot.>>

Using virt-manager you can now install LinuxMCE. As we are all experts on that I will only give away my xml config file (should be enough ;-))

<domain type='kvm'>
 <name>DCERouter</name>
 <uuid>xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx</uuid>
 <memory>2097152</memory>
 <currentMemory>2097152</currentMemory>
 <vcpu>2</vcpu>
 <os>
   <type arch='x86_64' machine='pc-0.11'>hvm</type>
   <boot dev='hd'/>
 </os>
 <features>
   <acpi/>
   <apic/>
   <pae/>
 </features>
 <clock offset='utc'/>
 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>restart</on_crash>
 <devices>
   <emulator>/usr/bin/kvm</emulator>
   <disk type='block' device='disk'>
     <source dev='/dev/sdc'/>
     <target dev='hda' bus='ide'/>
   </disk>
   <disk type='file' device='cdrom'>
     <target dev='hdc' bus='ide'/>
     <readonly/>
   </disk>
   <interface type='bridge'>
     <mac address='xx:xx:xx:xx:xx:xx'/>
     <source bridge='bridge_ext'/>
   </interface>
   <interface type='bridge'>
     <mac address='xx:xx:xx:xx:xx:xx'/>
     <source bridge='bridge_int'/>
     <model type='virtio'/>
   </interface>
   <serial type='pty'>
     <target port='0'/>
   </serial>
   <console type='pty'>
     <target port='0'/>
   </console>
   <input type='tablet' bus='usb'/>
   <input type='mouse' bus='ps2'/>
   <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
   <video>
     <model type='cirrus' vram='9216' heads='1'/>
   </video>
   <hostdev mode='subsystem' type='pci' managed='yes'>
     <source>
       <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
     </source>
   </hostdev>
   <hostdev mode='subsystem' type='pci' managed='yes'>
     <source>
       <address domain='0x0000' bus='0x03' slot='0x08' function='0x0'/>
     </source>
   </hostdev>
   <hostdev mode='subsystem' type='pci' managed='yes'>
     <source>
       <address domain='0x0000' bus='0x03' slot='0x09' function='0x0'/>
     </source>
   </hostdev>
   <hostdev mode='subsystem' type='usb' managed='yes'>
     <source>
       <vendor id='0x0403'/>
       <product id='0xf2d0'/>
     </source>
   </hostdev>
   <hostdev mode='subsystem' type='pci' managed='yes'>
     <source>
       <address domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
     </source>
   </hostdev>
 </devices>
</domain>

Step 11) Enjoying building a test enviroment, inline upgrade etc.

Step 12) I chose to put my media on the host via a Samba share which will be detected as a NAS. This will simplify things when performing upgrades and test. Because I am using LVM also expansion is easy ;-)


Lmce kvm.png


Hints/Known Issues/Working Hardware


AMD/ATI Hardware
- NVidia Chipset 3600 with Opteron Socket F has full KVM support and works fine with LMCE 8.10.
- ATI-driver 9.8 supports kernel 2.6.30

Keyboard Layout
- As you can't choose the keyboard-layout in virtual-manager, simply change the keymap in the xml-file e.g. from "en-us" to "de".

Networking
- Step 11) is not needed if the physical network devices are configured as 'auto ethx \ iface ethx inet manual'
- The virtual LMCE runs fine with only one NIC provided to it. The setup automatically configures a sub-NIC which works well. I would suggest to have the host provide the internet-access, so vLMCE can't mess it up at the installation.

PCI-Passthrough at KVM
- PCI-Passthrough only works if the full PCI-device is transferred to the virtual machine. So if the PCI-Slot has sub-functions (e.g. Firewire) all of the 'functions' have to be adressed to the virtual machine with the <hostdev> section of Step 12). To look up your PCI-device-tree, use 'lspci -t'.

(Tyan S2915-E)
[0000:00]-+-00.0
          +-01.0
          +-01.1
          +-02.0
          +-02.1
          +-04.0
          +-05.0
          +-05.1
          +-06.0-[0000:01]----04.0                                           (<- PCI-Slot = DVB-card)
                            \-04.1                                           (<- Firewire, either disable in Bios or ->KVM)
          +-06.1
          +-08.0
          +-09.0
          +-0d.0-[0000:02-04]--+-00.0-[0000:03]----04.0
          |                    \-00.1-[0000:04]--
          +-0f.0-[0000:05]--+-00.0
          |                 \-00.1
          +-18.0
          +-18.1
          +-18.2
          +-18.3
          \-18.4

- PCIe-devices do not have this restriction.

- Please note that each change in the .xml-files is activated only after rebooting the libvirtd. You can do this manually by killing and restarting the process "libvirtd" or by a host reboot.

Problems with PVR-150 not responding

During usage it turned out that sometimes recordings failed having a total size of 0 B. Live TV has not worked stable at all. Checking the mythbackend logs shows that /dev/video0 was not responding as expected. Furthermore I detected DMA errors in the log of the host.

I am now testing the commandline option iommu=on,igfx_off,pass-through, where pass-through should be able to iron out the DMA errors.

Because the behaviour was not stable I also installed the mercurial ivtv drivers (within the VM ofcourse!!!!):

sudo apt-get install mercurial
cd /usr/src
sudo hg clone http://linuxtv.org/hg/v4l-dvb
cd v4l-dvb
sudo make
sudo make install
sudo make unload
sudo make load

You will have to rebuild after a kernel change.

Clicking sound on Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02)

When passing-through my audio card I noticed hick ups in the MP3's and a message in kern.log;

hda-intel: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.

edit alsa-base.conf;

vim /etc/modprobe.dalsa-base.conf

add the following line at the bottom;

options snd-hda-intel model=3stack-dig
options snd-hda-intel enable_msi=1
options snd-hda-intel single_cmd=1

and reboot (reload alsa does not seem to have the full effect)

Tip from Bugs Launchpad