After some more googling and mucking about, I finally came up with a solution:
1) I concluded that the /etc/defaults/virtualbox
file did not seem to have any effect on anything (just a remnant from the init.d days?). So the user and group settings in that file was wasted.
Solution: Added User=vbox
and Group=vboxusers
in the [Service]
section of the vboxweb.service
file.
2) Some of the problems I had was due to the vboxweb.config
file referring to a pid-file in the /run
folder, and vbox
has no write access to that folder.
First I tried to make a subfolder, owned by vbox
, in which to store the pid file, but I learned that the /run
folder gets wiped at boot time, including all subfolders.
Solution: Created a subfolder in vbox
homedir, and updated vboxweb.config
file with that location.
3) For some reason (which still eludes me), referring to the actual IP address, 192.168.1.12, in config.php
(in the phpvirtualbox
folder) and in the vboxweb.config
file (as mentioned in the original post), did not work at boot time. (A later restart of the service would work though.)
Solution: Updated both config.php
and vboxweb.config
with IP address 127.0.0.1 instead of 192.168.1.12.
Case closed! :o)
...apart for all the questions about why things are the way they are, but I can live with that :o)
BR, Rolf
Ubuntu 16.04 uses systemd instead of init and hence the concept of runlevels
is replaced by the term targets
. So there is indeed a mapping between init-based runlevels and systemd-based targets:
Mapping between runlevels and systemd targets
┌─────────┬───────────────────┐
│Runlevel │ Target │
├─────────┼───────────────────┤
│0 │ poweroff.target │
├─────────┼───────────────────┤
│1 │ rescue.target │
├─────────┼───────────────────┤
│2, 3, 4 │ multi-user.target │
├─────────┼───────────────────┤
│5 │ graphical.target │
├─────────┼───────────────────┤
│6 │ reboot.target │
└─────────┴───────────────────┘
Now, to just change the "runlevels" in 16.04, you can use for eg:
sudo systemctl isolate multi-user.target
To make this the default "runlevel", you can use:
sudo systemctl enable multi-user.target
sudo systemctl set-default multi-user.target
From man systemctl
isolate NAME
Start the unit specified on the command line and its dependencies and stop all others. If
a unit name with no extension is given, an extension of ".target" will be assumed.
This is similar to changing the runlevel in a traditional init system. The isolate command
will immediately stop processes that are not enabled in the new unit, possibly including
the graphical environment or terminal you are currently using
Also have a look at man systemd.special
to know more about the targets in systemd.
Best Answer
If you just need to switch to text mode with no GUI stuff like the X server running, you can use
systemctl
to get your machine to the so-calledmulti-user.target
:You revert this and get back to the desktop (
graphical.target
) by either rebooting or by switching back manually in the same way as above:If you really need a true runlevel change to 3, that can be done using the
init
command, as @terdon pointed out in his comment:You can verify your current runlevel with the
runlevel
command. It will output two letters: the left one is your previous runlevel, whereas the right one represents your current runlevel.You go back to the desktop by setting the runlevel to 5 again:
Important general notes for both methods:
Both switching to
multi-user.target
or runlevel 3 will terminate the X server and kill all GUI applications and your desktop environment. Make sure you closed all sensible applications and saved your work before you start, otherwise their state will be lost!Neither
systemctrl start ???.target
norinit ?
do switch your active TTY. That means, if you run these commands from a terminal emulator on your desktop (normally on TTY7), you will be at a black screen afterwards (optionally with some debug output).It's simply because the TTYs 8-12 are not connected to text consoles but reserved for video consoles to display GUIs. Only TTY 1-7 are text consoles.
So to operate in
multi-user.target
or on runlevel 3, you have to switch to a text console TTY, e.g. by pressing Ctrl+Alt+F1 for TTY1. You get back to the desktop (TTY7) later after you returned tographical.target
or runlevel 5 by pressing Ctrl+Alt+F7 respectively.When you get to such a text console, note that you have to log in again first by typing your username and password as requested.