A new OS experience

2008-12-19

Multiboot With Standalone GRUB

Yesterday I came to realize that I needed a simpler way to boot multiple OS-es on my laptop. My requirements were:

  1. Have an independent boot loader on the MBR
  2. Have a partition for swap
  3. Separate data partition for file storage
  4. Partitions for the multiple OS-es
To accomplish this task a simple menu file is created to chainload each respective OS. That way, should I decide to remove a distro, I could just reformat the drive and remove its entry on the main bootloader. Using an Ubuntu live CD, I accessed a terminal console and logged in as root.

First, I wrote zeros all over the drive to make sure there would be no conflicts or previous data read by the various partitions. Of course, I backed up any previous files I had. WARNING: this command will WIPE all the data on the drive!

ubuntu#: dd if=/dev/zero of=/dev/sda

Next I created a 512 byte MBR partition sector, again writing zeros for redundancy:

ubuntu#: dd if=/dev/zero of=/dev/sda bs=512 count=1

Next, I created the necessary partitions by accessing the fdisk utility:

ubuntu#: fdisk /dev/sda

For the first partition I allocated 1GB (1024M) of space to use as swap. The good thing about Linux is that you only need one of these which can be accessed by any distro installed:

  1. n to create a new partition
  2. p to make it a primary partition
  3. 1 to give it a designation number (as in /dev/sda1
  4. to accept beginning sector
  5. +1024M to set size and ending sector
  6. t to select partition type
  7. 1 to select the first partition
  8. 82 to designate it as Linux swap

Second, I created a small 100M partition for the boot loader:

  1. n to create a new partition
  2. p to make it a primary partition
  3. 2 to designate it as the second partition
  4. to accept beginning sector
  5. +100M to set size and ending sector

These first two partitions are primary partitions. The rest are going to be logical partitions, since you cannot have more than 4 primary partitions on a single drive. I want 4 partitions where I can install the OS-es and 1 partition to use as file storage:

  1. n to create a new partition
  2. e to make it an extended partition
  3. 3 to designate it as the third partition. This is just a container for the logical partitions. Also, logical partitions start from 5 and above
  4. to accept beginning sector
  5. to set size and ending sector of the rest of the drive.
  6. n to create a new partition
  7. l to make it a logical partition; it will be designated partition 5 (/dev/sda5)
  8. to accept the beginning sector
  9. +10240M to set the 10GB size
  10. n to create a new partition
  11. l to make it a logical partition
  12. 6 to designate it as the sixth drive
  13. +10240 to set the size of 10GB
  14. Do the same for partitions 7 and 8
  15. For partition 9 do steps 10, 11, and 12 (designate it as 9), but hit <> for beginning and ending sectors.
  16. Once done setting up the partitions, enter w to write changes to the MBR and make them permanent

Now that the partitions are set up it is time to install the OS-es. I chose:

  • Kubuntu 7.10 Gutsy
  • Kubuntu 8.10 Intrepid Ibex
  • Debian Etch
  • Slackware 12.2

With the exception of Debian which uses XFCE, the other three distros use KDE, which I must say looks sweet in its latest version 4.1.

The first thing to do is to get GRUB running. For this a live CD will do. Once the live CD is loaded, I copied the grub section from the boot section of the CD to the second partition, after formatting that partition.

kubuntu#: mkdir /mnt/sda2
kubuntu#: mount /dev/sda2 /mnt/sda2
kubuntu#: mkdir /mnt/sda2/boot
kubuntu#: mkdir /mnt/sda2/boot/grub
kubuntu#: mkfs -V -t ext3 /mnt/sda2
kubuntu#: find / -name stage1
kubuntu#: cp /usr/lib/grub/i386-pc/* /mnt/sda2/boot/grub
kubuntu#: grub
> root (hd0,1)
> setup (hd0)
> quit

After this it's time to create the custom GRUB menu file:

kubuntu#: nano /mnt/sda2/boot/grub/menu.lst
title
Kubuntu 7.10 Gutsy on /dev/sda5
root
(hd0,4)
chainloader +1
title
Kubuntu 8.10 Ibex on /dev/sda6
root (hd0,5)
chainloader +1
title Debian Etch on /dev/sda7
root (hd0,6)
chainloader +1
title Slackware 12.2 on /dev/sda8
root (hd0,7)
chainloader +1

Important: I had to make sure that during each installation I instructed the installer to install the boot loader on the root directory of the respective partitions and not on the MBR as it will override our above step. For (K)ubuntu go through the installation until the installer asks you if you're ready to install. Before doing so click Advanced, check install boot loader, and enter the GRUB location of the partition [e.g. for /dev/sda5 it's (hd0,4)]. Do the same for Debian and Slackware.



