A guided tour of my KDE 4.8.4 desktop (Part 2)

In A guided tour of my KDE 4.8.4 desktop (Part 1) I gave a brief overview of the KDE desktop on my main laptop. This time I’m going to cover some applications, KDE and non-KDE, that I use. Just to prove that I don’t look at KDE through rose-tinted spectacles, I’ll also mention a few problems too.

I don’t use a desktop PC. This laptop is my main PC and I use it for all my professional and personal tasks. I travel frequently and have to connect to public and private networks (wired, wireless and broadband modems) and to many different network printers, so a reliable desktop environment and reliable network management software are essential. KDE satisfies the first requirement. The desktop environment-independent NetworkManager and its KDE front-end, the Plasma widget NetworkManagement, satisfy the second requirement. I also use my laptop for the usual leisure activities such as watching DVDs, video files and TV programmes; listening to music files, Audio CDs and Internet radio; messaging/telephony (PC-to-PC and PC-to-landline/mobile internationally); browsing the Web, blogging and so on.

So this is very much a mission-critical machine for me. The fact that I’m using KDE successfully for all these tasks is a testament to the power of KDE (and Linux, of course). I should also point out that, for a mission-critical machine, I’m living a little dangerously as I use the testing branch (a.k.a. unstable branch), rather than the stable branch, of Gentoo Linux. I’ve been using the unstable branch for several years on this laptop and its predecessor, with only a few hiccups, although I do have to keep an eye on the Gentoo forums in case someone reports a problem.

Office suites

Microsoft Word and LibreOffice Calc

Snapshot 1 - Microsoft Word and LibreOffice Calc

I use both LibreOffice and Microsoft Office 2007, the latter under WINE (see WINE tips: Giving each Windows application its own environment). Office 2007 guarantees me 100 per cent compatibility at work but I also find it easier and more reliable than LibreOffice with the large, complex documents and spreadsheets I create. That said, I also have many Word 97 documents and Excel 97 spreadsheets that I still need to access, and LibreOffice opens some of them that Office 2007 cannot. I prefer to use Writer rather than Word for simple tasks such as typing a letter, as I dislike the Ribbon Interface. And I’m happy to use Calc rather than Excel in the majority of cases.

Once I got Office 2007 running under WINE I did not have to boot into Windows any more, although recently that changed for one very specific task on one work project: checking out (downloading) a Microsoft Word file from a Microsoft SharePoint repository, editing it locally and checking it back in (uploading it). Using Firefox in Linux I can upload a Word file to the SharePoint repository initially, but I have to boot into Windows and use Internet Explorer and Word to check-out, edit and check-in the revised document. I’ve used third-party document management and collaboration software in the past that does not require the use of Internet Explorer and Word. I can see how Microsoft lock you into their product line, and I don’t like that.

For schematic diagrams and flowcharts I usually use an old version of Visio (5 Professional) I bought in 1999, again under WINE. I find Visio easier and faster to use than Dia, a GNOME application I also use sometimes for simple diagrams.

E-mail client

I use Thunderbird to access several POP3 e-mail accounts and, via the excellent DavMail, a couple of Microsoft Exchange OWA (Outlook Web Access) accounts at different companies. DavMail is a life-saver. Having to access those two accounts via a Web browser was a hassle and inefficient. A single e-mail client which can be used to access and manage all my e-mail accounts is a godsend. I still have work e-mails from more than ten years ago, and Thunderbird enables me to find information in them with ease. For professional use by ‘power users’, WebMail cannot hold a candle to a good e-mail client such as Thunderbird. I use a number of Thunderbird extensions which I find essential: Lightning (calendar); Provider for Google Calendar (bidirectional access to Google Calendar); Timezone definitions for Mozilla Calendar; Change quote and reply format (why isn’t this functionality built-in to Thunderbird?); ConfigDate (ditto); Enigmail (encyption/decryption of e-mails); ImportExportTools (conversion tools for different e-mail formats); Dictionaries for several languages.

One of the reasons I chose Thunderbird was because it is available for both Linux and Windows. As I can dual boot this laptop, I put Thunderbird’s data files on the Windows NTFS partition (Windows cannot access Linux file systems), and Thunderbird in either OS accesses the same data files. I virtually never boot into Windows, but it is good to know that I can access my e-mail accounts from either operating system using the same application.

Scanning

I occasionally use SANE scanner interface software and its GUI front-end XSane for scanning images and documents to create image files. But I am much more likely to use the GUI front-end gscan2pdf, as I often need to create PDF files for work. gscan2pdf is another application I find indispensable.

Web browsing

Browsers and Google Earth

Snapshot 2 - Browsers and Google Earth

I use Firefox and the KDE browser/file manager/universal viewer Konqueror. I configured Konqueror to use the WebKit rendering engine instead of KHTML (Install the package kwebkitpart then launch Konqueror, select Settings > ‘Configure Konqueror…’ and select ‘WebKit’ as the ‘Default web browser engine’ on the General tab). There have been a few times when Firefox has not been able to display a Web page properly or at all, and Konqueror came to the rescue. The KIO Slaves I mentioned in Part 1 also add to Konqueror’s versatility.

I use the Oxygen KDE Firefox extension (see Snapshot 2), a theme for Firefox that makes it look like a native KDE application. Very nice indeed.

Google Earth needs no introduction. It runs well in KDE on my laptop, and I find it useful both in my work and for personal use.

I have the KDE blogging client Blogilo installed and it was easy to configure it to synchronise with my blog. In fact I started preparing this article in Blogilo but had to abandon it as Blogilo would not save reliably my incomplete work to my hard disk. After losing changes several times I gave up and turned to my tried and tested KWrite to draft the article offline first. Shame, really, as Blogilo looks really handy for preparing blog posts offline and then uploading them. Hopefully the next release will work for me.

For Web site creation and editing I use KompoZer. It’s not as sophisticated as Dreamweaver, but is easy to use and does a good job for my purposes.

Messaging and telephony

I use Skype for Linux for PC-to-PC and PC-to-phone communication domestically and internationally. There is simply no alternative if I want to communicate with my Windows-using friends, family and work colleagues: they are not going to switch to anything else. Actually, I find Skype for Linux perfectly usable (unlike Skype for Android on my Motorola Xoom tablet, which has a fiddly and rather annoying user interface). In some countries the state-owned telecom provider blocks Skype for commercial reasons, but I have been able to circumvent this using Tor (see How to install and use Tor for anonymous browsing or to access country-restricted content from another country). Furthermore, some office networks I use also block Skype, to enforce the use of another product or to stop personal communication, but Tor has helped me out there too.

Graphics

I use the GIMP quite a lot, mostly for photo editing/retouching for work purposes but sometimes to edit/retouch personal photos. I have only used the vector graphics application Inkscape a few times at work and at home. I enjoyed using it to produce the graphics for a laptop ‘Powered by’ sticker.

Gwenview

Snapshot 3 - Gwenview

Apart from the excellent KDE image viewer Gwenview, which gets better with every release of KDE, I use GQView. GQview has been around for many years and its UI looks rather dated, but it has some powerful features which I find useful at work (and at home). GQview makes it easy for me to assign keywords to image files and to search on keywords; to examine EXIF data; to print thumbnail proof sheets; to view multiple image files and page through directories of image files, and so on. This application has often been of help to me at work.

Okular and Adobe Reader

Snapshot 4 - Okular and Adobe Reader

KDE’s Okular document viewer and Adobe Reader are in frequent use on my laptop. I use them both but resort to Adobe Reader for the huge PDF files I sometimes have to view at work, as they load quicker in Adobe Reader. Also, Okular has had a rather irritating habit of printing Landscape pages in Portrait, and vice versa. This problem seems to come and go with different releases of Okular.

CAD

I hardly ever need to use CAD applications, but occasionally I do need to view some old AutoCAD files. For this I use an old version (2009-en-1.06-1) of VariCAD Viewer which opens those old files although it can’t open newer AutoCAD files. I tried unsuccessfully to install newer versions of VariCAD Viewer in the past, but have not tried again recently.

E-books

I only recently began reading e-books. The EPUBReader Firefox extension is an excellent and easy-to-use e-book reader, library manager and shop window for both free and commercical e-books in ePub format. The display of book pages when using the extension as a reader is better than many of the dedicated e-book applications I have seen.

Calibre is an excellent dedicated e-book reader and format converter that I discovered by accident when reading a review of the Amazon Kindle. If you are looking for an application that can handle all the various e-book formats, convert between them, manage your e-book library, upload and download e-books, and act as a reader, look no further. Even the application’s Web site oozes class.

Multimedia

SMPlayer multimedia player, and YouTube in Firefox

Snapshot 5 - SMPlayer multimedia player, and YouTube in Firefox

I have far too many multimedia players installed, but I like to alternate between them. In any case it’s useful to have several players installed because sometimes one of them is able to play a certain file that another cannot.

SMPlayer, VLC and Xine play DVDs, CDs, music files, video files, Internet radio, and digital TV (DVB). I like all three.

Miro is a music and video player, torrent downloader, Internet TV and podcast viewer, and more. Another very polished application I enjoy using.

Dragon Player is a KDE player for CDs, DVDs, audio and video files. It plays DVDs, audio and video files well on my laptop, but cannot play Audio CDs for some reason. It is not as versatile or as polished as the multimedia players mentioned above, so I rarely use it.

UPDATE (January 10, 2014): As of KDE 4.11.3, Dragon Player can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

Clementine music player

Snapshot 6 - Clementine music player

The music players I have installed are Audacious, Clementine and Amarok. These three applications focus on playing and managing collections of music files, Audio CDs and streaming Internet radio.

In the days of KDE 3 I used exclusively Amarok 1.4, which was darn near a perfect music player. But new releases of Amarok were buggy in early releases of KDE 4, and today Amarok still does not work as well for me as the KDE 3 version did. Some of the album covers disappear randomly from the album cover manager, and it is irritating to have to restore covers. Clementine, on the other hand, has no trouble managing album covers and I find it is more polished than Amarok and nicer to use all round. I cannot get Amarok to play Audio CDs with the KDE GStreamer Phonon backend, only with the KDE VLC Phonon backend. Even then the optical drive in my laptop spins very fast and produces a loud noise, making listening to Audio CDs painful. Audacious, on the other hand, plays Audio CDs quietly and perfectly on my laptop. Although Clementine is superb in other respects, for some reason it cannot play Audio CDs on my laptop, whichever KDE Phonon backend is selected. All three players can stream Internet radio without problem, although the long pre-configured list of radio stations in Clementine is simply excellent. If Clementine could play Audio CDs on my laptop, it would be my favourite music player.

UPDATE (January 10, 2014): As of KDE 4.11.3, Clementine can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

MIDI players and Karaoke

I have four different MIDI players installed. PyKaraoke (see HOWTO: PyKaraoke) and KDE’s own KMid can both play MIDI files with and without embedded karaoke lyrics. TiMidity++ is a MIDI file player, as well as an ALSA sequencer which can be used by the other MIDI player applications here. Drumstick has three applications: a MIDI player, a drumkit sequencer and a virtual piano keyboard. I enter the following command once before launching any of them:

modprobe snd_seq && timidity -iA -Os

Actually, I have put the above command in a Desktop Configuration File with a nice icon in my Desktop directory, so I just double-click on it. I could have instead loaded the snd_seq module automatically at startup by specifying it in the file /etc/conf.d/modules.

Audio CDs

KsCD is a simple KDE application with a sole purpose: to play Audio CDs. For me it fails miserably in this task, and has done in several releases of KDE. The last time I remember it working for sure was in KDE 4.3.3, and here we are today with KDE 4.8.4. The KDE Bug Tracking System has quite a few bug reports regarding KsCD. I don’t know if the application itself has a bug, or if the KDE Phonon backends are buggy, or if KDE has a bug, or if there is a problem with udev, or a combination. Anyway, whatever the reason, in my case KsCD is useless. Come to that, for Audio CDs Amarok is next to useless. Luckily for me, Audacious, SMPlayer, VLC and Xine can play Audio CDs perfectly on my laptop.

UPDATE (January 10, 2014): As of KDE 4.11.3, KsCD can play Audio CDs on my laptop. I believe this was due to an update to KDE’s Phonon and/or the Phonon backends.

YouTube

I should mention the excellent command line tool youtube-dl (‘YouTube download’) which is great for downloading videos from YouTube. You can specify the resolution, extract the audio, and various other tricks. Well worth adding to your set of mutlimedia tools. Or, if you prefer a GUI, Minitube is a cracking application for watching and streaming YouTube videos without using a Web browser, and also enables you to download them.

Backing up CDs/DVDs or ripping audio and video

K3b is a superb KDE application. It’s a one-stop shop for making back-ups of CDs and DVDs, creating data CDs and DVDs, and ripping CDs and DVDs. I use K3b to rip my Audio CDs to mp3 files.

