Flashing the BIOS from Linux (OpenSUSE 11.0)

I’ve been a bit quiet here recently because I’ve mainly been working with my business laptop currently running Windows 7. You can see more about this on my other blog – Much Ado about IT.

However, the power supply on that died recently so I’m back to my trusty desktop which runs OpenSUSE 11.0 24×7.

I managed to get hold of an upgraded CPU for this a while back but I’ve not really had an incentive to upgrade till now. The new CPU supports hardware virtualisation but I need to enable this in the BIOS. Of course, this machine (based on an ASUS A8N-SLI Deluxe motherboard) has an old BIOS that doesn’t allow me to turn on these features so I needed to upgrade to the latest (v1805).

But, I only run Windows under VirtualBox on this computer and I don’t have a floppy drive so updating a BIOS is no trivial matter!

After some Googling, here is the answer:

  1. Install the coreboot-utils package
  2. As root, at a command prompt, run “flashrom” to check that your chipset is supported for writing
  3. Extract the .bin file from the archive containing the updated BIOS image
  4. Make a backup of the existing BIOS with “flashrom -r backup-bios.bin”
  5. For the paranoid, try writing that backup back to the BIOS with “flashrom -wv backup-bios.bin” to ensure there are no errors. Reboot at this point for the really paranoid
  6. Now flash the new BIOS with a similar command to step 5
  7. Reboot and check that the new BIOS is OK

If you get an error from flashrom saying that the new BIOS is the wrong size, you may have had a problem unpacking the bin file from the archive as I did. Unpack the whole archive to a folder.

If flashrom doesn’t work for you, there are lots of other ways – I like using GRUB to boot from a floppy disk .img file – very “Linuxy”.

Sun’s VirtualBox gets on with it!

Yep, I keep being amazed by the quality of VirtualBox which is now owned by Sun.

I need to set up a virtual machine to test and demo Sun’s Identity Management (IdM) suite and it needs to be usable with VMware too. So I headed over to the VMware Appliances web site and downloaded a pre-canned Debian 5 server.

This is recognised fine by VirtualBox! I gave the VM a Host Networked connection to the network and with no further configuration, fired up the VM. First thing was to install some additional components so I used the Debian package manager (aptitude) from the command line (no windowing GUI here!) to install the file and database and web server virtual packages. It just worked, no networking problems at all and being a Host network, it is on my local LAN as well as the Internet with no problems.

It’s nice when things “just work”. That’s how it should be!

Of course, it probably wouldn’t have been quite so simple if I wanted a desktop as well. But there are also a number of pre-canned VirtualBox VM’s for downloading.

VirtualBoxImages and HelpDeskLive.


Technorati : , , ,
Diigo Tag Search : , , ,

Enabling VirtualBox access to USB ports (OpenSUSE 11.0)

By default, OpenSUSE 10 & 11 come preconfigured WITHOUT usbfs active. Unlike Ubuntu, everything is ready to go but the fstab setting is “noauto” so it doesn’t seem to get loaded even when VirtualBox wants it.

The fix for this is simple and is listed in the VirtualBox User FAQ. In “/etc/fstab” change the line for usbfs to:

 usbfs /proc/bus/usb usbfs auto,busgid=XXX,busmode=0775,devgid=XXX,devmode=0664 0 0 

Where XXX is the group id of the vboxusers group which can be discovered in YAST or from the command line:

 grep vboxusers /etc/group 

That’s it, no other changes should be needed.
Now mount it with:

 mount usbfs

