OpenSolaris – Headless server

I’ve moved from a CentOS linux distro running vmware server 2.0 to OpenSolaris running VirtualBox. My previous system was totally headless and i wanted something similar to replace it.

I’ve just started getting into OpenSolaris for many reasons (Sun has some cool stuff – ZFS / VirtualBox). But I have always wanted to run OpenSolaris as a headless server, and from what i initially found VirtualBox didn’t have the easy to use autostart on boot features that vmware server had. But there are always ways to get things working…

OpenSolaris 2008.11 has desktop sharing (system->preferences->desktop sharing) which is half of the job — enable this.

I had issues if i used a password protected session (it kept prompting on the actual console for password to unlock the key chain), so chose not to prompt for password for now. Now every time after you have logged in you are able to connect to your machine via VNC. (veno-server)

The other half of the problem is how to have the machine automatically log on as a user on boot-up. This is easily enabled via /etc/x11/gdm/custom.conf or gdmadmin. See this post for more details on the autologon.

Updated : 26/07/2009

After a bit of playing about I’ve found another way to make opensolaris the perfect headless box. First fire up gdmsetup and enable the required remote sessions.

Go to the “Remote” tab and set the style to “same as local”, then under security ensure that “Deny TCP connections to Xserver” is not checked.

Next go into the services GUI and tick the box next to X server (x11/xvnc-inetd). Next type;

svcs | grep vnc

Disable all vnc services except the one we want to enable (below);

svcadm enable xvnc-inetd

Now to get the vnc session to remain open when you disconnect update the service with the following parameter change;

svccfg -s xvnc-inetd setprop inetd/wait = boolean: true

Reboot. Done.

You should upon reboot be able to vnc straight into the box with a session that wont reset on disconnect.

OpenSolaris – SMF and VirtualBox

So… i’m looking for a way to fire up some VirtualBox machines after a reboot on OpenSolaris. SMF is the key. Just need to create some XML docs that fire up a couple of headless vm’s.

Shouldn’t be too hard. Lets see what i can come up with.

Here is a good pdf about migrating Legacy RC services into SMF, which has given me a few pointers….

how to shutdown a vm;

VBoxManage controlvm Test poweroff

how to startup a vm;

VBoxHeadless -s Test -p 3389

Update: so i’ve decided to bypass SMF at this point, which seems to be a really good method of executing (and maintaining) services, but a bit more than what i was after to run Virtualbox on start-up. If you see my other post i have just modified the /etc/profile to auto start the virtual machines and i’ve set the box to autologon on boot.

The problems i had while executing VirtualBox as a service were due to the fact it seemed to require access to the main X11 console (yes – i was using VBoxHeadless). There were a few issues that were thrown up if i didn’t execute from a session. Never looked into this any further…