NOTE
: I got this how to from user saikee in justlinux.com forum.

2008-05-02

Image Magick Update

I couldn't find ImageMagick in the repositories, and the version I had was old:

$ convert --version

which returned ImageMagick-6.1.4

I downloaded ImageMagick 6.4.1 from their site and built it from source:

$ sudo tar -zxvf ImageMagick-6.4.1-0.tar.gz
$ cd ImageMagick-6.4.1
$ sudo ./configure
$ sudo make
$ sudo make install

and verfied installation:

$ /usr/local/bin/convert logo: logo.gif

This program is part of the requirement for dvd-slideshow.

DVD Creation

I have a bunch of mpeg-s I've been taking for some time, and in switching to linux I had no idea what to use. I've been searching around and the penultimate tools seems to be dvdauthor and it seems nearly every other tool to create video DVDs is based on dvdauthor. Alongside dvdauthor, a set of useful tools can be beneficial including Mjpeg Tools, FFMpeg, Toolame, Vrobistools, and Kino.

There are also tools out there that make it possible to create DVD slideshows such as dvd-slideshow. It's requirements are dvdauthor, Mjpegtools, ImageMagick, urw-fonts, ffmpeg, mkisofs, dvdrecord from dvdrtools, and the following codecs lame, oggdec, and toolame.

To preview and play the DVDs mplayer can be used, albeit a command line tool.

2008-04-10

Installed Anti-Virus, Firewall, and Rootkit Hunters

I decided to install an anti-virus for Linux since I use my flash drives on Windows systems as well. I am trying to be responsible and not spread any viruses. I chose Avast as I used it in Windows. To make the isntallation easy I chose the Debian package:

$ sudo dpkg -i avast4workstation_1.0.8-2_i386.deb

To start the program:

$ avastgui

or

ALT+F2 > avastgui

For the firewall and rootkit programs:

$ sudo aptitude update
$ sudo aptitude install chkrootkit rkhunter firestarter

Linux makes things too easy. I have no idea why so many people still stay away from it. I know what it is: fear of the command line.

2008-04-09

Got Wifi Working on My Desktop


I have a Linksys WUSB54G USB wireless adapter which I have been using for some time for my Windows PC. Lately installed Xubuntu 7.10 but I was having a rough time getting wireless to work. After some reseach I resolved the connectivity issue in just a short amount of time:

I downloaded the driver files from the Linksys site . I needed version 4, and after file extraction copied rt2500usb.inf and rt2500usb.sys to a local folder.

The next step was to blacklist the old driver.

$ sudo rmmod rt2500usb
$ sudo nano /etc/modprobe.d/blacklist

Added the following at the bottom of the file

# Blacklist old driver
blacklist rt2500usb

Installed the new driver with ndiswrapper and verified installation:

$ sudo ndiswrapper -i ~/tools/wifi/driver/rt2500usb.inf
$ sudo ndiswrapper -l

Installed the new module and made changes permanent:

$ sudo modprobe ndiswrapper
$sudo ndiswrapper -m

Added " ndiswrapper " (w/o quotes) to the bottom of the modules file

