Child pages
  • 7.3 KVM

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Recent changes in illumos has caused malfunction of VirtualBox package on OI /hipster, thus making it unusable (it is crashing whole system). Since I already had few VB guests, all using zfs volumes, I have decided to try KVM instead...
    • Opening bug at VirtualBox for compiling problems did not show any progress
    • KVM (which also was failing because same illumos change) was easily fixed (see #4410) and OpenIndiana forum could not offer solution for VirtualBox failure problem.
  • I was using Windows guest, so I can run some s/w which is missing for OI platform: Skype, TeamViever, Zoom, etc... (like recent browser versions, since OI Firefox 52 has lack of some ciphers support, for example). This example has purpose to give an idea how to use it, w/o spending hours on digging it from internet...
  • qemu-kvm  has several limitations (as far as I can tell):
    • it has no support of spice libraries, which provide clipboard sharing
    • graphical cards support is poor (maximum I could get is 1024x768, which is really not enough)
  • Using guest GUI also has limitations:
    • both native vga and vnc support are lacking interaction with host MATE environment (shared folders and clipboard)
    • vnc support offers password protection, but you have to use change vnc password command to set it after guest boot (so no other people can access VM)
  • Decided to enable remote desktop "server" on windows (so, user MUST have password set) and to access guest with rdesktop  (present in OI; support both shared folder and clipboards) or xfreerdp  (self compiled; supports shared clipboards, but I could not manage to get support for shared folders) utility
    • First, we need to start guest:

      Code Block
      themeRDark
      languagebash
      titleKVM start
      $ qemu-kvm -m 1536M \
                 -cpu host \
                 -drive file=/dev/zvol/rdsk/mypool/VBoxGuests/WinHD \
                 -k de \
                 -smp 1 \
                 -localtime \
                 -clock unix \
                 -soundhw all \
                 -no-hpet \
                 -bios /usr/share/qemu/bios.bin \
                 -usbdevice tablet \
                 -enable-kvm \
                 -device e1000,netdev=user.0 \
                 -netdev user,id=user.0,hostfwd=tcp::3389-:3389 \
                 -nographic \
                 -daemonize

      NOTES:

      • port 3389 is forwarded to guest (RDP)

      • nographics option can be used ONLY after you were able to have GUI access to guest and enable remote desktop access

      • also, you have to wait a bit, until guest is booted before you try to connect to it
      • RDP window geometry is something you might want to experiment with (1900x1000 fits to my needs)
      • windows NLA security has to be disabled (did not investigated further if there is another way to access to guest via RDP)
    • Connection options (guest has to be booted, obviously, example assume windows user predrag zecevic)
      • rdesktop:

        Code Block
        themeRDark
        languagebash
        titlerdesktop
        :; rdesktop -k de -z -m -x b -u "predrag zecevic" -p <PASSWORD> -g 1900x1000 -a 16 -T Win -r disk:PZ=/nobackup/shared_folder -r clipboard:PRIMARYCLIPBOARD 0.0.0.0 &
      • xfreerdp:

        Code Block
        themeRDark
        languagebash
        titlexfreerdp
        :; xfreerdp -sec-nla -themes -wallpaper -glyph-cache +clipboard /u:"predrag zecevic" /p:<PASSWORD> /kbd:German /audio-mode:1 /compression /bpp:16 /async-update /async-input /geometry /dynamic-resolution /size:1900x1000 /t:Win /v:0.0.0.0 &
    • Various references:
    • Hope this will help someone. My personal favorite is xfreerdp (even w/o shared folder support, because it is somehow "faster" and offers better font rendering). Predrag Zečević2018/10/02
      • Audio problems fixed (see https://unix.stackexchange.com/a/396468)

        Info
        titleWork in Progress

        This page is currently a work in progress. If you would like to improve it, please request a wiki account.

        Table of contents:

        Table of Contents

        Requirements

        Currently KVM on OpenIndiana only supports recent Intel chipsets with VT and EPT instructions. It is also a very fresh port so bugs are to be expected.

        Installing KVM

        Code Block
        pkg install \
            driver/i86pc/kvm \
            system/qemu \
            system/qemu/kvm
        

        Using KVM

        First create a zvol for the guest:

        Code Block
        zfs create -p -V 10G rpool/kvm/myguest/disk0
        

        Create a vnic (assumes e1000g0 as your primary NIC, substitute as necessary):

        Code Block
        dladm create-vnic -l e1000g0 vnic0
        MAC=$(dladm show-vnic -po macaddress vnic0)
        

        Invoke the qemu-kvm command, for example:

        Code Block
        pfexec /usr/bin/qemu-kvm \
                -boot cd \
                -enable-kvm \
                -vnc 0.0.0.0:1 \
                -smp 2 \
                -m 2048 \
                -no-hpet \
                -localtime \
                -drive file=/dev/zvol/rdsk/rpool/kvm/myguest/disk0,if=ide,index=0 \
                -drive file=/path/to/some/cdimage.iso,media=cdrom,if=ide,index=2  \
                -net nic,vlan=0,name=net0,model=e1000,macaddr=$MAC \
                -net vnic,vlan=0,name=net0,ifname=vnic0,macaddr=$MAC \
                -vga std
        
        Warning
        title/usr/bin/qemu

        The /usr/bin/qemu command is vanilla QEMU with no KVM support. You must use /usr/bin/qemu-kvm to use KVM.

        Fresh example

        • Recent changes in illumos has caused malfunction of VirtualBox package on OI /hipster, thus making it unusable (it is crashing whole system). Since I already had few VB guests, all using zfs volumes, I have decided to try KVM instead...
          • Opening bug at VirtualBox for compiling problems did not show any progress
          • KVM (which also was failing because same illumos change) was easily fixed (see #4410) and OpenIndiana forum could not offer solution for VirtualBox failure problem.
        • I was using Windows guest, so I can run some s/w which is missing for OI platform: Skype, TeamViever, Zoom, etc... (like recent browser versions, since OI Firefox 52 has lack of some ciphers support, for example). This example has purpose to give an idea how to use it, w/o spending hours on digging it from internet...
        • qemu-kvm  has several limitations (as far as I can tell):
          • it has no support of spice libraries, which provide clipboard sharing
          • graphical cards support is poor (maximum I could get is 1024x768, which is really not enough)
        • Using guest GUI also has limitations:
          • both native vga and vnc support are lacking interaction with host MATE environment (shared folders and clipboard)
          • vnc support offers password protection, but you have to use change vnc password command to set it after guest boot (so no other people can access VM)
        • Decided to enable remote desktop "server" on windows (so, user MUST have password set) and to access guest with rdesktop  (present in OI; support both shared folder and clipboards) or xfreerdp  (self compiled; supports shared clipboards, but I could not manage to get support for shared folders) utility
          • First, we need to start guest:

            Code Block
            themeRDark
            languagebash
            titleKVM start
            $ qemu-kvm -m 1536M \
                       -cpu host \
                       -drive file=/dev/zvol/rdsk/mypool/VBoxGuests/WinHD \
                       -k de \
                       -smp 1 \
                       -localtime \
                       -clock unix \
                       -soundhw all \
                       -no-hpet \
                       -bios /usr/share/qemu/bios.bin \
                       -usbdevice tablet \
                       -enable-kvm \
                       -device e1000,netdev=user.0 \
                       -netdev user,id=user.0,hostfwd=tcp::3389-:3389 \
                       -nographic \
                       -daemonize

            NOTES:

            • port 3389 is forwarded to guest (RDP)

            • nographics option can be used ONLY after you were able to have GUI access to guest and enable remote desktop access

            • also, you have to wait a bit, until guest is booted before you try to connect to it
            • RDP window geometry is something you might want to experiment with (1900x1000 fits to my needs)
            • windows NLA security has to be disabled (did not investigated further if there is another way to access to guest via RDP)
          • Connection options (guest has to be booted, obviously, example assume windows user predrag zecevic)
            • rdesktop:

              Code Block
              themeRDark
              languagebash
              titlerdesktop
              :; rdesktop -k de -z -m -x b -u "predrag zecevic" -p <PASSWORD> -g 1900x1000 -a 16 -T Win -r disk:PZ=/nobackup/shared_folder -r clipboard:PRIMARYCLIPBOARD 0.0.0.0 &
            • xfreerdp:

              Code Block
              themeRDark
              languagebash
              titlexfreerdp
              :; xfreerdp -sec-nla -themes -wallpaper -glyph-cache +clipboard /u:"predrag zecevic" /p:<PASSWORD> /kbd:German /compression /bpp:16 /async-update /async-input /geometry /dynamic-resolution /size:1900x1000 /t:Win /v:0.0.0.0 &
          • Various references:
          • Hope this will help someone. My personal favorite is xfreerdp (even w/o shared folder support, because it is somehow "faster" and offers better font rendering). Predrag Zečević2018/10/02