Another well-known KDE application is the excellent K9Copy DVD ripper. Unfortunately the developer stopped working on it in July 2011. I hope someone else picks it up, as K9Copy has an intuitive GUI and I have used it on a number of occasions to rip my DVDs to my hard disk so that I could watch them when travelling.

dvd::rip does just what the name suggests, and I’ve used this excellent application too. The GUI is intuitive and the online documentation is very good.

Winki the Ripper is a good application for ripping DVDs to MKV files (it can also rip to AVI files). I have used it but noticed recently that the Web site is up for sale, so I hope the application is still being developed.

WINE

WINE menu in Lancelot Launcher

Snapshot 7 - WINE menu in Lancelot Launcher

I have mentioned Office 2007 already, but I have a few other Windows applications installed under WINE, such as IE7 (so that I can see how a Web site looks in a Windows browser), IrfanView, Lotus ScreenCam Player (so that it is still possible to view some videos of a specialist application running in Windows 95 many years ago), Notepad, Pinball and a few applications and utilities I need that are not available in Linux. WINE is not perfect, but it is wonderful software that also makes it possible to run some older Windows applications that are probably not able to run in Windows Vista and 7.

Utilities

Some utilities

Snapshot 8 - Some utilities

I used to use the brilliant command line utility ImageMagick to scale image files, but have not had to resort to the command line since the GUI front-end Converseen was released (see Converseen, a GUI batch image converter and resizer using Qt4 and ImageMagick).

I encrypt and decrypt some of my sensitive files using GnuPG GUI front-ends KGpg and Kleopatra. Kleopatra is slightly easier to use than KGpg, but they’re much of a muchness. The Enigmail extension I use in Thunderbird also uses GnuPG.

KAlarm is a handy KDE utility to produce sounds or pop-up reminder messages, or issue commands, at specific times or time intervals. The GUI is easy to use and KAlarm can be used in many cases as an alternative to setting up a cronjob. It was simple to configure it as a talking clock (see Setting up a talking clock easily in Linux).

AutoKey is a macro utility I use frequently. It can be used in a number of ways, but I use it to insert text in documents and e-mails. For example, I have configured AutoKey to insert the output of the Linux date command where my cursor is in an open document or e-mail if I press Ctrl-Alt-D: Sun Jul 22 14:41:25 BST 2012. For another example, I have configured AutoKey to enter my full postal address when I type “adr” and press the Space key (but puts it back to “adr” if I press the Backspace key). It is a very handy utility and can be configured to execute simple or complex scripts.

Easystroke is the mouse equivalent of AutoKey. For example, I have configured Easystroke to type “———- Original Message ———-” when I press the mouse scroll wheel and move the mouse pointer diagonally from left to right on the screen. As another example, I have configured it to launch an instance of DavMail to access a specific company’s OWA Exchange Server when I trace the first letter of the company’s name on the screen with the mouse cursor. It’s a clever utility!

BasKet Note Pads is a KDE application for recording and reading notes. The notes can be simple text or complex with embedded pictures, hyperlinks and so on. I switched to BasKet from Tomboy as the latter is a GNOME application and requires some GNOME-specific packages that I didn’t want cluttering up my hard disk. However, I can’t say I like BasKet: I miss the simplicity and easy-to-use UI of Tomboy which was a pleasure to use. I think I may have to try another KDE application (KJots) instead of BasKet, as it may fit my needs better.

KRename is a batch file renamer for KDE that has come in handy both at work and at home.

Filelight is a KDE utility that shows you graphically how much of each partition is occupied and how much is free. I like it because it makes it easy for me to see at a glance how much disk space I have left.

JDiskReport is another utility for showing you disk occupancy graphically. You can select pie carts, segment charts or bar charts. It is freeware but not open-source, but is nevertheless a nice utility to have in your set of tools.

Antivirus software

BitDefender Antivirus for Unices

Snapshot 9 - BitDefender Antivirus for Unices

As I run some Windows applications under WINE, and as I dual boot with Windows 7, I use both BitDefender Antivirus Scanner for Unices and ClamTk, the GUI front-end to ClamAV. That way I can scan my Windows directories from Linux. My work colleagues sometimes pass work files to me on USB pen drives, and I use these two anti virus utilities to scan the pen drives just to be a bit safer. Yes, it has flagged the occasional malware in Windows files.

Games

Games