$ sudo nano /etc/modules

A quick check of iwconfig confirmed a wireless card. Afterward I edited the wpa_supplicant file, edited the /etc/network/interfaces file to add the new card and automate wpa_supplicant. The last step was the add dhclient to the begining of (and below the first line) /etc/init.d/rc.local file. A quick reboot put me in business. Hooray! I wonder if I'll ever get to use Windows on this PC. My wife might, so I'll leave it be.

2008-04-08

WUSB54G, Chmod,GRUB and a Brainfart

Ok, so I installed Xubuntu 7.10 on my 5 year old desktop yesterday and I was having a really hard time with internet connection. I only use wifi at home, with WPA2 encryption, but my usb wifi card, the infamous WUSB54G, was being a pain. To ge the card working I am using ndiswrapper and the rt2500 driver. Coincidentally, this driver, which is v4 for my card, comes with the Xubuntu installation. For whatever reason once I install the driver, it won't let me connect on system reboot, so I have to do it manually every time I reboot the system.

Later, I really had a brainfart. I had created a fourth partition for Linux files, but I didn't update permissions. I couldn't remember how to change read-write permissions, but after a little while all I had to do was:

$ sudo chmod -R 777 /media/hd6/whateverFolderorFile

where the -R option stood for recursive, as it pertains to folders, and 777 corresponds to chmod making the file writable.

To date, I haven't found a soultion to my wifi issue. Will check ubuntuforums and other linux forums to see if anyone has an idea about what's going on.

My first install of Xubuntu was problematic. Once I established internet connection and updated the repositories, I initiated a system update via Synaptic. Problem was, I received an error message indicating some files weren't installed properly. Rather than look at the log files, I rebooted the system without making a backup. On reboot, GRUB ingratiated me with an Error 15 / File not found message. After a long search online and a post on ubuntuforums.org , I found the problem: my initrd file was the one "missing." Good news was that a backup (.bak). This blog entry confirmed it, and all I had to do is look under /boot to figure out what the hell went wron. I used the initrd.bak to get in my system.

Cisco VPN Client on Linux

I was trying to connect to my network drive at UTA but I was unsuccessful. Yeah, I completely did not read the instructions at the IT department's website. It turns out, a VPN connection is needed when connecting to the student (or faculty) server off-campus. Taking a look at the instructions on that site, the VPN of choice was Cisco's VPN client (multi-platform). In order to download it from their site, you need a school ID, but one can find it elsewhere on the web, available vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz. Setting it up was trickier than I thought, and of course the college's IT instructions were a bit short in explanation. As is the case with anything regarding Linux, I found a great how-to on this wiki by Soft Ice. Based on the wiki, this is what I did:

I. Installation

1. Downloaded the vpnclient tarball from: http://www.govnet.state.vt.us/restricted/ciscovpnclient/

2. Checked the kernel sources are installed:

$ sudo ls /lib/modules/

3. Downloaded the kernel patch (my kernel is 2.6.22-xx):

$ sudo wget http://tuxx-home.at/projects/cisco-vpnclient/vpnclient-linux-2.6.22.diff

4. Extraced the tarball:

$ sudo tar -zxvf vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz

5. Applied the patch:

$ cd vpnclient
$ sudo patch -i ../vpnclient-linux-2.6.22.diff

6. Installed the vpn client:

$ sudo ./vpn_install

Accepted the default settings and moved on.

7. Confirmed vpnclient is installed:

$ ls /etc/opt

II. Configuration:

8. Started the vpnclient service:

$ sudo /etc/init.d/vpnclient_init start

9. Create a profile:

$ sudo nano /etc/opt/cisco-vpnclient/Profiles/mynewprofile.pcf

According to my college's IT department the minimum configuration of that file should be:

[main]
Host=vpn.uta.edu
AuthType=1
GroupName=default
GroupPwd=UTAsecret

10. Started the VPN session:

$ sudo vpnclient connect uta

