Sunny Affairs

Workaround for VMware Fusion "hanging" at the early boot process

Sunday Dec 30, 2007

Are you using Solaris on VMware Fusion? And are getting irritated staring at a black screen (sometimes with a single cursor), waiting for Solaris to start booting right after the GRUB menu? Well, there is a work around.

I have been facing the same thing for a pretty long time, till I found out the reason at Jim Laurent's blog. Ok, so the actual elaborated reason is this. There is some kind of bug in Fusion that would cause it to hang for 3-4 minutes at the early boot process (ie just after you select the boot option from the GRUB) when a 64-bit kernel tried to load. So you stare at the blank screen cursing Fusion and Solaris and other associated things that comes to your mind (I did that everytime I booted the VM before switching to do some other things while the VM revives from its "hanged state"). So then what I did was removed the old VM and created a new 32 bit VM. Even then the same thing would repeat. Now why should such a thing happen when you have created a 32 bit processor for the VM. Its because Solaris by default first checks if the booting system is 64 bit capable and even if you create a VM for Solaris 32-bit, it doesn’t disable the 64-bit, long-word instruction support. I found the reason here and it further on leads to this page that contains a solution.

So you have to simply add one line to the configuration file (.vmx) of your virtual machine.
monitor_control.disable_longmode = 1
Yes this does it. But somehow I was not satisfied by just this much. So I decided to change the behavior of Solaris ie force it to boot in 32 bit mode everytime.

So while searching for a work around this one I reached this page. In this documentation Sun has clearly explained the booting process of Solaris 10, which of course is very similar to that of OpenSolaris. At Solaris installation time, a set of default values are chosen for the system and stored in /boot/solaris/bootenv.rc. We can change the settings by editing the GRUB menu or modifying the bootenv.rc file indirectly via the eeprom command. Needless to say, you'll need root privileges for these operations.

Forcing Solaris to load 32 bit kernel

So firstly the longer method ie editing the GRUB menu youself. In case you dont want to get into the technicalities, look below for the second option:
The GRUB menu settings are stored in a /boot/grub/menu.lst. In case you have not made changes, the menu.lst file is well commented to explain each property. The lines which begin with a # are comments. menu.lst on a single partition, single HDD system, by default will look like this:

#pragma ident "@(#)menu.lst 1.2 07/01/10 SMI"
#
# default menu entry to boot
default 0
#
# menu timeout in second before default OS is booted
# set to -1 to wait for user input
timeout 10
#
# To enable grub serial console to ttya uncomment the following lines
# and comment out the splashimage line below
# WARNING: don't enable grub serial console when BIOS console serial
# redirection is active!!!
# serial --unit=0 --speed=9600
# terminal serial
#
# Uncomment the following line to enable GRUB splashimage on console
splashimage /boot/grub/splash.xpm.gz
#
# To chainload another OS
#
# title Another OS
# root (hd<disk no>,<partition no>)
# chainloader +1
#
# To chainload a Solaris release not based on grub
#
# title Solaris 9
# root (hd<disk no>,<partition no>)
# chainloader +1
# makeactive
#
# To load a Solaris instance based on grub
# If GRUB determines if the booting system is 64-bit capable,
# the kernel$ and module$ commands expand $ISADIR to "amd64"
#
# title Solaris <version>
# root (hd<disk no>,<partition no>,x) --x = Solaris root slice
# kernel$ /platform/i86pc/kernel/$ISADIR/unix
# module$ /platform/i86pc/$ISADIR/boot_archive

#
# To override Solaris boot args (see kernel(1M)), console device and
# properties set via eeprom(1M) edit the "kernel" line to:
#
# kernel /platform/i86pc/kernel/unix <boot-args> -B prop1=val1,prop2=val2,...
#
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris Express Community Edition snv_72 X86
kernel$ /platform/i86pc/kernel/$ISADIR/unix
module$ /platform/i86pc/$ISADIR/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
kernel /boot/platform/i86pc/kernel/unix -s
module /boot/x86.miniroot-safe
#---------------------END BOOTADM--------------------

