How to install OpenELEC (Official) in a VM


johnodon

Recommended Posts

UPDATE 27DEC15:  After all of this time, I finally found the key to installing OE v5.0.8 in a VM.  Follow the guide below, however, when you first boot the OE Installer, you need to be quick and stop the countdown ( I think it is only 5 seconds or something) by pressing an a key (I use an up or down arrow key) while on the Boot menu screen.  Once you do that, make sure "Run Installer" is highlighted and then hit the 'Tab' key to edit the command line options.  Delete everything to the right of 'Installer':  "quite tty vga=current" and hit Enter (see pic).  You should now be taken to the normal OE Installer screen.  You can proceed with the guide below from that point.

 

hg3xW11.png

 

---------------------------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------------------------

 

While we wait for unRAID 6.2 to be released (which will include an OE v6 final template), I figured I would share with everyone how to actually install OE in a VM using the Official OE image file.

 

Below are screenshots taken while creating the VM.  The only things changed are highlighted in yellow:

 

- Name your VM

- Operating system:  OpenELEC

- CPUs:  I pin one core to each OE instance

- Initial Memory:  I give it 1GB (Max should auto adjust to be the same

- Primary vDisk Location:  Where the vdisk will be stored

- Primary vDisk Size:  I use 8GB

- 2nd vDisk Location:  You will need to be in Advanced view to see this and click on the '+' sign to add a seconds disk.  Point this to the OpenELEC 6.0.0 (x86_64) Disk image file (wherever you extracted/stored it)

- Start VM after creation:  Make sure this is unchecked prior to creating the VM as we need to do some XML tweaking first

 

You can also select any USB devices that you would like to passthrough at this point.

 

dubg057.png?1

 

z774TWn.png?1

 

Click the 'Create' button.

 

You will notice to start that I have not passed through a GPU...the installation will occur using VNC.  I find this easier since it negates the need to have a KB passed through.  I add my GPU at the end of the process when I am ready to boot OE the first time.

 

Now that we created the VM, we need to make some changes to the XML prior to booting it the first time.  Below is the XML that was created from the example above with the changes that I made shown in RED.  In a nutshell, here are the things that need to change:

 

- bus types for each disk need to be changed from 'virtio' to 'sata'

- remove the 'address' lines from both disk sections

- change the 'boot order' for hda from 1 to 2

- add '<boot order='1'/>' to hdb

- change 'model type' for the network card from 'virtio' to 'e1000'

- remove the 'address' line from both network card section

 

<domain type='kvm'>

  <name>OPENELEC</name>

  <uuid>c86dcfd1-3d2f-c089-b95b-ac2532d32d28</uuid>

  <metadata>

    <vmtemplate name="Custom" icon="openelec.png" os="openelec"/>

  </metadata>

  <memory unit='KiB'>1048576</memory>

  <currentMemory unit='KiB'>1048576</currentMemory>

  <memoryBacking>

    <nosharepages/>

    <locked/>

  </memoryBacking>

  <vcpu placement='static'>1</vcpu>

  <cputune>

    <vcpupin vcpu='0' cpuset='15'/>

  </cputune>

  <os>

    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>

  </os>

  <features>

    <acpi/>

    <apic/>

  </features>

  <cpu mode='host-passthrough'>

    <topology sockets='1' cores='1' threads='1'/>

  </cpu>

  <clock offset='utc'>

    <timer name='rtc' tickpolicy='catchup'/>

    <timer name='pit' tickpolicy='delay'/>

    <timer name='hpet' present='no'/>

  </clock>

  <on_poweroff>destroy</on_poweroff>

  <on_reboot>restart</on_reboot>

  <on_crash>restart</on_crash>

  <devices>

    <emulator>/usr/bin/qemu-system-x86_64</emulator>

    <disk type='file' device='disk'>

      <driver name='qemu' type='raw' cache='writeback'/>

      <source file='/mnt/cache/VMs/OPENELEC/vdisk1.img'/>

      <target dev='hda' bus='sata'/>

      <boot order='2'/>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>

    </disk>

    <disk type='file' device='disk'>

      <driver name='qemu' type='raw' cache='writeback'/>

      <source file='/mnt/user/Images/OpenELEC-Generic.x86_64-6.0.0.img'/>

      <target dev='hdb' bus='sata'/>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>

      <boot order='1'/>

    </disk>

    <controller type='usb' index='0' model='ich9-ehci1'>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>

    </controller>

    <controller type='usb' index='0' model='ich9-uhci1'>

      <master startport='0'/>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>

    </controller>

    <controller type='sata' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>

    </controller>

    <controller type='pci' index='0' model='pcie-root'/>

    <controller type='pci' index='1' model='dmi-to-pci-bridge'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>

    </controller>

    <controller type='pci' index='2' model='pci-bridge'>

      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>

    </controller>

    <controller type='virtio-serial' index='0'>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>

    </controller>

    <interface type='bridge'>

      <mac address='52:54:00:d8:16:57'/>

      <source bridge='br0'/>

      <model type='e1000'/>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>

    </interface>

    <serial type='pty'>

      <target port='0'/>

    </serial>

    <console type='pty'>

      <target type='serial' port='0'/>

    </console>

    <channel type='unix'>

      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/OPENELEC.org.qemu.guest_agent.0'/>

      <target type='virtio' name='org.qemu.guest_agent.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='1'/>

    </channel>

    <input type='tablet' bus='usb'/>

    <input type='mouse' bus='ps2'/>

    <input type='keyboard' bus='ps2'/>

    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>

      <listen type='address' address='0.0.0.0'/>

    </graphics>

    <video>

      <model type='vmvga' vram='16384' heads='1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>

    </video>

    <hostdev mode='subsystem' type='usb' managed='yes'>

      <source>

        <vendor id='0x20a0'/>

        <product id='0x0001'/>

      </source>

    </hostdev>

    <memballoon model='virtio'>

      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>

    </memballoon>

  </devices>

</domain>

 

Save the changes to the XML, start your VM and open VNC.  You should be greeted with the OE installer.  Proceed as normal and install OE to your vdisk (should be the only option you have).  When the installation is completed and you are back at the main menu, 'Force Stop' the VM.

 

NOTE:  Any/all changes that you previously made via the XML editor (i.e. changing virtio to sata) will be discarded when you Edit the VM and save it.  Before proceeding, I suggest you first open the XML editor again and copy/paste the contents into an empty Notepad or something.

 

What I usually do at this point is Edit the VM and pass through my GPU.  As noted above, doing this will erase any changes we manually made to the XML.  After addingmy GPU and saving, I edit the XML one last time to change 'virtio' to 'sata' (hda) and 'virtio' to 'e1000' (network) respectively (you may also need to delete the 'address' lines again in the disk and NIC sections).  I remove the entire disk section for the OE IMG file (no longer needed) and make hda the first bootable disk (if it is not already).  Here is my final XML:

 

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>OPENELEC</name>
  <uuid>c86dcfd1-3d2f-c089-b95b-ac2532d32d28</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="openelec.png" os="openelec"/>
  </metadata>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='15'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='1' threads='1'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/cache/VMs/OPENELEC/vdisk1.img'/>
      <target dev='hda' bus='sata'/>
      <boot order='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:d8:16:57'/>
      <source bridge='br0'/>
      <model type='e1000'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/OPENELEC.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x045e'/>
        <product id='0x0291'/>
      </source>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=2,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=84:00.0,bus=pcie.0,multifunction=on,x-vga=on'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=84:00.1,bus=pcie.0'/>
  </qemu:commandline>
</domain>

 

Link to comment

I made final oe 6 just replace image on my, i even added 9p mount shares

https://lime-technology.com/forum/index.php?topic=42473.msg425375#msg425375

 

I'm also made for testing oe7 with kodi Jarvis beta4

 

And you can still use default template for OE, just remember add to xml code for mount unraid shares

Over 9p otherwise will not boot

 

Unfortunately, I can't use them since I have all AMD GPUs.  If I remember correctly, you stripped these drivers out of your image.

 

Also, I am one of the users who see VERY slow speeds when using 9p.  It is basically unusable for me.

 

Other than that, my main reason for doing it this way is that I can use the Official version and not have to rely on others to update their images when a new version of OE is released.

 

John

Link to comment

Thanks for the write up. I got it up and running but having one issue. I cannot get passthrough DTS HD or TrueHD to output any sound. It works fine with the built-in Unraid template but not the generic img. I'm not sure what tweaks if any were made for sound on the Unraid version. I'm using a AMD 6450.

 

I have this exact issue with all forms of install of OE (LT template, the method above, PXE booting OE, etc.).  In fact, I have never been able to get HD audio passthrough to work with any flavor of Linux+Kodi.  Windows works fine.

Link to comment

Thanks, I am going to try and install Plex Media Player (which is based on OE) using this method. Much appreciated!

 

I am going to try the same.  I only ever tried PXE booting the PMP IMG file but that was throwing a stack error.  I'll try it this way to see if I get any further.

 

John

Link to comment

Thanks, I am going to try and install Plex Media Player (which is based on OE) using this method. Much appreciated!

 

I am going to try the same.  I only ever tried PXE booting the PMP IMG file but that was throwing a stack error.  I'll try it this way to see if I get any further.

 

John

 

SUCCESS!  I am looking at the sign in screen right now.  I was able to link this to my PMS but I do not have a Plex Pass so I can;t go any further.  However, It should work just fine.

Link to comment
  • 2 weeks later...

Thanks for the write up. I got it up and running but having one issue. I cannot get passthrough DTS HD or TrueHD to output any sound. It works fine with the built-in Unraid template but not the generic img. I'm not sure what tweaks if any were made for sound on the Unraid version. I'm using a AMD 6450.

 

I have this exact issue with all forms of install of OE (LT template, the method above, PXE booting OE, etc.).  In fact, I have never been able to get HD audio passthrough to work with any flavor of Linux+Kodi.  Windows works fine.

 

Thats strange, im passing through an old AMD radeon HD 5450 with DP and DVI out to my OE VM. Its Lenovo branded i think, but i cant find any info on the FRU number.

 

Using a DP to HDMI adapter, 10m HDMI cable to reciever. And it works with booth DTS HDMA and Dolby TrueHD. In both unRAID OE Template, and generic 6.0.0

 

OE recognizes it as a  "gallium 0.4 on amd cedar" Audio is recognized as "HDA ATI,@@@" And its greyed out, i cant change audio device.

 

 

Link to comment

Another thing, is Airplay working for you?

 

I get no sound, Kodi doesnt start the musicplayer, but my iphone thinks its playing the music via Airplay.

 

I can see and choose Kodi (OpenELEC) as device on iphone.

 

Airplay has always been flaky for me.  A lot of times when I try to throw video to it, it will play some random U2 song (audio only).  What's stranger is that I do not have any U2 songs on my server.

 

Most other times it will tell me "unable to play video".  This always happens with the WatchESPN app.

Link to comment

i tried add patches for AirPlay but this dont will work now, they must develop little more for video support in iSO9.

This what i found in source code from Kodi 17 alfa

 

Enables support for receving videos and pictures via AirPlay. This needs to be disabled when using iOS 9 or later clients to restore music streaming via AirPlay. Videos and Pictures are only supported for iOS clients using iOS 8.x and older.
Link to comment

Thanks for the write up. I got it up and running but having one issue. I cannot get passthrough DTS HD or TrueHD to output any sound. It works fine with the built-in Unraid template but not the generic img. I'm not sure what tweaks if any were made for sound on the Unraid version. I'm using a AMD 6450.

 

I have this exact issue with all forms of install of OE (LT template, the method above, PXE booting OE, etc.).  In fact, I have never been able to get HD audio passthrough to work with any flavor of Linux+Kodi.  Windows works fine.

 

Thats strange, im passing through an old AMD radeon HD 5450 with DP and DVI out to my OE VM. Its Lenovo branded i think, but i cant find any info on the FRU number.

 

Using a DP to HDMI adapter, 10m HDMI cable to reciever. And it works with booth DTS HDMA and Dolby TrueHD. In both unRAID OE Template, and generic 6.0.0

 

OE recognizes it as a  "gallium 0.4 on amd cedar" Audio is recognized as "HDA ATI,@@@" And its greyed out, i cant change audio device.

 

Are you sure you are getting the passthrough audio stream and not just audio?  Is your receiver reporting it as trueHD, etc?

 

I ask because I went through this setup last night, I get audio, but it is not the bitstream passthrough audio signal, it is just audio.  As soon as I go in and set the audio settings to passthrough, dts HD capable receiver etc, I suddenly get no audio.  If I disable passthrough then I get audio again.  So, I guess I am just curious if you are really getting the right audio signal at your receiver.

 

I just converted from a standalone OE install that was using this exact video card where I know things were working perfectly, so I know it should work.  I guess what I am curious to is if it is and unraid sided issue or something in the VM config.  I should install the template version to test it to see if the result is any different, but installing like this, currently does not appear to work correctly.

Link to comment

Hi

i made pull request for add modules with driver of KVM in Kernel Openelec (then we dont will must emulate LAN, or SATA driver)

also we dont will be must wait for LimeTech for new compilation ....

 

please add few words under this pull request (my english is not good enough) we must convince then to merge changes

(or just put "+1")

 

https://github.com/OpenELEC/OpenELEC.tv/pull/4564

 

Thanks all ! and special @johnodon for make this progress :)

 

