Installing KDE 4.2 in Intrepid Ibex
I've been a KDE user since I started using Mandrake Linux 8.0, which if I remember correctly by that time bundles KDE 2. It was until recently that when Kubuntu 8.10 includes KDE 4 by default rather than KDE 3, I switched to GNOME.
KDE 4 at that time for me was an unfinished product where it's not ready for prime time. The desktop effects were slow, many features of KDE 3 programs were still not ported, bluetooth was not working, and most important of all I can't run it in dual screen.
This has changed recently when KDE team released KDE 4.2. There were so many bugfixes and improvements that I think it's time for me to go back to KDE.
I've published an article on how to install KDE 4.2 in Ubuntu 8.10 (Intrepid Ibex) at Techrecipes.
Set up dual monitor in Linux
I’ve just bought ViewSonic VA2226w from Lowyat, and has been able to use it in dual monitor mode with my XPS M1330 (nvidia based) and Kubuntu. The ViewSonic that I bought is a 22" LCD monitor with resolutions up to 1680×1050 (only just as high as my 15.2" Inspiron 6000’s screen)..
I was using nvidia-config to configure the dual display, and after some trial and error, I come out with this /etc/X11/xorg.conf file:
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" RightOf "Screen1"
Screen 1 "Screen1" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "unix/:7100"
EndSection
Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
EndSection
Section "ServerFlags"
Option "Xinerama" "1"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor1"
VendorName "Unknown"
ModelName "LCD"
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "ViewSonic VA2226w"
HorizSync 30.0 - 82.0
VertRefresh 50.0 - 75.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 8400M GS"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "Videocard1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 8400M GS"
BusID "PCI:1:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen1"
Device "Videocard0"
Monitor "Monitor1"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "DFP: 1280x800 +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard1"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "CRT: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
and here’s my work desk at home (after some clean up
)

p/s: Hope nobody mind me using the Microsoft keyboard and mouse set
Recover lost / corrupted GRUB (MBR) entry
Often time the Master Boot Record (MBR) is also lost / corrupted when the we’re having problem with the partition table, and so here I extend my previous post on recovering lost partition table using the Ubuntu Live CD.
First of all, let’s mount the related stuff;
ubuntu@ubuntu:~$ sudo mount -o ro /dev/sda1 /media/ ubuntu@ubuntu:~$ sudo mount -o bind /dev/ /media/dev/ ubuntu@ubuntu:~$ sudo mount -o bind /proc/ /media/proc/
and then chroot
ubuntu@ubuntu:~$ sudo chroot /media/
Once we are in the chroot environment, run grub
bash:~# grub
Assuming you are installing grub on your first harddisk, and your root filesystem in the first partition of your first harddisk, your journey should be something like this;
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.
grub> quit
Once you’re done with that, you might want to unmount whatever you have mounted before. Don’t forget to exit from the mount directory first;
ubuntu@ubuntu:~$ cd .. ubuntu@ubuntu:~$ sudo umount /media/proc/ ubuntu@ubuntu:~$ sudo umount /media/dev/ ubuntu@ubuntu:~$ sudo umount /media
and then reboot to see if your problem is really fixed..
Recover lost partition table using Ubuntu Live CD + gpart
My friend suddenly ask me for a Ubuntu Live CD and upon being asked he told me that he has not been able to boot his machine for getting the Operating System not found error. I’m posting here on how did I helped him out with the problem for documentation.
The program I used was gpart, and to use it in Ubuntu (Live CD) is to add Universe repository to /etc/apt/sources.list as this;
deb http://archive.ubuntu.com/ubuntu gutsy main restricted universe
and run this commands to install it.
ubuntu@ubuntu:~$ sudo apt-get update ubuntu@ubuntu:~$ sudo apt-get install gpart
By running the next command, gpart will search the whole disk for possible partitions and write it’s findings to the partition table:
ubuntu@ubuntu:~$ sudo gpart /dev/sda -W /dev/sda
That’s it. Just reboot and see if your system is now bootable…
p/s: Other than gpart, testdisk can also be used for partition recovery, but i’m not covering it here..
Configure passwordless login in ssh
This post is just a quick recap on how to configure passwordless ssh login.
In my setting, herugrim is my local machine, and anduril is the remote machine with the ip address of 192.168.1.10
The first step is to (optionally) generate RSA key for use with SSH. Make sure you dont use any passphrase for this or you’ll later need to enter the passphrase upon login instead of password, which doesn’t really server our purpose here.
shakir@herugrim ~ $ ssh-keygen -t rsa -C shakir@192.168.1.10 Generating public/private rsa key pair. Enter file in which to save the key (/home/shakir/.ssh/id_rsa): /home/shakir/.ssh/id_rsa.192.168.1.10 Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10. Your public key has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.pub. The key fingerprint is: 11:d9:23:2e:68:05:59:d9:ac:5a:00:69:17:3a:b4:24
Now we can copy the public key to the server. Instead of doing it manually, OpenSSH has a nice program to do just what we need:
shakir@herugrim ~ $ ssh-copy-id -i .ssh/id_rsa.192.168.1.10.pub shakir@192.168.1.10
So now lets test if our passwordless login is successful:
shakir@herugrim ~ $ ssh shakir@192.168.1.10 -i .ssh/id_rsa.192.168.1.10 shakir@anduril:~$
Great, it works
The next thing to do is to just make sure you keep your private key safe..
Installing Voyage Linux in Wrap2c
Basicly this is how my home network looks like;

As I’m upgrading the Linux I have in my Access Point, a.k.a. my home server, a.k.a. an SBC, I’ll just share it here in my blog.
Here’s what I need:

- SBC (Single Board Computer), wrap2c in my case
- Storage – I’m using 2GB CF card here
- Mini PCI wireless adapter – mine is CM9 (Atheros based)
- RS232 adapter
- USB – RS232 converter (optional, as my laptop doesnt have serial port)
- CF card reader
- and a camera to snap the photos in this post..
Instead of installing Debian or or Gentoo as what I described in my previous post, I’m gonna just install Voyage, a minimal Debian based distro customised for SBCs.
After downloading the tarball, extract it with sudo;
shakir@herugrim ~ $ sudo tar xvjf voyage-version.tar.bz2
Time to plug in the CF card, and let’s see where it is attached to:
shakir@herugrim ~ $ cat /proc/partitions major minor #blocks name 8 0 156290904 sda 8 1 21494938 sda1 8 2 8795587 sda2 8 3 2939895 sda3 8 4 1 sda4 8 5 9775521 sda5 8 6 113282316 sda6 8 16 2014992 sdb 8 17 2014721 sdb1
Here I can see my 2Gb CF is identified as /dev/sdb, and with this I run;
shakir@herugrim ~ $ cd voyage-version shakir@herugrim ~/voyage-version $ less README
and follow the installation guide, which is in section 2 of the README
To see if things really work, I’m gonna need to make sure I can use my USB RS232 converter. Let’s plug it in and see what the kernel says;
usb 5-1: new full speed USB device using uhci_hcd and address 2 usb 5-1: configuration #1 chosen from 1 choice usbcore: registered new interface driver usbserial /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic usbcore: registered new interface driver usbserial_generic /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial Driver core /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303 pl2303 5-1:1.0: pl2303 converter detected usb 5-1: pl2303 converter now attached to ttyUSB0 usbcore: registered new interface driver pl2303 /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
What’s important from the long message is that the kernel has recognized the converter, and attach it to /dev/ttyUSB0. If your kernel doesn’t recognize the converter, fom the log you can see that it requires pl2303 module, so go re-compile your kernel to have it supported..
After everything is connected, lets run minicom;
shakir@herugrim ~ $ sudo minicom -s

Select the Serial port setup option and change it to this;

exit;

power on the board, and hope for the best




