File README of Package systemd-vboxinit

+==============================================================================================+
|                 ____                         _   _       _                                   |
|                / ___|  ___  _ __ ___   ___  | \ | | ___ | |_ ___  ___                        |
|                \___ \ / _ \| '_ ` _ \ / _ \ |  \| |/ _ \| __/ _ \/ __|                       |
|                 ___) | (_) | | | | | |  __/ | |\  | (_) | ||  __/\__ \                       |
|                |____/ \___/|_| |_| |_|\___| |_| \_|\___/ \__\___||___/                       |
|                                                                                              |
+==============================================================================================+


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

The VirtualBox package that is running in your system might/does have an init script which is
mostly located in  /etc/init.d/*  such  as the vboxes,  vboxautostart-service or you may have
your own way of doing the "autostart" of your virtual machines. You will need to disable them
if you suspect of any conflicts with VBoxAutostart.

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

The standard output of the unit VBoxAutostart  is  syslog+console therefore  you  can  see it
while booting  and stopping your host. If you  have the silent flag in your /etc/default/grub
you need to press the <ESC>  key while booting and stopping your host. You can change the sil
ent flag to  verbose  in /etc/default/grub  by editing  it. An example of doing it is running
the following commands as root.

 cp -v /etc/default/grub /etc/default/grub.orig

 ex -sc '%s/silent/verbose/ge|x' /etc/default/grub

 grub2-mkconfig -o /boot/grub2/grub.cfg


OpenSuSE has "yast2 bootloader" for doing such task.

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

If  you  want  to  run  your vms (without running it at the background)  after logging in and
with X server running you  can  edit the  systemd-vboxinit  script and replace  headless with
either gui or sdl. You can call that  script using your  ~/.xinitrc  file  or  some  DE  such
KDE  has   the  "autostart"  option  to  run  programs/scripts  during log-in. You cannot run
systemd-vboxinit  in the  background  if you have replaced headless  with the  other  options
The daemon starts before the  X server so  your  vms  will just crash and  it makes no SENSE!

An example of editing the script:

Running it with the normal "gui" option.

  ex -sc '%s/headless/gui/ge|x' systemd-vboxinit

Running it with the "sdl" option.

  ex -sc '%s/headless/sdl/ge|x' systemd-vboxinit


Add the code below in your autostart file/script (during log-in).

  /usr/lib/systemd-vboxinit.d/systemd-vboxinit --start


Just be prepared to be greeted with  your vms when you log-in :-), Dont forget to disable the
VBoxAutostart daemon!
------------------------------------------------------------------------------------------------

For some convenience  setting/getting  extrada to your virtual  machines  copy the  ExtraData
script (which came with  this  package and should be in the same directory as this README) to
your "$HOME"- /bin and make it executable. As a normal user run the following.

  cp -v ExtraData "${HOME}/bin"

  chmod +x "${HOME}/bin/ExtraData"

Now call the script.

  ExtraData

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

The reason  systemd-vboxinit  was moved from  /usr/bin to /usr/lib/systemd-vboxinit.d/  is to
avoid  accidentally stopping  your virtual machines  by simply running systemd-vboxinit stop.
Now if you  want to avoid typing the long absolute PATH and you promise to be responsible :-)
there are two options.


1.) Using a function in your "${HOME}/.bashrc" like the code below and save it.


systemd-vboxinit() {
  vboxinit=/usr/lib/systemd-vboxinit.d/systemd-vboxinit
  if [[ -f $vboxinit && -x $vboxinit ]]; then
    /usr/lib/systemd-vboxinit.d/systemd-vboxinit "$@"
  fi
}


And then source it, run:

  source "${HOME}/.bashrc"

After that you can just run:

  systemd-vboxinit <TAB> + <TAB>

This solution avoids messing with PATH.

2.) If you really prefer to use the PATH solution, for OpenSUSE add the code below to your
    "${HOME}/.profile"  and save it. Check the documentation of your distro if your are not
    using openSUSE.


  if [[ -f /usr/lib/systemd-vboxinit.d/systemd-vboxinit ]]; then
    [[ -x /usr/lib/systemd/systemd-vboxinit ]] && PATH=$PATH:/usr/lib/systemd-vboxinit.d
  fi


And then source it, run:

  . "${HOME}/.profile"

After that you can just run:

  systemd-vboxinit <TAB> + <TAB>

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

One more to thing to add is  that you do not need  to configure or  edit some config files in
order for your virtual machines to autostart and save state. Multi-user support is easy, just
replace the user name after the @ sign in VBoxAutostart service  and enable the VBoxAutostart
daemon one  time as root or  with your all time favorite sudo utility. (Just keep in mind the
host needs resources too!) then as a normal user  you can set  the "auto" flag to the virtual
machines that you want to autostart/autosave and viola!

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

VirtualBox is a trademark of Oracle, the rest by their respective owners and trademark holder.

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

Enjoy folks....


openSUSE Build Service is sponsored by