Announcement

Collapse
No announcement yet.

Ubuntu 18.04 Start Stop VirtualBox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ubuntu 18.04 Start Stop VirtualBox

    Here utilize a lite Windows 7 VB for my multiple SAPI voice fonts and multiple instances of speaker dot exe used for Homeseer.

    Recently upgraded Oracle Virtual box to version 6.0 and noticed my auto starting did not work. I implemented the Oracle way to autostart and it did not work properely.

    Here is a fix that works for me.
    Here have been running a Windows VB on my main automation server which is running Ubuntu 18.04 64 bit and recently upgraded to VirtualBox 6.0.

    I have had issues autostarting the VB using standard virtual box autostart.

    Found a new way to do this this morning and it works well.

    Documenting here on a post.

    Get rid of vboxautostart-service

    1 - sudo systemctl disable vboxautostart-service
    2 - sudo rm -rf /lib/systemd/system/vboxautostart-service.service
    3 - sudo rm -rf /etc/vbox

    User permissions for Virtualbox

    1 - type groups to see if you are in the vboxusers group

    IE:
    pete@ICS-HS3Pro:~$ groups
    pete adm cdrom sudo dip plugdev lpadmin sambashare vboxusers

    2 - if not put yourself in the vboxusers group typing:
    sudo usermod -a -G vboxusers pete

    3 - type groups again to make sure you are in the group vboxusers

    New Unit File for systemd

    1 - Create a new Unit file
    sudo nano /etc/systemd/system/vm_autostart_name.service
    IE: sudo nano /etc/systemd/system/vm_autostart_W7.service

    2 - use this text as a template: (I used vm_name=W7)

    [Unit]
    Description=VM vm_name
    After=network.target vboxdrv.service
    Before=runlevel2.target shutdown.target

    [Service]
    User=richard
    Group=vboxusers
    Type=forking
    Restart=no
    TimeoutSec=5min
    IgnoreSIGPIPE=no
    KillMode=process
    GuessMainPID=no
    RemainAfterExit=yes

    ExecStart=/usr/bin/VBoxManage startvm vm_name --type headless
    ExecStop=/usr/bin/VBoxManage controlvm vm_name acpipowerbutton

    [Install]
    WantedBy=multi-user.target


    Reload systemd daemon

    sudo systemctl daemon-reload

    Using the service

    1 - Enable the service

    sudo systemctl enable vm_autostart_name

    2 - Start, Stop and Status of service

    sudo systemctl start vm_autostart_name
    sudo systemctl stop vm_autostart_name
    sudo systemctl status vm_autostart_name

    That's it. Works great over here.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.8X
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.8X
    HS4 Pro - V4.0.5.0 - Ubuntu 18.04/W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.8X
    HS4 Lite -

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

  • #2
    found that:

    ExecStart=/usr/bin/VBoxManage startvm vm_name --type headless

    works great except that it doesn't pass the audio for the SAPI that I am using.

    Changing the line to:

    ExecStart=/usr/bin/VBoxManage startvm vm_name

    worked to pass the SAPI audio.

    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.8X
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.8X
    HS4 Pro - V4.0.5.0 - Ubuntu 18.04/W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.8X
    HS4 Lite -

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

    Comment

    Working...
    X