Reverting VirtualBox Guest Additions 5.0.22 on Ubuntu 16.04

Earlier today I upgraded my installation of Virtualbox on Windows 10 from 5.0.20 to 5.0.22. This also came up with an update to the guest additions which I installed into my Ubuntu 16.04 guest machine.

After a reboot Ubuntu would no longer boot and instead would flicker as it tried to change the screen resolution inside the virtual machine. This is a known problem in VirtualBox (see: https://www.virtualbox.org/ticket/15526).

I’ve managed to revert VirtualBox and the guest additions back to 5.0.20 using the following steps:

  1. On the host OS (in this case Windows 10) reinstall VirtualBox 5.0.20 over 5.0.22 – this was straight forward, I found the old installer in my downloads directory.
  2. Open VirtualBox and start the Ubuntu guest machine, immediately hold down the left shift key. This must be done before the purple splash screen.
  3. At the grub menu that loads select “Advanced Options for Ubuntu” and then select the second menu entry. This entry should contain the word “upstart”.
  4. Once Ubuntu has booted to a console, login.
  5. Switch to the currently installed VirtualBox guest additions install directory
    cd /opt/VBoxGuestAdditions-5.0.22/

    and try and run

    sudo ./uninstall

    I didn’t have much success with this.

  6. Insert the guest additions CD from VirtualBox’s top menu bar.
  7. Mount the CD Rom: 
    sudo mount /dev/cdrom /mnt/cdrom
  8. Switch to the cdrom directory
    cd /cdrom
  9. Reinstall the old version of the guest additons
    sudo ./VBoxLinuxAdditions.run
  10. Reboot Ubuntu and everything “should” be fine.

Completely destroying all data on a Hard Drive

A few days ago while clearing through some old boxes of computer equipment I discovered an old hard drive. This drive had been removed from an old computer that had been disposed of. At the time of disposal I copied all information from the old computer its replacement and kept the old hard drive as a backup in case something went wrong.

Now more than five years later I no longer need the backup and want to dispose of the physical hard drive. But first, I want to ensure that the drive is completely clear of the old data. Connecting the drive to my current computer it can still mount and read the old drive and I can see all the old files on it. It’s good that the backup has lasted this long but to completely wipe the drive of all this old personal data is a little more complex than just selecting all the contents and pressing the delete button or doing a reformat under Windows.

Completely destroying all data on the drive is important. If the drive is not completely wiped (that is every single physical sector on the drive is written over) it is possible that someone using a few pieces of software could bring the old data back from the dead.

To completely nuke the drive I could pay for commercial software or take a hammer to the physical drive. But there is a free way to nuke the drive by using Ubuntu Linux and it’s quite simple to do:

  1. Boot Ubuntu (running from a live CD/USB should work too)
  2. Find the full device path of the drive you want to destroy by running at a terminal:
    sudo gparted

    If you don’t have gparted installed, then install it using

    sudo apt-get install gparted

    Then on the right hand side of the GUI window select from the drop down list of hard drives and check the partitions of each one to confirm the path of the device that you want to nuke is. For instance:

    /dev/sdN
  3. Shred the drive using the following command, replacing the path with the path you found in step 2.
    sudo shred –vzn 1 /dev/sdN

    This command will take a while to run. It will go over the entire drive writing random data into every single physical sector of the drive and then a second time writing zero into every single sector.

Once the command has finished your drive will be completely wiped. It can now be reformatted and reused without any worry about someone being able to resurrect the previously deleted data.

Hacking Ubuntu on a Chromebook

In a few weeks time I’m going to be doing a bit of traveling for work and then a small holiday. As I will be hoping on and off planes and trains, I’m not really keen on taking my primary laptop as it is bulky and not really designed for travel.

After tossing up the pros and cons of tablets, netbooks, and ultrabooks I have bought a Acer C7 Google Chromebook and have managed to get Ubuntu 12.04 running inside a chroot environment. The whole process of getting Ubuntu installed has been much simpler than I was expecting.

For under $300 I now have basically a full lightweight system for travel on which I can watch videos, play music, edit documents, edit photos, and browse the web. While the basic Chrome OS operating system claims all these features, the reality is, it is extremely limited in what it is actually able to do.
Continue reading “Hacking Ubuntu on a Chromebook”

Bumblebee, Optimus, Hybrid Graphics, and Ubuntu

For the last year or so I have been struggling with my laptop overheating under Ubuntu. Upon upgrading to the latest beta of Ubuntu 12.10 I have managed to completely solve the heating problem and as a result increased my battery life by more than an hour.

Two different problems have caused the heating problem. The first, a power-regression bug on i7 processors was resolved in Ubuntu 12.04 with an updated kernel.

The second is caused by the Nvidia Optimus Hybrid Graphics card in my laptop not being properly controlled by Ubuntu. Problems with Hybrid Graphics under linux are well documented and there are quite a few different “solutions” available, however, I have been unable to get any to work until now.

A few months back I installed the Bumblebee project, and despite the packages successfully installing, the hybrid graphics card never worked and battery life remained terrible.

Upon upgrading to the latest Ubuntu beta I noticed a problem in the logs during the install of one of the bumblebee packages: bbswitch-dkms

The package would “successfully” install, however, the terminal output would show that the kernel module was never built.

The problem lies in missing kernel header packages. While the Ubuntu Wiki pages do not detail any requirement for the installation of kernel headers other sites do, however, these other sites only focus on the kernel headers for the currently installed kernel. And, if you update the kernel without new headers, it is possible that the kernel module will no longer work and the overheating problem will return.

This is how I setup my system so that I would always have the latest official Ubuntu kernel and headers with bumblebee working:

1. Install the linux-headers-generic package:
sudo apt-get install linux-headers-generic

2. Setup the Bumblebee PPA:
sudo add-apt-repository ppa:bumblebee/stable

3. Update the package information:
sudo apt-get update

4. Install the bbswitch-dkms package:
sudo apt-get install bbswitch-dkms

Before moving on make sure that the output from the above command shows that the module was successfully installed.

5. Install the rest of Bumblebee:
sudo apt-get install bumblebee bumblebee-nvidia

6. Restart and then test if Bumblebee is working:
a) glxgears
b) optirun glxgears