btw. i made many test of speed 9p and read articles, and thats true is slow, mostly becuase many people say this solution is not finished yet ....

i belive this is true.

Link to comment

Hi

i made pull request for add modules with driver of KVM in Kernel Openelec (then we dont will must emulate LAN, or SATA driver)

also we dont will be must wait for LimeTech for new compilation ....

 

please add few words under this pull request (my english is not good enough) we must convince then to merge changes

(or just put "+1")

 

https://github.com/OpenELEC/OpenELEC.tv/pull/4564

 

Thanks all ! and special @johnodon for make this progress :)

 

btw. i made many test of speed 9p and read articles, and thats true is slow, mostly becuase many people say this solution is not finished yet ....

i belive this is true.

 

I've added my support but I do seem to remember LT asking a similar thing and getting denied... but I may be just getting confused..

Link to comment

It looks good, but from what I remember it was the same request from Limetech. Let's hope no grumpy Openelec coder comments on it  ;D

 

Yeah but LT made pull request for add aditional project called unRAID. And there was more changes like in scripts mkimage, image etc.

(this is more job for OE dev, keeping live next project)

Here we only add modules to kernel to Generic version

 

we need to also solve the issue with audio card passthrough and bitstream support.

 

I loaded up the LT template and it also has the same issue.

 