If you look closely, the kernel and module path in the menu item titled Solaris Express Community Edition snv_72 X86 contains a variable $ISADIR, which is actually expanded to a value "amd64", if Solaris finds that the system is 64 bit capable. Thus, when ever a 64 bit capable system boots, the kernel that is loaded is /platform/i86pc/kernel/amd64/unix. The 32 bit kernel is actually located at /platform/i86pc/kernel/unix.

So we have to simply modify two lines. Replace
kernel$ /platform/i86pc/kernel/$ISADIR/unix
module$ /platform/i86pc/$ISADIR/boot_archive
by
kernel$ /platform/i86pc/kernel/unix
module$ /platform/i86pc/boot_archive

You can use any editor to make this modification. I used the vi editor. So save it, once you have made the changes and then reboot your VM.

The second method is a lot quicker. Just run the following command in the terminal
eeprom boot-file="kernel/unix"

Thats it. Just reboot your system and you'll see a new option in the GRUB menu, that would be highlighted and is the new default: Solaris bootenv rc

Actually this new menu will load the 32 bit kernel, while the previous default option ie Solaris Express Community Edition snv_72 X86 (build may be different) still boots into the 64 bit kernel

When you come down to what changes it has made, it has just made one extra entry to the GRUB menu:
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris bootenv rc
root (hd0,0,a)
kernel /platform/i86pc/kernel/unix
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
#BOOTADM RC SAVED DEFAULT: 0

....and made it the default option.

Chalo enjoy playing with the GRUB and switching the kernel mode. And more importantly no need to stare at that black screen in VMware.

[8] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg
Comments:

I have followed the steps described, and when I "cat /boot/grub/menu.lst" it correctly shows that it has been changed, however each time I reboot it seems to revert back to the old version, whereby it tries to boot into the 64 bit kernel, once again hanging (not even for a few minutes, mine hangs indefinitely).

Am i editing the wrong file? (This is Nexenta BTW)

Posted by Bert JW Regeer on February 22, 2008 at 04:36 PM IST #

I am sure you are editing the right file. But since I have not worked on the Nexenta distro, I cant really comment on what problem it might be.

Posted by Souvik on March 06, 2008 at 01:37 AM IST #

This doesn't work for me on the current (non-Open) Solaris. It complains that that kernel is an unsupported file when I try to boot it. That's a drag because we'd really like to test some things here in both 32- and 64-bit mode. :-(

Posted by A Braunsdorf on June 03, 2008 at 02:00 AM IST #

OK, got it working. The example up there isn't quite right. What you want is:

title Solaris 10 (32-bit)
kernel /platform/i86pc/multiboot kernel/unix
module /platform/i86pc/boot_archive

Right?

Posted by A Braunsdorf on June 03, 2008 at 02:22 AM IST #

Well, the Solaris distribution that I had used is quite old now. It is possible that the Grub entries has had few changes since then. The example I had quoted worked perfectly on build 72. Maybe the current version uses the example shown by you.

Posted by Souvik on June 03, 2008 at 08:33 AM IST #

So, I'm using OpenSolaris 2008.05 and VMware Fusion 2.0 beta1, and I think I encountered this bug -- I thought vmware machine was completely hanging.

So, my question is -- what if you /want/ the 64-bit machine? Do you just have to grin and bear it?

Posted by Armando Di Cianno on June 16, 2008 at 05:59 AM IST #

I guess you have to, unless this problem is fixed. Till now the 64-bit Solaris kernel hasn't been able to boot promptly on VMware fusion. You might like to have a look at other Virtualization tools such as Virtualbox. At the same time I wonder why would you want to run Solaris on 64 bit in a virtual environment. I believe you do not share enough memory with the virtual machine to take advantage of 64-bit capability.

Posted by Souvik on June 16, 2008 at 08:52 PM IST #

My goal is to get OpenSolaris running on an HP MediaSmart Server ( http://www.newegg.com/Product/Product.aspx?Item=N82E16859105382 ), as it's cost is exactly what I want to be spending. I'd like to OpenSolaris on it for ZFS, and then share files over NFS and CIFS.

I plan to either natively compile a handful of various services and software I'd like to run, manually or using Gentoo's Prefix Portage, and then copy them from the VM to the actual server.

So, really, just want to run an environment close to what I'm going to attempt to deploy on.

Posted by Armando Di Cianno on June 16, 2008 at 09:08 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed