Technology Tales

Adventures & experiences in contemporary technology

Manually adding an entry for Windows 7 to an Ubuntu GRUB2 menu

21st November 2010

A recent endeavour of mine has been to set up a dual-booting arrangement on my Toshiba Equium laptop with Ubuntu 10.10 and Windows 7 side by side on there. However, unlike the same attempt with my Asus Eee PC where Windows XP coexists with Ubuntu, there was no menu entry on the GRUB (I understand that Ubuntu has had version 2 of this since 9.04 though the internal version is of the form 1.9x; you can issue grub-install -v at the command line to find out what version you have on your system) menu afterwards. Thankfully, I eventually figured out how to do this and the process is shared here in a more coherent order than the one in which I discovered all the steps.

The first step is to edit /etc/grub.d/40_custom (using SUDO) and add the following lines to the bottom of the file:

menuentry 'Windows 7' {
set root='(hd0,msdos2)'
chainloader +1
}

Since the location of the Windows installation can differ widely, I need to explain the “set root” line because (hd0,msdos2) refers to /dev/sda2 on my machine. More generally, hd0 (or /dev/sda elsewhere) refers to the first hard disk installed in any PC with hd1 (or /dev/sdb elsewhere) being the second and so on. While I was expecting to see entries like (hd0,6) in /boot/grub/grub.cfg, what I saw were ones like (hd0,msdos6) instead with the number in the text after the comma being the partition identifier; 1 is the first (sda1), 2 (sda2) is the second and so on. The next line (staring with chainloader) tells GRUB to load the first sector of the Windows drive so that it can boot. After all that decoding, my final remark on what’s above is a simple one: the text “Windows 7” is what will appear in the GRUB menu so you can change this as you see fit.

After saving 40_custom, the next step is to issue the following command to update grub.cfg:

sudo update-grub2

Once that has done its business, then you can look into /boot/grub/grub.cfg to check that the text added into 40_custom has found its way in there. That is important because this is the file read by GRUB2 when it builds the menu that appears at start-up time. A system reboot will prove conclusively that the new entry has been added successfully. Then, there’s the matter of selectively to see if Windows loads properly like it did for me, once I chose the correct disk partition for the menu entry, that is!

Taking SUDO beyond Ubuntu

27th October 2010

Though some may call it introducing a security risk, being able to execute administrator commands in Ubuntu using SUDO and GKSU by default is handy. It’s not the only Linux distribution with the facility though because the /etc/sudoers file is found in Debian and I plan to have a look into Fedora. The thing that is needs to be done is to add the following line to the aforementioned file (you will need to do this as root):

[your user name] ALL=(ALL) ALL

One that is done, you are all set. Just make sure that you’re using a secure password though and removing the SUDO/GKSU permissions is as simple as reversing the change.

Update on 2011-12-03: The exact same can be done for both Arch Linux and Fedora, The same file locations apply too.

Enabling DVD playback in Ubuntu 9.04

22nd July 2009

This information is scattered about the web but I decided to collect something together in one place in case it helps anyone else. Here are two commands that appeared to do the deed for me:

sudo apt-get install ubuntu-restricted-extras totem-xine libxine1-ffmpeg libdvdread4

sudo /usr/share/doc/libdvdread4/install-css.sh

The libdvdread piece is what sorts out encrypted disks and needs a two stage installation, hence the second command. For non-encrypted disks, ubuntu-restricted-extras might be all that’s needed if my experience is typical. Taking things further, Wim Wenders’ Buena Vista Social Club (Region 2 disk) worked when I tried it too. In the interests of completeness, I tried the command combination on a virgin 9.04 installation with restricted and multiverse repositories enabled. Along the way, I spied a whole raft of helper components being set in place and things worked like I would have expected with the aforementioned DVD afterwards. As with anything related to computing, your mileage may vary and, for more information, you can take a look here.

Forcing Ubuntu (and Debian) to upgrade to a newer distribution version

8th October 2008

Updates tab from Ubuntu Software Sources screen

Ubuntu is usually good at highlighting the existence of a new version of the distribution through its Update Manager. That means that 8.10 should be made available to you at the end of the month so long as you have sorted the relevant setting for 8.04 to realise what has happened. That lives in System > Administration > Software Sources > Updates. If you haven’t done that, then 8.04 will continue regardless since it is a long term supported release.

Otherwise, it’s over to the command line to sort you out. One of the ones below will do with the first just carrying out a check for a new stable version of Ubuntu and the second going all the way:

sudo update-manager -c

sudo update-manager -p

if you are feeling more adventurous, you can always try the development version and this checks for one of those (I successfully used this to try out the beta release of Intrepid Ibex from within a Wubi instance on my laptop):

sudo update-manager -d

Neither of the above are available on Debian so they seem to be Ubuntu enhancements. That is not to say that you cannot force the issue with Debian; it’s just that the more generic variant is used and, unless, you have gone fiddling with visudo, you will need to run this as root (it works in Ubuntu too):

update-manager --dist-upgrade

A quick way to do an update

8th August 2008

Here’s a quick way to get the latest updates on your PC using the command line if you are using Ubuntu or Debian:

sudo apt-get update && sudo apt-get upgrade

Of course, you can split these commands up if you prefer to look before you leap. At the very least least, it’s so much slicker than the GUI route.

  • All the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. As regards editorial policy, whatever appears here is entirely of my own choice and not that of any other person or organisation.

  • Please note that everything you find here is copyrighted material. The content may be available to read without charge and without advertising but it is not to be reproduced without attribution. As it happens, a number of the images are sourced from stock libraries like iStockPhoto so they certainly are not for abstraction.

  • With regards to any comments left on the site, I expect them to be civil in tone of voice and reserve the right to reject any that are either inappropriate or irrelevant. Comment review is subject to automated processing as well as manual inspection but whatever is said is the sole responsibility of the individual contributor.