How to fix your Windows MBR with an Ubuntu liveCD

windows-mbr.jpgSomething happen to a windows Master Boot Record (MBR) that you’re responsible for? Want a very quick, very easy way to restore it with nothing but your craft, native intelligence and a liveCD?

Be cautious here – you’re working with your disks in a very direct manner. If you don’t have everything backed up or are unsure of anything, you may want to wait until you have a standard Windows CD/DVD.

Boot into your Ubuntu LiveCD on the offending machine. Once Ubuntu starts up, go to System -> Administration -> Software Sources and enable (by checking it off) the Universal repository.

Now, open a terminal session (Applications -> Accessories -> Terminal) and type the following:
sudo apt-get install ms-sys
ms-sys is a program used to write Microsoft compatible boot records.

Now you’ll need to figure out what partition is the one hosting your Windows operating system. Back in the command line, type:
sudo fdisk -l
That will list the available partitions. You’re looking for a partition that says something like
/dev/sda1 1 9327 74919096 83 NTFS
The two important bits are the ‘/dev/sda1‘ which is the partition itself and the ‘NTFS‘ which tells us it’s a Windows formatted partition. So your Windows partition exists on your drive sda and it’s partition 1. The MBR for drive sda (assuming you boot into windows using it’s native boot loader) is what you want to repair.

We want to fix the MBR on /dev/sda. To do so, type:
sudo ms-sys -m /dev/sda
You’ll want to change the ’sda’ bit if your results from ‘fdisk -l‘ are different. If for instance your windows install is on sdb or hda.

Once you do that, reboot the machine, removing the LiveCD from the drive and Windows should come back to you.

Sure, you could do this by inserting the correct Windows CD and booting into repair mode from it – but I find the Ubuntu way a bit faster and I’m more likely to have an Ubuntu LiveCD on me than a Windows CD. For alternative ways make sure to search through the posts on our homepage.

Get USB devices mounted on your Virtualbox XP machine in Gutsy (Ubuntu 7.10)

vbox.pngThere’s nothing more frustrating than not being able to mount your USB devices in your virtual machines. Well, maybe there are lots of things that are more frustrating but this morning my inability to do something that should be simple, easy and fun was driving me nuts.

So I figured out how to do it and decided to share this software solution on Arsgeek. It’s not terribly pretty but here’s what you need to do.

First, Gutsy got rid of the previous versions of Ubuntu’s way of handling USB mounts by not using USBFS anymore. Doh. That’s an issue for Virtualbox and your virtual XP installs. So you’ll need to download and install the latest Vbox release, 1.5.2. Click on that link to download the .deb file. Save it on your desktop and then double click on it to install it.

For a quick and easy tutorial on using Virtualbox and installing a virtual XP instance, see UbuntuGeek.

Once you have your virtual XP machine running on your Gutsy host, it’s time to do a wee bit of hacking. Turn of your XP instance and let’s roll up our sleeves and get to work.

First, open a terminal session (Applications-> Accessories-> Terminal) and type in the following to edit a script file:
gksudo gedit /etc/init.d/
Once you’ve got that open in Gedit, type CTRL-F to search for a string. Search for ‘magic’ (sans quotes).

That should bring you to this:
# Magic to make /proc/bus/usb work
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

All those pound signs are comments. Remove them from the last four lines so you end up with this:
# Magic to make /proc/bus/usb work
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Save the file and exit Gedit. Round one goes to the user!

Now we’re going to create a group called usbusers. Go to System-> Administration-> Users and Groups. Type in your password and then click the Manage Groups button. From there click the Add Group button and name it usbusers. Check off your username below. Exit these windows and round two goes to us.


Now we’ve got to change a file in udev. So, let’s gedit it and gedit over with. I’ll apologize for the bad jokes in a later post.
gksu gedit /etc/udev/rules.d/40-permissions.rules
Again, CTRL-F to bring up the search dialog and search for ‘usbfs replacement’ (again, sans quotes). Once you find it, you should be looking at this:
USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, MODE=”0664″

You’ll want to change it to this:
# USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, GROUP=”usbusers”, MODE=”0664″

Save your file and exit out of Gedit.

Now, the last bit of hackery which may or may not be required for you. It was for me. We’re going to add a mount to /etc/fstab for usb devices using usbfs.
gksudo gedit /etc/fstab
At the bottom, add the following line:
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0
Save the file and exit Gedit. Phew! Now, the easiest way to get all of these changes working on your system is to restart it. So go ahead and do that and then I’ll see you back here in a few.