Snapshot 10 - Games

I hardly ever play games, but still installed the entire KDE Games suite (you never know, after all!). Of the KDE games, I play KPatience, KCheckers, KBlocks (a Tetris clone), KBreakOut (takes me back to playing BreakOut written in Applesoft BASIC on an Apple II+!) and KMahjongg, a solitaire game using beautifully rendered Mahjong tiles.

I have also installed a few non-KDE arcade games such as Missile Command and Pacman Arena (nicely done in 3D). I loved Pac-Mania on my Acorn Archimedes in the early 1990s, so I also use SDLMame and its GUI front-end GMameUI to play Pac-Mania and a few other old favourites such as Frogger.

As far as chess is concerned, I installed the 3D DreamChess, as well as the older but perfectly decent XBoard and eboard.

Scrabble and Boggle are popular games in my family, so I installed XScrabble and GBoggle, the latter being one of only a handful of the packages mentioned in this article that I had to install outside the Portage package manager because there is no ebuild (another being the commercial game Machinarium, which is available for Linux, beautiful and I recommend highly).

I occasionally play TORCS, which is not bad for a car racing game.

There are a lot more Linux games to discover, if you’re that way inclined.

Summary

I’ve just scratched the surface, but hopefully have given you a taste of how I use KDE (and Linux). Of course my needs and uses are different from everyone else’s, but I hope this and the previous article have shown you the breadth of KDE and Linux applications, and that they are completely viable on the desktop. If you have not tried KDE yet, I hope this has tempted you. And, if you’re new to Linux, I hope this has tempted you to try Linux too.

The best way to dual boot Linux and Windows

I’m going to explain how to configure your PC in order to dual boot Linux and Windows Vista or Windows 7, assuming Windows is already installed.

If you already have Windows Vista or Windows 7 installed in a single partition, then the method described below is the best way of ensuring that your Windows installation will still be bootable even if the Linux installation or GRUB bootloader become damaged in future.

Furthermore, if your PC has a hidden factory restore partition for Windows, the method described below is the best way of ensuring that you will still be able to recover Windows in future using that hidden partition. The reason why this is the best method is because it does not alter the contents of the MBR (Master Boot Record), which, in addition to the Windows bootloader, may contain code created by the manufacturer to boot the hidden factory restore partition instead of the Windows Vista/7 partition if it detects that you pressed a defined key or keys while the PC is booting. If the contents of the original MBR are overwritten — even if it is only by using the Bootrec.exe tool on a standard Windows Vista/7 Installation DVD — then the manufacturer’s code will no longer be in the MBR and so it will no longer be possible to boot the hidden factory restore partition by pressing the key(s) specified by the manufacturer.

Note also that some Windows applications can make a PC using GRUB 2 unbootable if GRUB 2 is installed in the MBR. See the blog article Windows applications making GRUB 2 unbootable for details. The method described below does not install any GRUB 2 code in the MBR, and thus it will avoid this problem.

So, to reiterate, the method described below avoids two potential major problems: 1) it avoids the possibility of making a Windows factory restore partition unusable; 2) it avoids the possibility of Windows applications overwriting some of the GRUB 2 code.

If you already have Windows installed, the procedure to prepare the PC and install Linux is divided into the following three main stages.

Stage 1: Reduce the size of the existing Windows partition

Do not use the partition managers Parted, GParted or KDE Partition Manager to reduce the size of the existing Windows partition, or you will damage your Windows installation.

Step A: Use the Windows defragmenter or a third-party defragmenter to defragment the Windows partition.

Step B: Use Windows’ Disk Management to shrink the partition (see Resize a Partition for Free in Windows 7 or Vista). The problem with this method is that Windows will only shrink the partition until it reaches the MFT (Master File Table), which means there may be free space in the Windows partition that you would have wanted to use in a Linux partition but cannot. However, if you are satisfied with the resulting size of the Windows partition then you can skip Step C below and proceed directly to Stage 2.

Step C: If you cannot shrink the Windows partition to the size you want by using Windows’ Disk Management, then you need to move the MFT (see Working Around Windows Vista’s “Shrink Volume” Inadequacy Problems). Basically you need to download a tool such as PerfectDisk (it has a free trial period) that will defragment the Windows partition and move the MFT in the process.

Stage 2: Create the new partitions for Linux