The second command runs the opengl test using the Optimus graphics card and the output in terminal of the FPS should be much greater than the previous command. Bumblebee should now be successfully installed and you should notice a large decrease in CPU heat and an increase in battery life.

In my opinion during the install of the bbswitch-dkms package a check should be made for the required kernel headers to build the kernel module, if the packages aren’t found a proper error and suggested solution, such as the installation of the headers package should be suggested. A silent fail that keeps the rest of the installation running only provides the end user that false hope that things are working fine.

Recovering from Grub Rescue after upgrading to Ubuntu 11.04

Over the weekend I upgraded one of my computers to the new beta of Ubuntu. Upon restarting the computer I got dumped into grub-rescue with the message missing-xputs. Part of the cause of this was having Adobe CS3 installed in my dual boot with Windows 7.

When you install Adobe products a little DRM program called FlexNet gets installed into your boot sector which is also where grub resides. When grub is upgraded along with Ubuntu it flicks a warning about the FlexNet being in the sector but then continues to install. However, when you restart grub will not run and will be unable to boot your system into either Ubuntu or Windows.

The following instructions is a result of about five hours of googling, reading forums and talking to other linux geeks. The following commands should take about 15 minutes to complete.

This is how I got my system back:

Warning: I cannot gaurantee this instructions will work on your computer. Please read them all before continuing and take extreme care. I am not responsible if these instructions result in corrupt data or the loss of system functionality.

1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing – either 32-bit or 64-bit.

2. Open a terminal

3. Determine your normal system partition

sudo fdisk -l

4. Mount your normal system partition:

sudo mount /dev/sdXX /mnt
Example: sudo mount /dev/sda1 /mnt

5. Mount the critical virtual filesystems:

sudo mount -B /dev /mnt/dev
sudo mount -B /dev/pts /mnt/dev/pts
sudo mount -B /proc /mnt/proc
sudo mount -B /sys /mnt/sys

6. Chroot into your normal system device:

sudo chroot /mnt

7. Attempt to install grub

apt-get install grub-pc grub-common

During install a warning should appear about FlexNet being in one of the sectors. In my case it was sector 51, others have reported it in 32 and elsewhere.

8. Purge grub

apt-get purge grub-pc grub-common

9. Remove the flexnet sector

dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=X

Where X is the sector number grub-install warned about, in my case 51.

10. Reinstall grub

apt-get install grub-pc grub-common

11. Exit chroot

CTRL-D

12. Unmount

sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys
sudo umount /mnt

13. Reboot

sudo reboot

Further References:
https://help.ubuntu.com/community/Grub2#Reinstalling%20GRUB%202
http://ubuntuforums.org/showthread.php?t=1661254

Getting ATI Radeon HD Drivers to work in Ubuntu 10.04 Beta 1

These instructions will hopefully help those who are testing the Beta over the next few days to get full hardware acceleration from their graphics cards.

These instructions are based off Ubuntu’s guide here: https://help.ubuntu.com/community/RadeonHD and I can only comment on my set up, I cannot guarantee that they will work for anyone else.

Firstly make sure that you graphics card is not already working properly, in a terminal type:

glxinfo | grep “renderer string”

If you see “software rasterizing” as the output then the drivers are NOT working right, if you see something else then they most likely are.

First prepare your system for installing the new drivers, do this by removing the old drivers and making sure you have the right libraries installed:

sudo sh /usr/share/ati/fglrx-uninstall.sh

If the file cannot be found then it is good, just means the driver was never installed in the first place.

sudo apt-get purge xorg-driver-fglrx fglrx-amdcccle fglrx-kernel-source xorg-driver-fglrx-dev

Package not found errors here are also really good.

sudo apt-get --reinstall install libgl1-mesa-glx xserver-xorg-core

Make sure that the reinstall of these two packages completes properly. (Note: the reinstall flag has two – before it not one, some web browsers render the double dash as a single long dash).

Next you need to install a new Kernel, Ubuntu 10.04 will ship with 2.6.32 but at a minimum (at the moment) you need 2.6.33, this is simple to do though:

cd ~/

mkdir kerneldebs

cd kerneldebs/

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-headers-2.6.33-020633-generic_2.6.33-020633_amd64.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-headers-2.6.33-020633_2.6.33-020633_all.deb http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.33/linux-image-2.6.33-020633-generic_2.6.33-020633_amd64.deb

sudo dpkg -i linux*

Now reboot and make sure that you boot into the new kernel and not the old one.

Add the following address to your systems software sources:

ppa:xorg-edgers/ppa

Reload the sources list when prompted, then go to update manager, check for new updates, install all the new updates that are listed. Once installed reboot your system.

Now try “glxinfo | grep “renderer string” again and hopefully it will no longer display software raster and instead something a lot more promising.

Ubuntu 10.04 Lucid Lynx First Impressions

Sometime in the next 24 hours Beta 1 of Ubuntu 10.04 Lucid Lynx will be released to the world. This version of Ubuntu is different from the previous few versions for two key reasons the first is that it is a long term support release and as such will be [hopefully] more stable and more complete than other versions over the past year. The second change is in the user interface with a step away from the established brown “human” theme to a new theme that looks very Mac OS like.

For the last two days I have been running the daily build of the AMD64 release candidate for 10.04 Beta 1. So far I am very impressed with it. For the past year I have been running 9.04 as the 9.10 release in October of last year broke support for my laptop’s wireless drivers and would cause frequent lock ups. I am pleased to report that those crashes are a thing of the past in 10.04.