AMD card ?? on Nvidia card i dont have any problems ....

Link to comment

I haven't had any problems with bitstream when I tested it.

The only thing I remember from setting it up was that I had to change audio device after enabling passthrough.

 

What did you change?  I have no options to change anything.

 

After poking around a bit more today, I did realize that OE is showing that I am using Gallium 0.4 which it seems has no drivers on OE.  So, not sure what and why this would happen, but in the Arch forums I saw that seeing gallium means it is using the HW accelerated driver...

 

I am willing to try anything you may suggest.  My only thought was that it is an issue with the passthrough, but now it may not seem the case any more.

Link to comment

I haven't had any problems with bitstream when I tested it.

The only thing I remember from setting it up was that I had to change audio device after enabling passthrough.

 

What did you change?  I have no options to change anything.

 

After poking around a bit more today, I did realize that OE is showing that I am using Gallium 0.4 which it seems has no drivers on OE.  So, not sure what and why this would happen, but in the Arch forums I saw that seeing gallium means it is using the HW accelerated driver...

 

I am willing to try anything you may suggest.  My only thought was that it is an issue with the passthrough, but now it may not seem the case any more.

I'll look at it later today when I get some time.

Link to comment

It looks good, but from what I remember it was the same request from Limetech. Let's hope no grumpy Openelec coder comments on it  ;D

 