Boot a LiveCD or LiveDVD which has the partition editor GParted on it, and run GParted to create and format partitions for Linux (for example /, /boot, /home and swap) in the free space you created in Stage 1 above. I prefer to use GParted to create the partitions before running the Linux distribution’s installer, rather than using a partitioning tool integrated into the Linux installer itself. GParted has more functionality and enables better control over the partitioning process than a partitioning tool incorporated in the Linux distribution’s installer. Also, I have found on some occasions that installation of some Linux distributions fails if using the partitioning tool integrated in the Linux installer, but is successful if the partitions were created beforehand.

SystemRescueCD is a good LiveCD to use for running GParted, but any LiveCD/DVD which includes GParted will suffice. You can download the ISO file from the SystemRescueCd Web site http://www.sysresccd.org/Main_Page.

It is only possible to have up to four primary partitions on a hard disk, so, depending on the Linux partitions you decide to create, it is possible that you will need to create an extended partition containing logical partitions. If, for example, your hard disk has a hidden Windows factory restore partition and a partition for Windows itself, and you decide you want to have /boot and /home on separate partitions to the root directory, then one of many possible partitioning schemes would be:

– the hidden Windows factory restore partition (a Primary partition)

– the Windows partition (a Primary partition)

– the /boot partition (a Primary partition)

– an Extended partition containing the following Logical partitions:

– the swap partition

– the / (root) partition

– the /home partition

For example, on my main laptop I created and formatted the partitions /dev/sda3 to /dev/sda7 as follows:

/dev/sda1 – the hidden Windows factory restore partition

/dev/sda2 – the Windows C: drive partition

/dev/sda3 – the Linux /boot partition

/dev/sda4 – an Extended partition containing the following Logical partitions:

/dev/sda5 – the swap partition

/dev/sda6 – the / (root) partition

/dev/sda7 – the /home partition

Note that it is not essential to have /boot, / and /home in different partitions; they could all be in the same partition. However, I would recommend that at least /home be given a separate partition, so that personal files (videos, music, documents, etc.) would not be overwritten if you were to re-install Linux at some point.

You are free to choose your own partitioning scheme, but I create the Linux partitions in the order shown above so that I can assign specific sizes to the /boot, swap and / partitions, leaving the remainder of the disk space free for the /home partition.

If you do decide to put /boot on its own partition, it only needs to be small (I make it around 100 MB). On my laptop the /dev/sda4 Extended partition is around 143 GB so I created a partition of 60 GB for / (root) — which is more than ample — and a partition for /home using the rest of the available space on the laptop’s 320 GB hard disk. You’ll have to decide on the size of these partitions based on the size of the hard disk and the root partition’s space requirements recommended by the Linux distribution’s developers.

If you do not need Linux to be able to hibernate (‘suspend-to-disk’) then a swap partition of 512 MB would be sufficient for the typical desktop PC, especially when the latest PCs come with 4 GB or more RAM. Some people do not even bother having a swap partition at all with such large amounts of RAM. But if you do want Linux to be able to hibernate then try to find out if the Linux kernel which you will be installing was compiled with in-kernel LZO compression algorithm support (LZO compression algorithm support must not be compiled as a module). If the kernel was compiled with in-kernel LZO compression algorithm support then make the size of the swap partition the same as the RAM size, which is more than enough. For example, as my laptop has 4 GB of RAM I created /dev/sda5 as a 4 GB partition. If LZO compression algorithm support was not compiled into the kernel and you do not know how to rebuild the kernel after installing Linux then you will have to make the swap partition bigger than your RAM size (my guess would be at least 1.5 times the size to be on the safe side).

As to the choice of file system, I format /boot, / and /home as ext4 but you can choose a different native Linux file system if you want. You cannot use Windows’ FAT or NTFS for these Linux partitions.

Stage 3: Install the GRUB bootloader and Linux

Boot Windows Vista/7 and download the freeware tool EasyBCD from the NeoSmart Web site (you might like to make a small donation, to help the developer). You will need to download EasyBCD version 2 and upwards if you want to install a Linux distribution that uses GRUB 2; it is available to download from http://neosmart.net/dl.php?id=1. If you are going to install a Linux distribution that uses GRUB Legacy then the current version of EasyBCD should work too. Follow the instructions on the EasyBCD site on how to install Linux (http://neosmart.net/wiki/display/EBCD/Linux). N.B. You will reach a point in the Linux installation process when the Linux installer allows you to make a choice of where to install the GRUB bootloader: in the MBR (Master Boot Record) of the HDD or in the first sector of the Linux boot partition. You must select the latter, not the MBR. If the Linux installer offers you the option of installing GRUB to e.g. /dev/sda then that would install GRUB in the MBR, because no partition is specified. Make sure you specify the partition that will contain the /boot directory (/dev/sda3 in my particular case). If you created a separate partition for /boot then GRUB will be installed on that separate partition, whereas if you did not create a separate partition for /boot then GRUB will be installed on the partition containing the root directory.