where uta is the name of the .pcf file created under /etc/opt/
cisco-vpnclient/Profiles/mynewprofile.pcf


That was all there was to it.

2008-04-07

What To Do After Installing Ubuntu

I'm a student so for me the following work best:

1. Enable Additional Repositories:

system > admin > synaptic
settings > repositories


2. Add the medibuntu repositories:

$ sudo echo "deb http://packages.medibuntu.org/ gutsy free non-free" | sudo tee -a /etc/apt/sources.list

$ sudo wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update

3. Install audio, & video codecs:

$ sudo aptitude install gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly

$ sudo aptitude install mpg123 w32codecs libdvdcss2

4. Install media players:

$ sudo aptitude install amarok amarok-engine amarok-engines amarok-xine vlc vlc-plugin-arts vlc-plugin-esd vlc-plugin-ggi vlc-plugin-glide vlc-plugin-sdl vlc-plugin-svgalib mplayer mplayer-fonts mplayer-doc mplayer-nogui mplayer-skin mplayer-skin-blue mplayer-skins mplayerthumbs mencoder dvdauthor vcdimager mkisofs devede qdvdauthor qdvdauthor-db dvd+rw-tools dvd-slideshow ffmpeg ffmpeg2theora lame lame-extras k3b k9copy istanbul audacity avidemux wink gnash gnash-common gnash-cygnal gnash-tools swftools gs-common

5. Useful tools:

$ sudo aptitude install icedtea-java7-bin icedtea-java7-jdk icedtea-java7-jre icedtea-java7-plugin linuxdcpp acroread acroread-plugins acroread-escript kpdf pdfedit flashplugin-nonfree d4x d4x-common bittorrent bittorrent-gui amule amule-common amule-utils amule-utils-gui filezilla filezilla-common vpnc kvpnc p7zip p7zip-full unrar rar zip unzip chkrootkit rkhunter clamav clamav-base clamav-daemon clamav-data clamav-docs clamav-freshclam clamav-getfiles klamav mondo mondo-doc firestarter gkrellm gkrellm-bfm gkrellm-common gkrellm-hdplop gkrellm-i8k gkrellm-ibam gkrellmd gkrellmwho2 gkrellmwireless wine scite truecrypt easycrypt

6. Communication tools:

$ sudo aptitude install xchat xchat-common xchat-guile xchat-systray xchat-sys pidgin pidgin-plugin-pack thunderbird lightning lightning-extension sunbird

7. Graphics:

$ sudo aptitude install gimp gimp-data gimp-data-extras gimp-cbmplugs gimp-help gimp-help-common gimp-help-en gimp-refocus gimp-dcraw gimp-ufraw xpdf xpdf-common xpdf-reader xpdf-utils

8. Office:

$ sudo aptitude install openoffice.org openoffice.org-bundled openoffice.org-writer openoffice.org-calc openoffice.org-impress openoffice.org-draw openoffice.org-base openoffice.org-math openoffice.org-filter-binfilter openoffice.org-l10n-en-us openoffice.org-help-en-us openoffice.org-hyphenation-en openoffice.org-java openoffice.org-java-common openoffice.org-officebean openoffice.org-thesaurus-en-us openoffice.org-headless cupsys-bsd openclipart-openoffice.org gnucash gnucash-common gnucash-docs vym

9. Science and Math:

& sudo aptitude install gretl gretl-common gretl-data gretl-doc gnuplot gnuplot-doc gnuplot-nox gnuplot-x11 r-base r-base-core r-base-html r-base-acepack r-base-bayesm r-cran-cron r-cran-cluster r-cran-date r-cran-dbi r-cran-design r-cran-fbasics r-cran-fcalendar r-cran-fecofin r-cran-fextremes r-cran-fmultivar r-cran-foptions r-cran-fportfolio r-cran-fseries r-cran-foreign r-cran-lattice r-cran-latticextra r-cran-matchit r-cran-matrix r-cran-mcmcpack r-cran-misc3d r-cran-multcomp r-cran-mvtnorm r-cran-nlme r-cran-pscl r-cran-rcmdr r-cran-rpvm r-cran-rquantlib r-cran-strucchange r-cran-survival r-cran-tkrplot r-cran-tseries r-cran-xml r-doc-html r-doc-info r-doc-pdf r-mathlib r-recommended rkward speedcrunch
I did my best to spell out the commands as well as I could.