Back? Great. Time to plug in your USB device, whether it’s a thumb drive, an iPod or something else, plug it in and let Ubuntu detect it.

Now, we’re going to open up Virtualbox and make some changes to your XP machine BEFORE you start it up. So go to Applications-> System Tools-> Virtualbox and get it started up.

Highlight your XP machine (if it’s not the only instance of a virtual machine) and click the Settings button at the top of Virtualbox. You should now have a USB option on the left hand side of your settings. Click the add icon on the right hand side (see the pic below) and select the device from the list. In my example, it’s a 512MB memory key. Now click the Okay button.


Start up your virtual XP machine and you will see a notice pop up courtesy of Ubuntu about unsafe device removal. Nod your head sagely and let’s continue on. Once XP is up and running, it should automatically detect the new USB device, and do it’s best to install it. With my memory key, it was as simple as turning the virtual XP machine on and letting XP take care of it.

You may have to go to the Devices menu on your virtual machine (once it starts up) select USB Devices and then uncheck whatever it is you’re trying to mount. Repeat the process, this time checking it off and it should mount if it didn’t automatically.

How to make your Vista Shutdown button actually shut down your computer

With an unmodified Vista install, when you click on your little round start button thingy, and then click on the Power button to turn of your pc, your pc doesn’t really turn off. It goes into Vista Sleep. I dislike this and here on ArsGeek I will cover a hack to solve this.


I dislike this on general principle. Especially for dual boot machines. When I tell my computer to turn off, I mean off, not nodding into sleep.

Here’s how you can modify your Vista install to turn your box off.

First go to (ready it’s a long one!) Start -> Control Panel -> Hardware and Sound -> Power Options -> Change Plan Settings (this will be below your current power plan) -> Change Advanced Power Settings.


Phew! Wasn’t that fun?

Now that you’re finally where you want to be, let’s make the change. Look for Power Button Use and Lid. Expand that and find Start Menu Power Button. Change this from Sleep to Shut Down.


Click OK and the next time you mouse jam your Vista power button, your computer will do the right thing.

Windows Vista on VirtualBox – the networking fix

vbox_logo2_gradient.pngWe’ve written a bit about VirtualBox in tech/business section of ArsGeek, so you’re probably familiar with this easy to use x86 virtualization tool. It supports Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD and a bunch of other OSes as well.

Vista however, can present a problem. There are no built in network drivers for the virtual NIC that VBox implements. Without a network connection, it gets kinda hard to download and install the appropriate drivers. If you’re on Ubuntu or a Debian based distro, here’s what to do.

First we’ll get the appropriate driver:
Now, we’ll have to unzip it.
unzip -d vista
We’ve just made a folder called ‘vista’ with all of the driver info needed. Lastly, we’ll create an ISO image from this folder.
mkisofs -o vista.iso -R vista
Once that’s complete, you can mount the ISO through VirtualBox and restart your virtual Vista install.


When you boot into Vista, you’ll right click on My Computer, choose Manage and then update the driver with software on the ‘cd’ you have mounted.


Yod’m – Like Beryl for Windows

I recently stumbled upon Yod’m (Yet another desktop manager 3d) which looks a bit like Linux’s Beryl, but for Windows XP and Windows Vista.


You can download it here and while you’re doing that, check out their other project Visual Tooltip here: Visual Tooltip.

VT is basically a thumbnailer of windows in the taskbar.


Between the two of these, you can get some of your Beryl goodness on your windows machine.

How to Enable More Than 4 GB of Memory in 32-Bit Vista installs

Windows Vista 32-Bit cannot by default detect more than 4 GB of physical RAM. This limit is set becausevista1.jpg beyond 4 GB, many 32-Bit operating systems lose efficiency in managing memory.

You can manually bump this up however if you have a machine with more than 4 GB of memory and only have access to the 32-Bit versions of Vista.

Click on the start pebble and in the search area type:


Don’t hit the enter key however. You’ll see that after you type cmd in the search box, cmd.exe will appear in the programs list.  You’ll have to open this as an administrator.   To do this, right click on it and choose Run as Administrator.

Once your command prompt is open, type:

BCDEdit /set PAE forceenable

BCDEdit is a boot configuration editor for the command line. Using the above command you’ve just enabled Physical Address Extension (PAE) which can address memory larger than 4 GB.

The 64-Bit versions of Vista can support between 8 GB and 128 GB of RAM depending on what version you get your hands on.