Flashing the BIOS from Linux (Phoenix BIOS)

I haven’t looked at the BIOS on my ageing ASUS A8N-SLI motherboard for ages – in fact not since I switched it fully to Linux – so how do you update the Phoenix BIOS without DOS or Windows? I don’t bother with a floppy disk any more and creating a DOS boot CD just for this once every x years job is a faff!

Well there is an article here that might help.

Hmm, apparently that article doesn’t really help – except that it tells you ways to create custom bootable CD’s containing DOS, the BIOS updater and the BIOS file. Ho hum, I guess I’ll get round to it soon as I am looking to put a dual core Athlon in the PC which requires a new BIOS.

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.

Changing backspace to go back through history (FireFox for Linux)

Us old-time Windows bods get used to our keyboard shortcuts I’m afraid. One of the most useful is using the backspace key in the browser to go back through the browsers history.
Unfortunately, this is not the default under Linux (alt-left arrow is the default).
FireFox has an easy way to fix this. Put “about:config” in the address bar and “backspace” in the search entry. You should see the entry “browser.backspace_action”. Change this to 0.

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.

What Linux system files might need editing?

Whilst great strides have been made by the Linux community to provide GUI’s for many tasks, it is still a command line driven OS at it’s heart. This, of course, is one of its strengths as everything can be scripted too. However, for none IT techies, it is very daunting.

Here I’m listing some of the system files I’ve had (or at least wanted) to change by hand. It’s a very quick reference, largely for my own benefit should I need to rebuild my system.

  • /etc/X11/xorg.conf
    Even now you might need to hand crank this file to get all of the settings you need
  • /etc/bash.bashrc.local
    SUSE does not include /sbin in the default path
  • /etc/cups/cupsd.conf
    Printer server subsystem (CUPS) configuration – may need to tweak the access permissions
  • /etc/cups/mime.types
    Added some stuff to speed up printing from the FireFox web browser. See the article on Google Answers for details
  • /etc/fstab
    What and how disk partitions get mounted at boot time – may need to change permissions or may wish to remove certain entries
  • /etc/host.conf
    See nsswitch.conf
  • /etc/hosts
    Useful to override host name to address mappings for development and testing work
  • /etc/motd
    What people see if they log in to your system using a command line shell
  • /etc/nsswitch.conf
    Controls how network names are looked up. Tweaking this can make DNS lookups a lot faster
  • /etc/samba/smb.conf
    Configure access to Windows type resources on the host machine
  • /etc/samba/smbfstab
    Configure if/how the host system automatically mounts Windows resources from other machines so that they appear as Linux mounts. Use this rather than /etc/fstab if you want the embedded password only visible to the root user
  • /etc/sudoers
    Which users can sudo. You can also configure particular applications to automatically get sudo privaledges if you want to (hint: it is rather nice to set up a script that updates all installed software packages)
  • /etc/sysconfig/network/ifcfg-br0
    If you want to bridge two network interfaces (see the last post for information on why you would want to do this), you have to set things up by hand
  • /etc/sysconfig/network/ifcfg-eth1
    SUSE has an excellent GUI for managing network interfaces but just occasionally you might need to manually tweak one
  • /etc/sysconfig/network/routes
    The SUSE network configuration GUI seems to have a tendency to loose the default route
  • /etc/syslog-ng/syslog-ng.conf
    Configure logging levels
  • /etc/syslog.conf
    As above
  • /etc/udev/rules.d/50-udev-default.rules
    UDEV handles automatic creation of device files based on event rules. On my system I had to tweak the permissions on a USB scanner so that the scanning software VueScan could get access. You can also add rules to run scripts when certain hardware is detected.
  • /usr/NX/etc/node.cfg
    Configuration for the NX server. NX is a method of getting remote access to the screen of a machine.
  • /usr/NX/etc/server.cfg
    As above

This list applies to a desktop machine running OpenSUSE 10.3

It is quite likely that some of these files do have a GUI but sometimes it is just easier to get in there and edit.

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.

What stops me finally parting company with Windows

Will I ever be free of Microsoft? Well, unlike many people I’m not really evangelistic about this. I’ll use whatever gets the job done properly. My main reason for ditching Microsoft products is due to their overly restrictive and greedy licensing without really giving real innovation in return.

So why can’t I escape? Well one of the main reasons is that I am constantly faced with Microsoft products through my job as an IT consultant. While I am more likely today than ever before to end up with a mixed environment, MS still owns most of the desktop and much of the server market in my customer base.

That aside, it is mainly for personal reasons that I want to be free at home so why do I still need to run MS dependent software? Here is the list of products I still need Windows for:

  • Memory Map
    This is a great map display and navigation tool for which I have the whole of the UK at 1:50,000 scale. In fact there is no good mapping application for Linux as far as I can tell and certainly not one that will display UK Ordnance Survey maps. In fact, there doesn’t seem to be any navigation software for Linux either. Hopefully this will change with the advent of more Linux based mobile phones
  • Google Sketchup
    I don’t often get time to do 3D work these days (not like in my bachelor days when I was using a Commodore Amiga for 3D graphics and video!) but when I do, this is likely to be the tool I turn to.
    In fact, I can’t find any easy to use tool that will do architectural 3D under Linux. Lets hope that Google are listening to the call from Linux fans for a proper Linux version like they’ve done with Google Earth

That’s all I can think of for now.

I might of added MS Office to this list as there is certainly nothing to touch this in Linux land. OpenOffice is fine for simple stuff but for those of us who rely on the power of MS Office day-to-day, you quickly find the limitations of OOo. Thankfully, I don’t generally have the need for complex office documents at home so I’ve not listed it here.

Fast storage using tmpfs

Here is a link to an article on using tmpfs (and the commonly pre-defined /dev/shm mount for tmpfs) as a high-speed, in-memory filing system.

This is very handy for small-ish amounts of data in files that get a lot of access. Just remember that you will loose it if the host crashes!

You can use this for SqlLite database files too.

Create turbocharged storage using tmpfs

Living with Firefox

I use Firefox all the time. Both with Windows and Linux but I don’t like the fact that it assumes that you are using Gnome under Linux and doesn’t really play nicely with KDE.

Thankfully there are a few things you can do.

To get printing to use KPrinter (the default KDE print dialog). Choose the printer called Postscript/default and then change the command that is run to kprinter --stdin. Now, whenever you print to that printer, you will get the KDE standard print dialog where you can choose the printer (most importantly, output to PDF) and change the settings.

What is happening is that you are setting a configuration item (see the special Firefox URL about:config) called print.printer_PostScript/default.print_command. If you are happy to always use this setting, you might also like to set print.always_print_silent to true in about:config (add it as a new string entry if it does not exist). Now you wont see the initial print dialog, you will get a progress box and then the KDE print dialog.

You might also want to get rid of the nasty looking Gnome open/save dialogs too. That’s easily done, again using about:config. This time set the option ui.allow_platform_file_picker to false.

Finally, you may well find that printing from Firefox takes an age. You can fix that by editing /etc/cups/mime.types (as sudo) and commenting out the two lines belonging to the mozilla-ps mime type. I am not sure though whether this has any impact on the quality of the output.

And people say that Linux is ready for the desktop? Hmm.