This post was inspired from the blog "Linux on Desktop" found at: http://linuxondesktop.blogspot.com/2007/02/13-things-to-do-immediately-after.html

2008-01-17

Using Fluxbox in Kubuntu

I couldn't resist installing Fluxbox on my laptop as part of my window manager options. I used Fluxbox previously when I was trying out Knoppix. Installation was easy, since I had almost all repositories checked:

$ sudo apt-get update
$ sudo apt-get install fluxbox

Once the installation was complete, all I had to do is try it out. Initially, the right click menu had no options available, but a quick menu update (while in KDM) took care of that:

$ sudo update-menus

Then I had to edit the Fluxbox menu:


$ sudo nano ~/.fluxbox/menu

which output the following:

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

Since I wanted to add Firefox the contents of my menu, I had to edit fluxbox-menu:

[submenu] (Internet) {}
[exec] (Firefox) {/usr/bin/firefox}
[end]

which I added under the Network submenu.

2008-01-08

Uh, How Annoying Thou Art Yee Ad Servers

Yep, whenever I visit a site I really get annoyed by those ads that are strewn
all over the damned page, so it seems. Instead of cursing my hardware and the
Internet gods, I decided to use a hosts file, rather than rely on my browser:

1) Copy the Ad Server list from:

http://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts.

There are many other sources out there, but i like this one.

2) Open and edit the hosts file:
$ sudo nano /etc/hosts

3) Paste it below the last line and save the file.

4) Reebot, and happy surfing.

Still, not every ad server is listed. If you run across one that is not on the
list simply add it to the hosts file. For a shared connection, such as the
one I have, it's a bandwidth saver. Besides, I don't like accidentally
clicking on a part of the page that sends me where I don't want to go.

Migrating from Windows to Linux

Yeeeey, I made the switch from Windows to Linux - Kubuntu 7.10 Gutsy to be
more exact. It was entirely an easy process. I decided to go with Kubuntu
because of the KDE desktop since I became familiar with it while toying with
Knoppix 5.1 Live CD. The following are my installation notes:

1. I backed up all the data that I had under the Win XP Home install to a few
DVDs. Then, using the installation disk I formatted the HDD (SCSI) using
Konsole, and prepared the MBR:

$ sudo dd if=/dev/zero of=/dev/sda bs=512 count=1

2. Using the "Install" option on the Desktop I created a SWAP partition of
1024MB and used the remainder to install the OS.

3. Amazingly enough, Kubuntu is very, very, very noob-friendly. It loads
almost all the drivers you need. The hardware I am using is a 3 year old Dell
Inspiron E1505 (6400), but the problem arose when I tried to connect to my
wireless home network. I needed to use the proprietary driver for my wifi
card. Kubuntu does have a few tools available, but ndiswrapper was not one of
them. I could use the aptitude tool but that requires internet connection to
download from the repositories, so I downloaded the following for manual
install: ndiswrapper, wpa_supplicant, wireless-tools, the wifi windows card
driver (bcmwl5.inf, bcmwl5.sys) - I transferred these to a USB flash drive.

4. Installing and configuring wireless:

a) Check and remove old driver from distro:
$ lsmod | grep bcm43xx
$ sudo modprobe -r bcm43xx
$ lsmod | grep bcm43xx

b) Check for ndiswrapper:
$ lsmod | grep ndiswrapper