Yeah but LT made pull request for add aditional project called unRAID. And there was more changes like in scripts mkimage, image etc.

(this is more job for OE dev, keeping live next project)

Here we only add modules to kernel to Generic version

 

I looked it up and saw that they made some more changes after I posted  :)

So Limetech basically just added their own build also instead of just using the generic version?

Link to comment

It looks good, but from what I remember it was the same request from Limetech. Let's hope no grumpy Openelec coder comments on it  ;D

 

Yeah but LT made pull request for add aditional project called unRAID. And there was more changes like in scripts mkimage, image etc.

(this is more job for OE dev, keeping live next project)

Here we only add modules to kernel to Generic version

 

I looked it up and saw that they made some more changes after I posted  :)

So Limetech basically just added their own build also instead of just using the generic version?

 

Correct.  They could not get an agreement from the OE team to add the virtio modules.  However, I think the bigger issue was the was the way that LT is mapping /storage.

 

I agree with piotrasd that the changes he is asking to be implemented are very innocuous and only help to expand the definition of the "generic" image by allowing support for additional platforms.

 

John

Link to comment

I haven't had any problems with bitstream when I tested it.

The only thing I remember from setting it up was that I had to change audio device after enabling passthrough.

 

What did you change?  I have no options to change anything.

 

After poking around a bit more today, I did realize that OE is showing that I am using Gallium 0.4 which it seems has no drivers on OE.  So, not sure what and why this would happen, but in the Arch forums I saw that seeing gallium means it is using the HW accelerated driver...

 

I am willing to try anything you may suggest.  My only thought was that it is an issue with the passthrough, but now it may not seem the case any more.

I'll look at it later today when I get some time.

 

I still have no success here.  Even after enabling audio passthrough, I have only one audio card listed:  HDA ATI,@@@  All 3 of my VMs (all Radeon HD6450s) display the same behavior.

 

WLys9ym.png

 

94vDZZt.png

 

My understanding is that after enabling passthrough you should now have multiple selections...one includes the A/V receiver + audio card.  From what I read, this is a linux specific issue and I have seen the same thing on Ubuntu + Kodi VM.  Windows 10 + Kodi = passthrough works without issue on same hardware (VM).

 

John

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.