The Good:

  • Fast boot. 9.04 was a massive improvement in boot time over 8.10 and I am surprised to see even more of an improvement in 10.04, from BIOS to logged in would be around 20 seconds.
  • Stable. Sometimes Beta and Test Releases of software are so buggy that they are not even able to be fully tested. So far I have hit a few minor problems but by far I am very impressed.
  • Smooth. The x64 version is very smooth at booting, opening and closing windows, applications, etc. The entire operating system runs quietly and quickly.

The Bad:

  • Crash errors that are almost as cryptic as Windows BSOD and illegal operations. I have had two programs crash and both times the crash errors are just strings of numbers or error codes with no meanings or descriptions. It is very hard to even supply information on a bug report when you have no idea what went wrong, one minute it was working the next it isn’t.

The Ugly:

  • Video Drivers. I am running an ATI Raedon HD Video card and there are no free or propriety video card drivers at the moment. This means that any 2d or 3d video rendering is done through MESA software rendering and is very ugly. I hope this will be sorted out in the final release (and the current bug where if you try to install the old fglrx library aptitude will try to remove ubuntu desktop).
  • Software Install. If you want to install Ubuntu (and community) released software this is a breeze through the Ubuntu Software Manager but the instant you want to install any other piece of software you will need to go through the whole process of getting the source code, resolving dependences, compiling through the terminal sorting out linking errors and a whole lot of other nasty mess.
  • User Experience. Despite the new version of Ubuntu looking very pretty and running very fast it still fails badly in terms of user experience for your average user. Ubuntu is meant to be linux for human beings but I am still finding it linux for those people who want linux to work and have some computing knowledge for how to fix things when they go wrong and also have a linux geek to really fix things when they completely corrupt. Until vendors start releasing fully stable and supported drivers for Linux and there is a software install process for third party applications that works nicely through a simple GUI and not old fashion command windows Ubuntu and Linux in general will continue to only attract nerds, geeks and people who like to break things. I like Ubuntu for its speed and ease of use in a office/development environment. But when I am at home on the weekend I live in Windows. Things just work in Windows – fonts render correctly, most software now plugs and plays correctly, most music and dvds will just play, software is simple to install etc. Now I do not want to start a paid vs free software argument but just because it is free should not mean you need a whole lot of computing knowledge to get your email every morning.

Simulating / Emulating a MPI Cluster or Supercomputer under Ubuntu Linux

Okay a few posts ago I mentioned that I had been successful in setting up my laptop as a virtual supercomputer.

Here are hopefully some relatively clear instructions on how simple it was to do.

Setting up a MPI development system on Ubuntu Linux

  1. Download Ubuntu – check out the latest version at www.ubuntu.com

  2. Intall the required mpi files.

    For Ubuntu 9.04:
    In a terminal window enter:
    sudo apt-get install libopenmpi1 libopenmpi-dbg libopenmpi-dev openmpi-bin openmpi-common openmpi-dev

    For Ubuntu 10.04:
    In a terminal window enter:
    sudo apt-get install libopenmpi1.3 libopenmpi-dbg libopenmpi-dev openmpi-bin openmpi-common openmpi-dev

  3. Test the mpi install by compiling and running a simple program

    1. mpicc testfile.c -o testfile

    2. mpirun -np 2 ./testfile

      1. Where np is the number of cores * number of processes on your system.

      2. e.g. on a two core laptop np should be 2.

  4. If you get an error regarding ssh when you enter the mpirun command install ssh

    1. sudo apt-get install ssh

  5. If you get requested for your password everytime you run mpirun set up a stored RSA key control

    1. cd $HOME

    2. ssh-keygen -t dsa

    3. cp .ssh/id_dsa.pub .ssh/authorized_keys2

Further reference:

http://www.csc.cam.ac.uk/academic/practicals.html

http://www.math.umbc.edu/~gobbert/mpi.html