c) To install files, build essentials are needed. Inserting the Kubuntu CD in
the drive:
$ sudo apt-get update
$ sudo apt-get install build-essential

d) Transferring ndiswrapper and windows driver to a directory under /home:
$ sudo cp /media/sdb1/ndiswrapper-1.51.tar.gz /home/Tools/Ndiswrapper
$ sudo cp /media/sdb1/WinDrivers/*.* /home/Tools/WinDrivers

e) Extracting ndiswrapper and install:
$ tar -zxvf ndiswrapper-1.51.tar.gz
$ cd ndiswrapper-1.51
$ sudo make uninstall
$ sudo make distclean
$ make
$ sudo make install
$ ndiswrapper -v

f) Installing the Windows drivers:
$ cd /
$ sudo ndiswrapper -i Tools/WinDrivers/bcmwl5.inf
$ ndiswrapper -l
$ ls /etc/ndiswrapper
$ sudo modprobe ndiswrapper

NOTE: If ndiswrapper does not load on startup, edit the /etc/modules file adding ndiswrapper:
$ sudo nano /etc/modules
Add the line "ndiswrapper" w/o quotes below the last module

g) Checking wireless configuration and bring up the card:
$ iwconfig
$ sudo ifconfig eth1 up

h) Since the home network is encrypted with WPA-AES I needed to use
wpa_supplicant to communicate with my AP. Luckily, Kubuntu 7.10 already comes
with wpa_supplicant. The WPA encryption is in HEX, so first:
$ sudo wpa_passphrase essid HOME willubethere4ever
Copy-paste the results and then:
$ sudo nano /etc/wpa_supplicant.conf
# Control interface - Do not change this line
ctrl_interface=/var/run/wpa_supplicant
# Allow only Root to read WPA Supplicant Config
ctrl_interface_group=0
# Allow wpa_supplicant to scan and select AP
ap_scan=1
# Begin detailing networks below
# Net1 - Associate with any open AP
network={
ssid=""
key_mgmt=NONE
}
# Net 2 - COFFEE SHOP Using simple WEP
network={
ssid="COFFESHOP"
key_mgmt=NONE
wep_tx_keyidx=0
wep_key0=6644565378
}
# Net 3 - HOME Using WPA AES with only CCMP
network={
ssid="HOME"
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
#psk="willubethere4ever"
psk=365342f8362524e1834abbd953edaf8979c4de38d7601fabb30a84d769953bb3
priority=2
}

i) Initiated wpa_supplicant and force IP :
$ sudo wpa_supplicant -c /etc/wpa_supplicant.conf -i eth1 -D wext -B
$ dhclient eth1

j) Since eveything worked I made changes to ndiswrapper permanent:
$ sudo ndiswrapper -m

k) Time to blacklist the old driver:
$ sudo nano /etc/modprobe.d/blacklist
Adding as the last line:
# Blacklist old wireless driver
blacklist bcm43xx

l) I modified the network interface:
$ sudo nano /etc/network/interfaces
# Do not change this
auto lo
iface lo inet loopback

# Adding wireless card
auto eth1
iface eth1 inet dhcp

# Initiating wpa_supplicant on startup
pre-up wpa_supplicant -c /etc/wpa_supplicant.conf -i eth1 -D
wext -B

# Terminating wpa_supplicant on shutdown
post-down killall -q wpa_supplicant

m) Updating boot script to load dhclient and force IP association:
$ sudo nano /etc/init.d/rc.local
#! bin/sh
dhclient eth1
...

5) Time to reboot the system and get all the software and security updates
needed on boot.

That was it, and I couldn't believe how easy it was, relatively speaking.
Although it may seem like a lot of work, considering all the perceived
hassles one must go through, the upside to any Linux distro is the altering
perception on the noob since it allows you to learn and feel like you are in
control. Although Windows has similar capabilities, it must be said that most
of the time all things work easily, initially that is. Not to bring Windows
down, but I feel more in control with Linux - besides, I love to learn new
things.