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”.

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.

Thoughts on OpenSUSE 11.0

Here are my experiences installing OpenSUSE 11.0 on my desktop PC (I had already successfully installed it on a VM). I opted for a KDE 3 desktop – I don’t like Gnome especially and KDE 4 is not ready for day-to-day use as far as I am concerned.

  • No problems at all with mixed IDE/SATA drives and GRUB 😉
  • Usual problems with NVidia drivers (corrupt screen on first entry to KDE). But this time, I could boot into safe mode, add the NVidia repository, install the drivers and restart. Much easier than previously if still not quite perfect.
  • I did have some problems setting up two screens this time but it is the first time I’ve had my big monitor (24″) at install time – I had to fiddle with the settings in the standard screen settings tool before I could get the NVidia settings tool to correctly recognise the size of the smaller screen.
  • I have a small issue with the NVidia drivers. I think that there is an issue with the latest drivers, I get an annoying screen blank every now and then. It is most noticable with some JavaScript enhanced web sites under FireFox for some odd reason. Under OpenSUSE 10.3, this was crashing KDE (which is why I got round to installing 11!)
    UPDATE 2008-07-17: This may, in the end, have been a hardware issue – I reseated the cables and everything is stable at the moment
  • YAST gets better and better. This is where you really see the benefits of being backed by a professional organisation (Novell).
  • You still can’t set up a network bridge in YAST though 🙁
    However, it is easy if you follow the instructions in my previous blog entry.
  • Everything seems a bit faster though that might be down to a fresh install?
  • One thing that is massively faster is installation and update of packages – Phew! At last, one of the biggest issues with SUSE has finally been cracked. It is now very fast indeed.
  • The extra back/forward buttons on my Logitech mouse work without any additional configuration – nice touch! Though the left/right scroll still doesn’t work 🙁
    UPDATE 2008-07-20: Ah ha! This one is due to an oddity in the key-mappings of the Logitech mouse that I use. Hopefully, I’ll now be able to sort this out when I get a chance
  • There is still a bug in YAST that drops the default router at random. this stops Host Networking from working under VirtualBox

What did I install? (For OpenSUSE)

One thing that I didn’t get around to doing since I moved from Ubuntu was to work out how to make a note of what has been installed.

This is slightly complicated by the fact that you can install stuff straight from an RPM file as well as through YAST (from the repositories or 1-click links).

Well, I finally got round to working it out and here is a summary.

To see what you have done with the YAST installers, just look at the log!

sudo cat /var/log/YaST2/y2logRPM | more

But to get everything, use the raw RPM commands:

These commands show the last installed rpm packages


rpm -qa --last | more

Grep for a date:


rpm -qa --last | grep "Sun 23 Mar 2008"

Dont forget that grep takes regex’s


rpm -qa --last | grep ^kde

Another way:


rpm -qa --queryformat '%{NAME} - INSTALLED - %{INSTALLTIME:date}\n'

Or maybe:


rpm -qa --queryformat '%{installtime} %{name}-%{version}-%{release} %{installtime:date}\n' | sort -nr +0 | sed -e 's/^[^ ]* //'

UPDATE 2008-07-18: I don’t know if this feature was available prior to OpenSUSE 11.0 but you can now use the Software Management tool in YAST to generate a nice, XML list of all installed packages. Switch the filter to “Repositories” and select the “@System” repo. Then choose the menu “File/Export”. Very useful.

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.