The result of Stage 3 will be that, when you boot your PC, the Windows Vista/7 bootloader will load the GRUB bootloader, and the GRUB bootloader will load Linux. This process is called ‘chainloading’. When you boot the PC you will first see the Windows bootloader menu, and you can select Windows or Linux from it. If you select Linux then you will see the GRUB menu and you can select Linux from that menu, which will boot the distribution.

Whilst chainloading GRUB 2 from the Windows bootloader is more long-winded than booting GRUB 2 directly, you can now use Linux and Windows safe in the knowledge that GRUB 2 will not be overwritten by any Windows applications, and that a Windows factory restore partition will be bootable in an emergency.

A corner case

EDIT (June 21, 2012): A note about a ‘corner case’. This will only apply to a very small minority of users, and then probably only to some users of Gentoo Linux (in Gentoo Linux it is possible to have both /boot/grub/ and /boot/grub2/ simultaneously). If you select ‘GRUB2’ in the pull-down menu in the current version of EasyBCD (2.1.2), EasyBCD actually searches the sub-directories under /boot/ to find the GRUB 2 core.img file, and puts an entry in the Windows BCD pointing directly to that file, i.e. EasyBCD ignores the boot sector of the Linux boot partition. Therefore, when you select ‘Linux’ in the Windows boot manager’s menu, the Windows boot manager does not launch the GRUB code in the boot sector of the partition on which /boot/ resides, it launches the core.img file directly. Now, if your boot partition happens to have both the sub-directories /boot/grub/ and /boot/grub2/, and they both contain a GRUB 2 file core.img, EasyBCD 2.1.2 will create a BCD entry pointing to the one under /boot/grub/ rather than the one under /boot/grub2/. This may or may not be what you want. If you want GRUB 2 to use the core.img under /boot/grub2/, the workaround in EasyBCD 2.1.2 is to select ‘GRUB Legacy’ in the EasyBCD pull-down menu and specify the boot partition. This is counter-intuitive, but it forces EasyBCD to create an entry in the BCD that points to the boot sector of the boot partition instead of the core.img file in a sub-directory of /boot/ on that partition. The GRUB 2 code in the partition’s boot sector will then execute the core.img file in the required sub-directory. This workaround only works if the Linux boot partition is on the same drive as the Windows partition. The developer of EasyBCD will be updating EasyBCD to look for a core.img file in /boot/grub2/ before /boot/grub/, rather than the other way around, if they both exist when you select ‘GRUB2’ in the EasyBCD pull-down menu.

EDIT (September 5, 2012): The EasyBCD developer has fixed EasyBCD a) to cater for core.img being either in /boot/grub2/i386-pc/ or in /boot/grub/, and b) to look for core.img in /boot/grub2/ before looking for it in /boot/grub/. The version with the fix, EasyBCD 2.2 Beta – Build 179.exe or later, can be downloaded from NeoSmart Technologies’ EasyBCD Support Forum. I’ve tried it and it works!

EDIT (January 28, 2015): In October 2013 the GRUB 2 directory in Gentoo was changed from /boot/grub2/ to /boot/grub/, so the above two comments are redundant and you can ignore them.

Make sure you read the EasyBCD FAQ page

EDIT (September 5, 2012): Make sure you read the EasyBCD FAQ page. For example, it states that, to date, EasyBCD does not support the EFI/UEFI, only the traditional PC BIOS.

EDIT (December 18, 2013): According to the NeoSmart Knowledgebase: “As of EasyBCD 2.2, EFI/UEFI and GPT disks are fully supported, but some options may not be compatible with EFI machines.“. I have not tried Version 2.2 or above of EasyBCD with EFI/UEFI and GPT disks, so cannot corroborate this.

EDIT (June 26, 2015): Make sure the partition containing the Linux boot directory is a Primary partition, not a Logical partition. This is because of a Windows limitation.