(All of these commands and edits have to be done by root or sudo).
OpenSUSE 11.0 does not automatically mount the usbfs on reboot so either do it manually after a reboot and before using VirtualBox or find a way to activate it automatically (and let me know hey? 😉

Update 2008-08-17: Thanks to “timdor” from the OpenSUSE Forums who lets me know a way of automatically mounting usbfs.
“To mount usbfs at boot add ‘mount usbfs‘ without the quote marks to /etc/init.d/boot.local“. Thanks timdor.

VirtualBox, sharing a Linux hosts file system in a Linux guest

When you want to access the hosts file system from a guest OS in VirtualBox, you need to mount the virtual share. However, the default mount:

sudo mount -t vboxsf <VBox-share-name> <mount-location>

Will mean that only root can write to the shared folders. You need to tweak things to get a system that an ordinary user can write to. Here is the script I use:


#!/bin/bash

echo " "
echo "Script to mount the host disk under VirtualBox"
echo " "

USR=`whoami`

SHARE='Host-Root'
MNT="/home/$USR/VBoxHostRoot"

echo "  Mounting $SHARE to $MNT ..."

mkdir $MNT

sudo mount -t vboxsf -o uid=$USR $SHARE $MNT

echo "  Done."
echo

You can, of course, have this mounted by the guest OS at boot time by putting an entry into /etc/fstab. Just make sure that every user that is set up has the appropriate folder created or move the folder to somewhere central and give it permissions so that all users have read/write access.

Development Virtual Machine (VirtualBox)

I’ve been thinking ahead to a change of job recently. Knowing that I’ll be getting a new Windows based laptop and needing to have development capabilities and having developed a taste for Linux 😉

I’ve used my favourite VM tool VirtualBox (now owned by Sun) to create a sparlkly new OpenSUSE 11.0 virtual machine complete with Apache, MySQL, PHP, etc. as well as office tools such as Open Office, mind/concept-mapping and diagraming applications.

Unlike the Windows XP VM that I use on my Linux desktop to give me access to Windows applications – which needs 2GB of RAM to perform nicely, the SUSE VM only needs 1GB of RAM to feel as fast (even though XP doesn’t have Apache, MySQL, etc. running.

Although I’ve created this on my Linux desktop, it should be easy enough to transfer to my new laptop. To help keep file sizes down, I’ve chosen to use three virtual disks. One for SWAP, one for /home and one for the root. This will make it a bit easier to transfer back and forth if I need to – though I’ll probably end up with two separate and different copies as I’m already finding that doing personal development work is much easier on the VM than it is on the host OS thanks to it being a more focused machine with less rubbish installed.

Bridged networking in OpenSUSE 10.3 & 11.0 (For VirtualBox)

I prefer to use VirtualBox rather than VMware as it seems to be rather faster and less resource hungry than VMware Server (the only free version of VMware with a GUI). Also VirtualBox seems to have better Linux host support (sound, etc.).

However, there is one thing that VMware is better at – setting up the guest network on the same network as the host.

Under VirtualBox this is called “Host Interface Networking” and, with a Linux host anyway, is a right royal pain to set up. This is because VirtualBox uses the powerful and flexible bridging capabilities of Linux – but they have no easy GUI setup!

So here is my summary of getting host interface working on my OpenSUSE 10.3 desktop. Firstly though, note that I have two network cards. I am not going to mess with eth0 as this is the card I use for the main network from my desktop. Instead I am going to configure eth1.

  1. Install the package “bridge-utils”
  2. Follow the instructions at the OpenSUSE web site to set up a basic bridge. You will end up with a new file in /etc/sysconfig/network called “ifcfg-br0” containing something like:
    ## Bridge 0 config - to allow VirtualBox to use
    ##    Host Interface Networking mode with eth1
    
    STARTMODE='auto'
    BOOTPROTO='static'
    # Change the above to dhcp to use your networks
    # dhcp server to assign an address
    # (the next 2 lines are then ignored)
    IPADDR=192.168.3.1
    NETMASK=255.255.0.0
    # Note that the above puts the bridge onto a different
    # subnet to my main network but that I use class B
    # addressing to ensure everything can talk
    NETWORK=
    BROADCAST=
    STARTMODE=auto
    USERCONTROL=no
    NAME='Bridge 0'
    NM_CONTROLLED=no
    BRIDGE='yes'
    BRIDGE_PORTS='eth1'
    BRIDGE_AGEINGTIME='300'
    BRIDGE_FORWARDDELAY='0'
    BRIDGE_HELLOTIME='2'
    BRIDGE_MAXAGE='20'
    BRIDGE_PATHCOSTS='19'
    BRIDGE_PORTPRIORITIES=
    BRIDGE_PRIORITY=
    BRIDGE_STP='on'
    
    

    I think that you may also need to tell the bridge where your default router is. Create a file in the same place as above called ifroute-br0 containing:

    default 192.168.1.1 -
    

    (or whatever your router is).
    Then, when you’ve done a “/etc/rc.d/network restart” as sudo, you should see that eth1 and br0 both come back up.
    Note that it is possible that you have to change eth1 to give it a manual IP address of 0.0.0.0, netmask 0.0.0.0 for it to work correctly (as per the instructions in section 6.7.1.2 of the VirtualBox manual – note that some of the rest of those instructions seem to be incorrect). Note that SUSE 11.0 at least has a setting for this in YAST (edit the card config and select none for address assignment).
    The ethernet card eth1 is now indirectly used via the bridge br0.
    Here is my ifcfg-eth1.

    BOOTPROTO='static'
    BROADCAST=''
    ETHTOOL_OPTIONS=''
    IPADDR='0.0.0.0'
    MTU=''
    NAME='ASUSTeK Marvell 88E8001 Gigabit Ethernet Controller (Asus)'
    NETMASK=''
    NETWORK=''
    REMOTE_IPADDR=''
    STARTMODE='hotplug'
    USERCONTROL='no'
    

    UPDATE 2008-07-18: In addition to the above, you must create a default route – but don’t do it via YAST! YAST has a bug that often deletes the default route. Instead, put the following line in the file “/etc/sysconfig/network/routes“:

    
    default 192.168.1.1 - -

    Note the two dashes at the end

  3. Create a permanent interface for VirtualBox to use (also called a “tap” interface) with the command:
    sudo VBoxAddIF vbox0 <user> br0
    

    Where is the VirtualBox user running the VM – I guess you have to do this for every user who might run the VM.
    If you run the command “ifconfig” you will now see a new network interface called vbox0 which will reappear along with br0, ethx, etc. every time you reboot.
    Note that these VirtualBox interfaces can only be used once so if you have two VM’s, you will need two interfaces. Also note that VirtualBox has a method of creating dynamic interfaces (that only appear when you want them) but that is more complex to set up.

  4. Now tell your VM configuration to use this interface.
    You can do this via the GUI by putting the required name (vbox0) into the network settings box “Interface Name” under the HIS section. Or you can do it with the command:

    VBoxManage modifyvm "My VM" -hostifdev1 vbox0
    
  5. Make sure that the guest OS is running the network connection with DHCP so that it gets the correct address, gateway, DNS, etc.
  6. You might need to set a default gateway in the host OS.

Job is done!! After some years of attempting this on and off, it has finally come together and all works. Hopefully this little list is enough to get you going.

Regards, J.

UPDATE 2008-08-12: It seems that there is something slightly amis with the above instructions. On reboot, the network is not quite left in the correct state and you have to do a “/etc/rc.d/network restart” before host networking will actually work.

UPDATE 2008-08-22: Oops, sorry but I got the addif command wrong, it was missing the userid bit. Rats! Blogger keeps eating the < symbol.