This article is a quick rundown of everything that I needed to do, before I became reasonably productive, after a reinstall of Ubuntu. A recent virus attack on my Windows desktop left me fuming - the loss of productivity for two days and the amount of damage done, was enough to propel me back to my Linux desktop.
I got the time and opportunity recently to get my desktop set for its second-innings with Linux. This page serves as a holder for all that I learned in the process and to prevent me from trying to relearn all of this, if I have to do this again. Hopefully, it’ll help anyone else trying to go through the same process.
My wife likes to work on Windows, so it has been my primary OS at home, so far. I didn’t want another outage due to a virus attack, so I decided to install Windows under VMWare for her, while I have some peace of mind with Linux on my desktop. I had the following goals for my new setup:
- Dual-boot between Ubuntu and Windows XP from my first hard-disk
- Find suitable Ubuntu replacements for all the goodies I have been using in Windows
- Share files easily between the dual-booted Windows XP and Ubuntu easily
- Able to hibernate Ubuntu when power goes off automatically
- Restart system automatically when power comes back up
- Run Windows XP as guest in Ubuntu VMware host
- Let Windows XP guest access Internet and share files with host Ubuntu OS
I am going to gloss over details in most of the steps below, because this post is not really meant to explain the why or how of things. However, in case someone wants details, I have provided links covering the same in-depth. I have leveraged a lot of work done by other people and my gratitude goes out to them for their time and effort.
My planned dual-boot setup looks like this:
So here’s a quick walkthrough of steps needed to reach the above goals:
Table of Contents
Install Windows XP first
No brainer. This is an insurance against something not working in the VMWare Windows XP guest OS. I create an extra common partition for use by both Windows/Ubuntu. In previous configurations its been FAT32 since both Linux and Windows could write to it easily, but this time I created it as NTFS, since Ubuntu has read-write support for NTFS partitions now and it seems to be working fine for some time now. Yeah, I am feeling adventurous! But just in case, I won’t be using the partition for any mission-critical stuff, that I can’t afford to lose. If something goes wrong, this partition is going back to being FAT32.
Install Ubuntu Intrepid 8.10
I created a big /var partition so that I can put my virtual machines in that partition. I also want to play with sharing virtual machines between Windows and Linux host OS. Such virtual machines would be copies of guest VMs in /var/vmware and kept in the common partition.
Update packages in Ubuntu 8.10
The update manager in Ubuntu will be prompting you for updates by now, which may run into hundreds of Mbs. We can start the updates and leave them running overnight. Or you could complete the steps below and update later. As long as updates are being downloaded, you won’t be able to install anything else.
Update: On a Ubuntu 8.10 system which is fresh and hasn’t been updated you may not be able to install Samba, because of some packaging errors, so you may want to complete any updates first, before going ahead.
Install applications in Ubuntu 8.10
The next step is to install all needed applications, replacements for what you use in Windows etc. Before doing this just add Google’s repositories to your system. Here you go:
sudo apt-get -y install msttcorefonts
sudo apt-get -y install libdvdread3 regionset
sudo apt-get -y install samba smbclient smbfs
sudo apt-get -y install vpnc
sudo apt-get -y install thunderbird thunderbird-gnome-support latex-xft-fonts
sudo apt-get -y install picasa
sudo apt-get -y install inkscape
sudo apt-get -y install amarok
sudo apt-get -y install vlc
sudo apt-get -y install conky iotop htop powertop
sudo apt-get -y install adobe-flashplugin
sudo apt-get -y install sysinfo
sudo apt-get -y install gworldclock
sudo apt-get -y install rar p7zip-full unrar
sudo apt-get -y install gnome-do
sudo apt-get -y install nmap
sudo apt-get -y install wine
sudo apt-get -y install compizconfig-settings-manager
sudo apt-get -y install sun-java6-plugin sun-java6-jr
sudo apt-get -y install chkconfig
sudo apt-get -y install sensors-applet
sudo apt-get -y install nautilus-actions
sudo apt-get -y install nautilus-open-terminal
sudo apt-get -y install nautilus-script-manager
sudo apt-get -y install nautilus-filename-repairer
sudo apt-get -y install nautilus-script-debug
sudo apt-get -y install nautilus-image-converter
sudo apt-get -y install nautilus-script-collection-svn
sudo apt-get -y install diff-ext
sudo apt-get -y install gnome-themes-extras
sudo apt-get -y install gnochm
sudo apt-get -y install gftp
sudo apt-get -y install apcupsd
sudo apt-get -y install gapcmon
sudo apt-get -y install screenlets
sudo apt-get -y install terminator
sudo apt-get -y install electricsheep
sudo apt-get -y install guayadeque
sudo apt-get -y install xbindkeys xbindkeys-config
sudo apt-get -y install vim-full vim-gnome
sudo apt-get -y install subversion subversion-tools db4.6-util
sudo apt-get -y install manpages-dev
sudo apt-get -y install rapidsvn
sudo apt-get -y install meld
sudo apt-get -y install systemtap
sudo apt-get -y install g++
sudo apt-get -y install libncurses5-dev
sudo apt-get -y install gettext
sudo apt-get -y install kernel-patch-scripts
sudo apt-get -y install linux-source-x.x.x
sudo apt-get -y install linux-crashdump
sudo apt-get -y install linux-doc
sudo apt-get -y install linux-headers-`uname -r` build-essential xinetd
sudo apt-get -y install kernel-package fakeroot wget bzip2
sudo apt-get -y install kerneltop
sudo apt-get -y install oprofile
sudo apt-get -y install crash
sudo apt-get -y install cscope
sudo apt-get -y install ctags
sudo apt-get -y install ack-grep
Download and install VMWare Server 2.0 for Linux
There are several flavors of VMWare, VMWare Server being the free one for both Windows and Linux. Download the server from here. Install it as described here. You may run into a problem when configuring VMware server 2.0.1 in Ubuntu 8.10. It tries to build the VSOCK module and load it in the kernel, but fails. This can be solved by patching the vmware-config.pl file with a patch provided by an enterprising user. Download it here.
Before the patch:
Unable to make a vsock module that can be loaded in the running kernel:
insmod: error inserting '/tmp/vmware-config0/vsock.o': -1 Unknown symbol in module
There is probably a slight difference in the kernel configuration between the
set of C header files you specified and your running kernel. You may want to
rebuild a kernel based on that directory, or specify another directory.
The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and
host. The rest of this software provided by VMware Server is designed to work
independently of this feature. If you wish to have the VSOCK feature you can
install the driver by running vmware-config.pl again after making sure that
gcc, binutils, make and the kernel sources for your running kernel are
installed on your machine. These packages are available on your distribution's
[ Press the Enter key to continue.]
After the patch:
VMWare config patch VSOCK!
`/tmp/vmware-config1/../Module.symvers' -> `/tmp/vmware-config1/vsock-only/Module.symvers'
Building the vsock module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config1/vsock-only'
make -C /lib/modules/2.6.27-7-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make: Entering directory `/usr/src/linux-headers-2.6.27-7-generic'
CC [M] /tmp/vmware-config1/vsock-only/linux/af_vsock.o
CC [M] /tmp/vmware-config1/vsock-only/linux/driverLog.o
CC [M] /tmp/vmware-config1/vsock-only/linux/util.o
/tmp/vmware-config1/vsock-only/linux/util.c: In function ‘VSockVmciLogPkt’:
/tmp/vmware-config1/vsock-only/linux/util.c:157: warning: format not a string literal and no format arguments
CC [M] /tmp/vmware-config1/vsock-only/linux/vsockAddr.o
LD [M] /tmp/vmware-config1/vsock-only/vsock.o
Building modules, stage 2.
MODPOST 1 modules
LD [M] /tmp/vmware-config1/vsock-only/vsock.ko
make: Leaving directory `/usr/src/linux-headers-2.6.27-7-generic'
cp -f vsock.ko ./../vsock.o
make: Leaving directory `/tmp/vmware-config1/vsock-only'
The vsock module loads perfectly into the running kernel.
VMWare Server won’t be able to execute your guest OS until you unload/turn-off the built-in KVM virtualization engine in the Linux kernel. Do this:
> sudo rmmod kvm_intel
> sudo rmmod kvm
> sudo chkconfig -e kvm
chkconfig will open an editor. Just replace on with off.
Install Windows XP as guest OS
Access VMWare Server using your web-browser at this link: http://localhost:8222. Add a datastore. I use /var/vmware (that’s the reason behind /var partition being so big). Create a virtual machine and install the guest OS. Windows XP in VMWare server 2.0.1 can only run on IDE disks. I am not sure if you’d face this problem during a fresh install, but I faced this when migrating a Windows XP guest VM to Ubuntu, which was created in Windows XP itself as host OS on a virtual SCSI disk. So I had to use Acronis TrueImage first, to clone the virtual SCSI disk to a new virtual IDE drive within the guest VM and then migrate it to Linux host. Some users tried out Norton Ghost for the same but reported having problems with it (although I have seen others using it successfully, with some hoops and twists).
Next, add a new disk to your virtual machine. Start the Windows XP guest OS and format this new drive. Then turn on file sharing and give read-write access to this particular drive. I like to give the host read-write access to the guest’s drive, so that its easy to transfer data between the host and guest using this shared drive. Also the guest stores all data on this drive. The advantage of a separate drive for your data is that this disk can easily be moved to another VM, in case your current VM goes kaput.
Access the shared folders in guest VMs from Places > Network. You could setup this folder to be mounted easily by tweaking instructions provided here. You can also create a shortcut for your guest OS from VMWare server browser console, for easy access.
Install the VMWare tools in the Windows XP guest OS from the VMWare browser console. You’d need these for seamless integration of the guest OS with the host. These tools make life a lot easier, when dealing with display settings, mouse cursor etc.
Update: The key mappings for some of the keys in your guest Windows XP OS may be wrong at this time. Some keys such as the Del, Arrow keys etc. might not work for you in the guest OS. To fix this problem add the following line to your /etc/vmware/config file. This fixed the problem for me. For more details, see this thread.
xkeymap.nokeycodeMap = true
Set up VMWare networking
You might want to read this first. You’d want to configure your guest OS to use NAT VMWare networking option in order to let it access the Internet, as well as communicate with the host OS. VMWare will use the vmnet8 interface for this purpose. Find out the subnet configured by default on the vmnet8 interface, by VMWare server. On my machine this is 192.168.4.0. The default gateway and the DNS server for your guest OS in that case is 192.168.4.2. You can use DHCP within your guest OS to configure its network and VMWare’s DHCP server will automatically assign IP addresses to your guest VMs. I use static addresses though, which allows me to set up permissions easily using IP addresses in various other configuration files such as Samba etc.
> sudo ifconfig vmnet 8
vmnet8 Link encap:Ethernet HWaddr 00:50:56:c0:00:08
inet addr:192.168.4.1 Bcast:192.168.4.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1223 errors:0 dropped:0 overruns:0 frame:0
TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
We could now install other operating systems and test them out too. One of the things that I have been planning to do is to give direct access to rest of the 3 physical disks to a NAS distribution such as OpenFiler, FreeNAS etc and see which one can I use for managing my disks under RAID protection. But more on that in some later post. For now our setup should begin to look like this:
Download and install other apps
Set up your fonts
Go to System > Preferences > Appearance > Fonts. Turn on Sub-pixel smoothing.
Configure your UPS
I have an APC Back UPS RS 800 (as written on front-panel), which the driver identifies as Back UPS BR 800. I tried installing NUT for monitoring my UPS but it did not work. Finally after much mucking around, I found apcupsd which was able to monitor my UPS and shutdown/hibernate it when the power goes off. A detailed guide on configuring it is present here. You can find a shorter one here. The program gapcmon is a great way to keep a tab on the UPS including past history. My /etc/apcupsd/apcupsd.conf file is as shown below and that is followed by some troubleshooting tips.
> cat /etc/apcupsd/apcupsd.conf | grep -v "#" | grep -v "^$"
You may have to create the device nodes, which are used by apcupsd to monitor the UPS. To create those devices, use this script:
> sudo /usr/share/doc/apcupsd/examples/make-hiddev
> ls -l /dev/usb/hid
crw-r--r-- 1 root root 180, 96 2009-04-22 15:33 hiddev0
crw-r--r-- 1 root root 180, 97 2009-04-22 15:33 hiddev1
crw-r--r-- 1 root root 180, 106 2009-04-22 15:33 hiddev10
crw-r--r-- 1 root root 180, 107 2009-04-22 15:33 hiddev11
crw-r--r-- 1 root root 180, 108 2009-04-22 15:33 hiddev12
crw-r--r-- 1 root root 180, 109 2009-04-22 15:33 hiddev13
crw-r--r-- 1 root root 180, 110 2009-04-22 15:33 hiddev14
crw-r--r-- 1 root root 180, 111 2009-04-22 15:33 hiddev15
crw-r--r-- 1 root root 180, 98 2009-04-22 15:33 hiddev2
crw-r--r-- 1 root root 180, 99 2009-04-22 15:33 hiddev3
crw-r--r-- 1 root root 180, 100 2009-04-22 15:33 hiddev4
crw-r--r-- 1 root root 180, 101 2009-04-22 15:33 hiddev5
crw-r--r-- 1 root root 180, 102 2009-04-22 15:33 hiddev6
crw-r--r-- 1 root root 180, 103 2009-04-22 15:33 hiddev7
crw-r--r-- 1 root root 180, 104 2009-04-22 15:33 hiddev8
crw-r--r-- 1 root root 180, 105 2009-04-22 15:33 hiddev9
Update: With Ubuntu 10.04 editing fstab to mount usbfs was not found to be necessary.
Add this line to /etc/fstab:
none /proc/bus/usb usbfs defaults 0 0
Update: With Ubuntu 10.04 it was necessary to edit the file /etc/default/apcupsd and replace ISCONFIGURED=no with ISCONFIGURED=yes, before starting the apcupsd daemon.
Start the UPS monitoring daemon:
> sudo mount -a
> cat /proc/bus/usb/devices
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 6 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=051d ProdID=0002 Rev= 1.06
S: Manufacturer=American Power Conversion
S: Product=Back-UPS BR 800 FW:9.o4 .I USB FW:o4
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 24mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=03(Int.) MxPS= 6 Ivl=10ms
> sudo /etc/init.d/apcupsd start
> sudo cat /var/log/daemon.log
Apr 25 16:21:01 Zork apcupsd: NIS server startup succeeded
Apr 25 16:21:01 Zork apcupsd: apcupsd 3.14.4 (18 May 2008) debian startup succeeded
> ps aux | grep ups
root 5826 0.0 0.0 20824 1024 ? Ssl Apr28 0:01 /sbin/apcupsd
root 12064 0.0 0.0 2964 776 ? S Apr28 0:00 hald-addon-hid-ups: listening on /dev/usb/hiddev0
You might want to reboot once, if it does not start the first time. That should start the hald-addon-hid-ups process, which is necessary for apcupsd to monitor the UPS.
Since a lot of us don’t have the luxury of continuous power, unlike the developed world, we’d want to shutdown/hibernate the machine when the power goes off. I prefer hibernation, instead of shutting it down, because any virtual machines running don’t have to be shut down as well when the power goes off. Apart from that, when the power returns, we get the luxury of having our desktop back with any virtual machines running in the exact pristine state, as they were. Also we could configure the BIOS to power ON the machine automatically when the power returns (if your BIOS has that option). Just follow these ArchLinux instructions to configure UPS triggered hibernation. These worked for me on Ubuntu 8.10 as well.
Configure your apps
For me this involves downloading the configuration files such as .vimrc, .bashrc etc. that I maintain in a subversion repository online. Other things that we’d like to do at this point is adding icons of most frequently accessed apps to the panel, add any useful applets (especially the hardware temperature monitoring applet - it saved my graphics card once, which I found running at more than 85 degrees), etc. Another thing I like to do is to turn on Compiz from System > Preferences > Appearance > Visual Effects. Then I fire up System > Preferences > CompizConfig Settings Manager and turn on Blur Windows, Window Previews. Also to turn on Nautilus’s subversion integration scripts run this command:
> nautilus-script-manager enable Subversion
Update: The vpnc client for Ubuntu 8.10 keeps on dropping connections frequently. To fix this, add the following line to the file /etc/vpnc/default.conf file:
DPD idle timeout (our side) 0
Setup screen rotation
When working with source code, I like to rotate my screen by 90 degrees, so that I can see more of the source code on my Dell monitor in one go. My Nvidia GeForce 8800 GTS card allows me to rotate the screen in Ubuntu. Its a shame that this support does not come built into Ubuntu’s display preferences dialog box - yeah, it says it can rotate the display, but won’t. To add this support, edit /etc/X11/xorg.conf file and add this line to the Screen: section:
Option "RandRRotation" "true"
Then rotate the screen:
> /etc/init.d/gdm stop
> /etc/init.d/gdm start
> xrandr -o left
I like to install these add-ons for Firefox:
Install applications in Windows XP Guest
Here is my list of essentials for Windows XP:
Now that you have installed all the basic apps you’d want to backup your Windows XP VM so that you don’t need to repeat the Windows XP installation ever. Copy the contents of the directory containing your virtual machines. Compress this copy and keep it safe somewhere - I am sure you’ll need it someday, Windows being what it is!
Configure Samba in Ubuntu Intrepid 8.10
To share files in the Ubuntu host with the Windows XP guest you’d want to setup Samba in Ubuntu such that it shares the data folders with the guest. A typical Samba setup is described here. If you need a simpler no frills setup, find it here. The first link worked for me within a couple of minutes.
Phew! That was a long task list. If you want to find out more about some other stuff you could tweak, take a look at these pages as well. Well, this page maybe already outdated (Ubuntu 9.04 just got released, but hopefully I am not off by a huge margin, when I make a jump to the next release of Ubuntu). For now I am not going to the next Ubuntu distribution unless there’s a really compelling reason to do so.
The maximum amount of time I spent in Ubuntu was in setting up the UPS and troubleshooting the installation of VMWare server in Ubuntu. That stuff just works in Windows. Add a bunch of utilities on top of that and you are ready to go! I wish it was the same with Ubuntu…