We’ve got the login prompt, mission accomplished
Huawei E220 in Gutsy Gibbon (Kubuntu)
I received a package earlier today, and was very happy to find out that it’s the Huawei E220 that I ordered few days ago. This Huawei E220 is a 3G card that supports speed of up to 3.6 Mbps, using HSDPA technology, and it makes me can’t wait to have it work with Gutsy Gibbon. After struggling for quite some time, I found out that the answer to my problem was just these two lines of command:
sudo modprobe -r uhci_hcd sudo modprobe uhci_hcd
If that short version of my solution doesn’t help, please read ahead…
I’ve been trying to get this modem to work with Gutsy Gibbon, but the online howtos that I found on the net doesnt reliably work for me.
Weird enough for me initially as sometime I can just use wvdial (more on this afterward) and get connected, while most of the time I got various errors about the modem. With these non-reproducible errors and successes, I do some trial and error while looking at the kernel logs, and came up with this one final observation;
shakir@herugrim ~ $ uname -r # just to show the kernel I'm using, as your mileage may vary 2.6.22-14-generic
At one shell I run this to see kernel messages;
sudo tail -f /var/log/messages
and got this messages upon plugging in my Huawei E220 to the USB port;
usb 3-1: new full speed USB device using uhci_hcd and address 5 usb 3-1: configuration #1 chosen from 1 choice usbcore: registered new interface driver libusual usbcore: registered new interface driver usbserial /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for generic usbcore: registered new interface driver usbserial_generic /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial Driver core /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port) option 3-1:1.0: GSM modem (1-port) converter detected usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
Nice, it has detected my Huawei E220 as GSM modem, and attach it to /dev/ttyUSB0. Let’s create a wvdial configuration to connect to the telco (Celcom in my case). My /etc/wvdial.conf looks like this;
[Dialer Celcom3G] Phone = *99***1# Modem = /dev/ttyUSB0 Username = user Password = pass ISDN = 0 New PPPD = yes Baud = 1843200 Init2 = ATZ Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = Analog Modem
So let’s just connect;
shakir@herugrim ~ $ sudo wvdial Celcom3G WvDial<*1>: WvDial: Internet dialer version 1.56 WvModem<*1>: Cannot get information for serial port. WvDial<*1>: Initializing modem. WvDial<*1>: Sending: ATZ WvDial<*1>: Sending: ATQ0 WvDial<*1>: Re-Sending: ATZ WvDial: Modem not responding.
Ouch, an error. The modem has been detected, what could go wrong? After some time, and no success with the available tutorials, I finally got this working, as the problem was related to the USB drivers. What I did was to reload the uhci_hcd module
shakir@herugrim ~ $ sudo modprobe -r uhci_hcd
Lets take a look at what the kernel says about this;
[..snipped..] Dec 4 22:45:24 herugrim kernel: [ 1343.504000] usb 3-1: USB disconnect, address 6 Dec 4 22:45:24 herugrim kernel: [ 1343.504000] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0 Dec 4 22:45:24 herugrim kernel: [ 1343.504000] option 3-1:1.0: device disconnected [..snipped..]
and then lets load the module back again
shakir@herugrim ~ $ sudo modprobe uhci_hcd
and see what happens;
USB Universal Host Controller Interface driver v3.0 ACPI: PCI Interrupt 0000:00:1a.0[A uhci_hcd 0000:00:1a.0: UHCI Host Controller [..snipped..] usb 3-1: new full speed USB device using uhci_hcd and address 2 usb 3-1: configuration #1 chosen from 1 choice option 3-1:1.0: GSM modem (1-port) converter detected usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0 option 3-1:1.1: GSM modem (1-port) converter detected usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1 option 3-1:1.2: GSM modem (1-port) converter detected usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2 [..snipped..]
Last time the GSM modem was attached to just /dev/ttyUSB0, but now it’s also attached to /dev/ttyUSB1 and /dev/ttyUSB2. And I guess it’s time to connect using wvdial;
WvDial<*1>: WvDial: Internet dialer version 1.56 WvModem<*1>: Cannot get information for serial port. WvDial<*1>: Initializing modem. WvDial<*1>: Sending: ATZ WvDial Modem<*1>: ATZ WvDial Modem<*1>: OK WvDial<*1>: Sending: ATZ WvDial Modem<*1>: ATZ WvDial Modem<*1>: OK WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 WvDial Modem<*1>: OK WvDial<*1>: Modem initialized. WvDial<*1>: Sending: ATDT*99***1# WvDial<*1>: Waiting for carrier. WvDial Modem<*1>: ATDT*99***1# WvDial Modem<*1>: CONNECT WvDial<*1>: Carrier detected. Waiting for prompt. WvDial: Don't know what to do! Starting pppd and hoping for the best. WvDial : Starting pppd at Tue Dec 4 22:49:25 2007 WvDial : Pid of pppd: 6433 WvDial<*1>: Using interface ppp0 WvDial<*1>: local IP address 10.188.15.175 WvDial<*1>: remote IP address 10.64.64.64 WvDial<*1>: primary DNS address 202.188.0.133 WvDial<*1>: secondary DNS address 202.188.1.5
It works, yeay
As usual, lets create a script for this;
#!/bin/bash
sudo modprobe -r uhci_hcd
sudo modprobe uhci_hcd
echo "Waiting kernel to detect modem device"
# Wait till the kernel recognizes our E220
while true; do
# Read log
tail -n 20 /var/log/messages > access.history
sleep 1
tail -n 20 /var/log/messages > access.current
LOG=`diff access.history access.current | grep ">" | tr -d ">"`
# Check if it is detected
if [[ "$LOG" =~ "converter now attached to ttyUSB1" ]]; then
echo "Modem device detected, dialing..."
# If it is, get out of the loop immedietly
break
fi
done
rm access.history access.current
# Start dialing
sudo wvdial Celcom3G
p/s: The script is now maintained here. Please go there to see the latest updates and discussions
Nikon D40x in Ubuntu Linux
I’ve been using Nikon D40X on my previous trip to Jakarta (and Bandung). For this I need to update my previous script as there are few differences, as the following:
- I set the camera to use RAW format rather than jpeg
- Data transfer is through the laptop’s built in MMC card slot, rather than USB
- I’m now a (K)Ubuntu user
First step, is the software part. As RAW format is not really usable for "presentation", I need to convert it to another format, say JPEG. For this I’m gonna need ufraw. Let’s install it;
sudo apt-get install ufraw sudo apt-get install gimp-ufraw #optional
Using ufraw-batch (included in the ufraw package), I came up with this self explanatory, lightly commented bash script;
#!/bin/bash
#Set some variables
MOUNT_DIR=/media/mmc
MOUNT_DEV=/dev/mmcblk0p1
PHOTO_DIR=/home/shakir/Photos/temp/D40X
#Copy files from the MMC card
sudo mkdir $MOUNT_DIR
sudo mount -o uid=shakir,gid=shakir $MOUNT_DEV -t vfat $MOUNT_DIR
mv -v /media/mmc/dcim/100nd40x/* $PHOTO_DIR
sudo umount $MOUNT_DIR
sudo rmdir $MOUNT_DIR
cd $PHOTO_DIR
mkdir jpeg
#Convert RAW files to low quality JPEGs
for i in `ls *.nef`; do
ufraw-batch –out-type=jpeg –out-path=jpeg/ \
–compression=70 –size=600,600 –overwrite $i
mv -v $i nef/
done
mkdir nef
mv *.nef nef/
The script would generate a low quality / resolution JPEGs, based on the un-processed RAWs. The JPEGs are useful to actually help me deciding which photos are meant for deletion, and which to keep. Later I would manually go to the selected RAW files folder, and;
ufraw *.nef
to edit the RAW files. This final step would give me the files that I mean to keep;
ufraw-batch --out-type=jpeg --out-path=jpeg/ --compression=100 --overwrite *.nef
I bring back no souvenirs but these photos;
Recover deleted files with photorec
I was just watching a movie while suddenly all the files except the hidden ones in my home directory were gone, just as someone issued the command
sudo rm -rf /home/shakir/*
To avoid further data loss, I quickly power off and boot into my Ubuntu live CD to create an image of my /home partition. Here’s how to see in which partition is my /home directory:
shakir@herugrim ~ $ cat /proc/partitions major minor #blocks name 8 0 156290904 sda 8 1 21494938 sda1 8 2 8795587 sda2 8 3 2939895 sda3 8 4 1 sda4 8 5 9775521 sda5 8 6 113282316 sda6
From the partition sizes I can tell my /home partition was in the /dev/sda6, and the next step is to really create an image of the partition to safely doing the recovery process without risking of losing more data. /media/usbdisk is where my external usb harddisk is mounted
sudo dd if=/dev/sda6 of=/media/usbdisk/herugrim-sda6-20071010.img
Photorec is part of testdisk package, and this is how to install it in ubuntu;
sudo apt-get update sudo apt-get install testdisk
It’s time to actually do run the program
sudo photorec /home/shakir/temp/herugrim-sda6-20071010.img
After going through some options, photorec starts doing it’s job.
Photorec stores recovered files in recup_dir.<sequence>/<sequence>.<file extension> in the specified target directory, which is not very useful. Here’s a script I wrote to find all the recovered JPEG files and move/rename it accordingly. Almost the same technique can be used for other file formats.
#!/bin/bash
PHOTODIR=/home/shakir/temp/photorec
cd $PHOTODIR
mkdir JPEG
for i in `ls | grep recup`;do
for j in `ls $i/*.jpg`; do
if FILE=`exiv2 $j 2>/dev/null | grep timestamp | awk ‘{ print $4"-"$5 }’ | tr -d ‘:’ | grep 200`; then
cp -v $j "JPEG/"$FILE".jpg"
fi
done
done
Automatic backup using rsync
I’ve suddenly lost all the files in my home folders, and I quickly do these to not let the impact to be as bad, if it ever recurs.
Say 192.168.1.10 is my backup server (anduril), herugrim is my laptop’s name, these are the steps I did to let my laptop automatically rsync to the backup server.
Configure Password-less Login
Generate RSA key for use with SSH. Make sure you dont use any passphrase.
shakir@herugrim ~ $ ssh-keygen -t rsa -C shakir@192.168.1.10 Generating public/private rsa key pair. Enter file in which to save the key (/home/shakir/.ssh/id_rsa): /home/shakir/.ssh/id_rsa.192.168.1.10 Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10. Your public key has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.pub. The key fingerprint is: 11:d9:23:2e:68:05:59:d9:ac:5a:00:69:17:3a:b4:24
Copy the public key to the server
shakir@herugrim ~ $ ssh-copy-id -i .ssh/id_rsa.192.168.1.10.pub shakir@192.168.1.10
Test if passwordless login successful
shakir@herugrim ~ $ ssh shakir@192.168.1.10 -i .ssh/id_rsa.192.168.1.10 shakir@anduril:~$
Configure Target Directory
shakir@anduril:~$ mkdir backup/herugrim -p
Manual Rsync (test power)
shakir@herugrim ~ $ rsync --verbose --progress --compress --rsh=ssh --recursive --times --perms --links --delete /home/shakir anduril:/home/shakir/backup/herugrim -e "ssh -i /home/shakir/.ssh/id_rsa.192.168.1.10"
Configure cron
At your machine To edit your crontab entry, issue this command
crontab -e
Add this entry to your crontab
30 9 * * 1-5 rsync --compress --rsh=ssh --recursive --times --perms --links --delete /home/shakir anduril:/home/shakir/backup/herugrim -e "ssh -i /home/shakir/.ssh/id_rsa.192.168.1.10"
Run cron
sudo /etc/init.d/cron start #depending on your linux distro
And I guess that’s all..
backup guys, backup…
Connect with me
What I'm Doing (via twitter)...
- is applying for US visa. The website is not helping at all http://twitpic.com/16hvxp 1 week ago
- @abumuaaz want to focus on my wireless project (yes, I get paid for that) and some development work. Ada job to pass ka? :) in reply to abumuaaz 1 week ago
- is running 'sudo dd if=/dev/zero of=/dev/sda' on his laptop. Will it work, my computer forensic friends? 1 week ago
- is on his first day of being jobless, hahaha. 1 week ago
- finished reading Crowdsourcing: Why the Power of the Crowd Is Driving the Future of Business, in 32 hours. Next, Wikinomics. 1 week ago
- is on his way to island hopping. Woohoo! 1 week ago
- is leaving on a jetplane, don't know when he'll be back again... 2 weeks ago
- missed his flight to KK. Will need to take the first flight tomorrow and pray he'll make it for his 9am meeting. 2 weeks ago
- More updates...














