Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

October 3, 2009

Reliance Netconnect on Ubuntu

Note: These are specific instructions for using ZTE-AC2726 modem on Ubuntu Jaunty.
If you are using a different modem, instructions may vary.

I got one of the newer modems with my wireless broadband connection from Reliance. It is a model that I had not come across in other blog posts, but I was encouraged by seeing 'Linux OS' mentioned among the system requirements.

Step 1: Open box and first look
The linux support is in the form of a driver on the cd that comes in the package. There is a deb package, but an attempt to install it fails because it seems to support kernels upto 2.6.27 only. The modem looks nice though!

Step 2: Plug in modem
On plugging in the modem, it gets mounted and shows up in nautilus like any storage drive. 'lsusb' confirms the bad news - the device is listed as 'Bus 007 Device 006: ID 19d2:fff5'. The modem is being recognised as a storage device only.

PS: In Ubuntu 9.10 (Karmic), the device is recognized as a modem directly and the steps 3 and 4 are not required.

Step 3: usb_modeswitch to the rescue
usb_modeswitch is an application written specifically for this purpose.



wget http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-1.0.5.tar.bz2
tar -xjvf usb_modeswitch-1.0.5.tar.bz2
cd usb_modeswitch-1.0.5
sudo make install


If there were no errors, you can add this snippet to /etc/usb_modeswitch.conf. I have broken MessageContent into 2 lines so that it can be shown in entirety. You should put everything on one line.



# ZTE AC2726
#
DefaultVendor= 0x19d2
DefaultProduct= 0xfff5

TargetVendor= 0x19d2
TargetProduct= 0xfff1

MessageContent="5553424312345678c00000008000069f03
0000000000000000000000000000"


Now run


sudo usb_modeswitch


You should see the success message and lsusb should show the product id is now fff1.

Step 4: Load the usbserial module


sudo mobdprobe usbserial vendor=0x19d2 product=0xfff1


Step 5: Connect using wvdial
If all has gone well, the modem should be recognised and ready to use.
'ls /dev/ttyUSB*' should show some USB devices


sudo apt-get install wvdial


You can run 'wvdialconf' to generate the initial configuration file and then edit it to enter your phone number and password.
This is my wvdial.conf


[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = #777
Password = XXXXXXXXXX
Username = XXXXXXXXXX
PPPP Path = /usr/sbin/pppd
New PPPD = 1
Stupid Mode = 1
Tonline = 0


Now you are all set to


sudo wvdial


and get connected.

Notes:
1. I did the initial activation of the device from a windows pc. Not sure if it can be done with wvdial by using the phone number for that purpose.
2. Loading of the specific usbserial module can be automated by adding it to the kernel line in the boot menu. udev rules can be used for running usb_modeswitch on plugging in the modem - these are not covered here.

February 28, 2009

Ubuntu Jaunty Alpha 5 screenshots







The new notifications look good !

January 3, 2009

Emacs - a beginner's setup


It's almost 5 months since I started using emacs on a regular basis. After beginning to use it as a platform to learn lisp (with SLIME), now I use emacs for coding python and bash, writing manuscripts (with markdown), doing statistics with R (using ESS), file and directory management and sometimes even to play chess on FICS.

Emacs, in my opinion is something anyone should give a whirl. It is open source, free and easily installable on any operating system. It is an absolutely amazing piece of software - give it a shot and if after a couple of months you decide to give up, atleast you have got a taste of what it is about. Here I will attempt to list a few things that will ease the introduction to emacs.

Note: Many of these instructions may be specific for Gnu-emacs on Linux. They may vary if you are using another emacs variant or another platform.

1. Start off with a good looking emacs

An oft-repeated complaint is that emacs looks bad, bad enough to deter a newcomer sometimes. But then, it doesn't have to ...

Use the latest emacs snapshot that allows use of your preferred fonts with nice antialiasing. In Ubuntu this means

sudo aptitude install emacs-snapshot-gtk emacs-goodies-el

Now you can use any font you prefer by modifying the Xresources file as detailed here.

2. Disable the splash screen, scrollbar and toolbar. Add to your .emacs -

(setq inhibit-startup-message t)
(tool-bar-mode -1)
(scroll-bar-mode -1)


It may seem surprising to consider disabling the scrollbar and toolbar. Maybe a case can be made for having these on while you wean yourself from the mouse, but I believe that there are greater dividends to doing this early and getting used to mouseless editing. I have preferred leaving the menu-bar on although I dont use the menu items, just because it sometimes allows me to easily refer to the shortcuts available, but again, it is worth considering disabling this too.

3. Syntax highlighting

Install color themes. In ubuntu, this is done easily by installing emacs-goodies-el. Now, add this in your emacs to have 'font-lock' on for syntax highlighting.

(global-font-lock-mode t)

After M-x, typing color-theme- and hitting tab will shows the completions available. Try out the different color-themes to decide what you want to use. To enable it automatically, add a line like this -

(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-scintilla)


4. Enable line numbers

If you feel lost without them,

(require 'linum)
(global-linum-mode)

5. If you like to 'see' a selected region, you have to enable transient-mark-mode -

(setq-default transient-mark-mode t)

6. And if you have trouble copy-pasting between other windows and emacs, this worked for me -

(setq x-select-enable-clipboard t)

With these basic things out of the way, you have a decent emacs set up to start with. There are multiple options for further customization, but I will leave them for you to experiment with. Packages to definitely try out are ido-mode, pabbrev, bookmarks and yasnippet.

Loading image

Click anywhere to cancel

Image unavailable

October 15, 2008

Ubuntu Intrepid upgrade problems solved

Oct 15, 2008

I recently upgraded two of my computers to Ubuntu 8.10 (Intrepid) which was in alpha at that time and is beta at present. Some small thing always seems to break for me with an upgrade and this time there were two issues, which I have finally managed to sort out this week.

1. Google calendar in Thunderbird

I had my google calendar nicely set up in Thunderbird using the Lightning and Provider for Google calendar extensions. After the upgrade, my google calendar wasn't displaying anymore and moreover all the calendar related menu items were disabled. Finally I found the answer here.
I uninstalled lightning and provider, did a 'sudo aptitude install libstdc++5', then reinstalled the extensions. On restarting thunderbird, the calendar was now there as before.. a relief.

2. Fingerprint reader and thinkfinger

After the upgrade, my fingerprint reader appeared to not be working. Swiping the finger elicited no response at all. Searching in launchpad brought me here showing others were having the same issue. Surprisingly it seemed that the fingerprint identification was working, but needed a carriage return (Enter key) after the swipe to work. Some workarounds are beginning to appear (though nothing final) and what worked for me was a simple change in xorg.conf. Adding the line
'InputDevice "Generic Keyboard"' to the "ServerLayout" section got the reader working again after a restart of xserver.

Hope these help someone with simlar issues.

April 29, 2008

A first look at Kubuntu KDE4

While I have tried out KDE in the past, Gnome has always been my everyday working environment. Kubuntu Hardy KDE4 version was an opportunity to test if KDE4 was going to change that.
I installed Kubuntu KDE4 on my Thinkpad. KDE4 does look nice with a Mac like feel. But it felt sometimes like there is too much accent on looks. This is the default desktop with a couple of widgets.


Dolphin looks much better than konqueror as the file browser.


One application that really grabbed my attention was Okular. It looked really nice and was very functional too. The ability to use a highlighter in PDF documents was something I have been looking for. This is one application I might want to install in my Gnome environment too.


At the end of the day, KDE4 still failed to impress. It still looks far too incomplete and is definitely not going to replace Gnome on my desktop in the near future.

March 15, 2008

Ubuntu Hardy on Thinkpad x61s

Update:
The brightness hot keys problem referred to below is fixed in kernel 2.6.24.14 that is available now.

Installation:

New install using the PC desktop cd of Ubuntu Hardy alpha 6.
Since the X series thinkpads dont have an inbuilt optical drive I created a live USB from the iso using the isotostick script from here. Bootup into the live environment and installation from there was faster than I have ever experienced.

What works out of the box:
No installation issues.
Compiz-fusion runs beautifully.
Sound, wireless need no additional work, thanks to Intel.
Suspend and hibernate work out of the box!

Needed tweaking:
While the volume control keys work, the Fn-Home and Fn-End key combinations to change LCD screen brightness did not work. This is the bug reported in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/198476 and as I mentioned there, the fix (temporary) reported in https://bugs.launchpad.net/ubuntu/+bug/172985 worked for me.

Setting up the fingerprint reader:
I got my thinkpad with the fingerprint reader, but the ease of setting it up was a pleasant surprise. Just followed the instructions here with the difference being that you dont need to add any additional repos - thinkfinger is added in the official Hardy repos.

Not working, could not fix:
Well, really nothing for now! I am happy I removed Vista (after just booting into it to update the bios drivers). After 30 mins of Vista, booting into Ubuntu seemed like moving a century into the future ! All developers associated with Ubuntu and linux can be proud of the work they have done and the product they have created. And of course, Thinkpads are made for Linux.. too bad they come with Vista pre-installed and Lenovo refused to sell me one with no OS or with an option to refuse the license and get a refund. But thats another story...

January 26, 2008

Wrapping workspaces in Gnome

One source of frustration sometimes with gnome is that there is no way to wrap workspaces like in KDE, compiz or even the other window managers like XFCE. This means that, if like me you use 'move to workspace right' and 'move to workspace left' frequently while working, it can frustrating not to be able to get back to workspace 1 from the last one in one simple step.

Searching for some way to do this, I came upon this post describing the use of wmctrl to do this. I had never heard of wmctrl before, but it turns out to be pretty cool. So go ahead, install it (sudo aptitude install wmctrl) and now -


raja@eee:~$ wmctrl -d
0 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 1
1 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 2
2 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 3
3 * DG: 800x480 VP: 0,0 WA: 0,2 800x476 Desk 4

raja@eee:~$ wmctrl -s 1 && wmctrl -d
0 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 1
1 * DG: 800x480 VP: 0,0 WA: 0,2 800x476 Desk 2
2 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 3
3 - DG: 800x480 VP: N/A WA: 0,2 800x476 Desk 4



As we can see, 'wmctrl -d' lists the desktops and places an asterisk to indicate the current desktop. And 'wmctrl -s n' allows us to switch to the desktop n, with the desktops being numbered from 0 onwards.

With this knowledge, it is easy to write a couple of scripts to switch to the desktop on the left and the one on the right, with wrapping enabled.


#!/bin/bash

#ws_wrap_lt.sh

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/\*/ {print $1}')

#work space on left
lws=$(($cws-1))

#wrap if required
if [ $lws = -1 ]; then
lws=$(($ws-1))
fi
echo $lws

#change to next workspace
wmctrl -s $lws


and ..


#!/bin/bash

#ws_wrap_rt.sh

#get number of workspaces
ws=$(wmctrl -d | wc -l)

#current workspace index
cws=$(wmctrl -d | awk '/\*/ {print $1}')

#work space on right
rws=$(($cws+1))

#wrap if required
if [ $rws = $ws ]; then
rws=0
fi

#change to next workspace
wmctrl -s $rws


Save the files somewhere and now you can use gconf-editor to map commands to these scripts. Then you can set up a desired key or key combination to run these commands. An option is also to use only one of the scripts and rotate through the workspaces with one key. On the eeepc, I have mapped the 'menu' key to ws_wrap_rt.sh and use just that key to get to any workspace I want. If you use only two workspaces,one key works to toggle the workspaces.

January 14, 2008

Ubuntu on my eee

I bought an eeepc a couple of days back after my thinkpad was stolen. While it is considered to be a secondary computer at best, it seemed worthwhile trying it out. I think it was an unfortunate choice of linux distribution by asus and there was no way I was going to be stuck with xandros. So the decision was only between Ubuntu and Archlinux. I decided on the former because it seemed to be better documented on the eee and would take less time to set up (so I thought).

It was finally 4 hours before I had Ubuntu running. Briefly, what learned were -

1. Netboot does not work
Well, the eee can PXE boot once boot from lan is enabled in the bios, but the netboot image of either gutsy or feisty dont seem to have the modules for the ethernet card, so its a no-go after that.

2. Cannot find casper/.vml
If you followed the instructions here to make a bootable USB drive and get the error message 'cannot find casper/.vml' when trying to boot, just move vmlinuz and initd.img from the casper folder into the root directory of the usb drive and then modify the locations accordingly in syslinux.cfg.

3. Booting from the usb drive
I struggled a bit to boot from the usb drive - it wouldnt boot even after setting 'removable drive' as the first in boot order in the bios. It seems like the usb drive was being added as a second hard drive. The more reliable way to boot into the drive was to hold down the Esc key which offers a choice of devices to boot from.

4. Nothing older than gutsy
I had a gutsy beta iso already downloaded, so used it the first time. Which was unfortunate because it does not have the module for the ethernet and so I ended up without a working wired or wireless connection. Re-installing with the final gutsy iso solved the issue.

After all these unexpected difficulties, I finally had Ubuntu on the eee and spent the next day tweaking it. It boots in just under 40 seconds and seems to last about 2hrs30min on the battery.

All in all, it looks like a good deal!

September 13, 2007

Carry the gibbon in your pocket: How to make a liveUSB of Gutsy Gibbon with persistence

The live CD is a fantastic tool to try out linux and many distros have them now. The newer feature is 'persistence' where changed settings are stored for future sessions. Combining persistence with a live USB allows you to really carry your desktop with you on just a USB stick. These are the steps that I needed to make a live USB with the Tribe 5 release of Ubuntu Gutsy.

This is not intended to be a standalone howto. I am not duplicating all steps and workarounds detailed in the Ubuntu wiki, so I suggest that you have that by the side if you are trying this. Also, I refer to the disk as /dev/sdb because that was what it was for me. I cannot emphasize enough that this may be different for you and blindly copying the commands can end up in formatting another drive

WHAT YOU NEED:
1. An USB drive with capacity of atleast 1 GB.
2. A live cd of Gutsy - The iso will also do.
3. A PC with linux or Windows.
I am doing this with a Maxtor 2 GB drive using a pc running Ubuntu Fiesty and a live cd of Ubuntu Gutsy.


STEP ONE: Partition the disk

You will need to create atleast 2 partitions.
One will be a primary FAT16 partition of 750 MB that is bootable.
Second will be a primary ext2/ext3 partition for the persistence feature.
I used 200 MB for the second partition and created a third partition in the remaining free space as FAT16.
So plug in the USB drive and identify the device name for the drive. It is /dev/sdb for me and it is important to find this correctly so you dont partition or format another drive. The output for 'dmesg |tail', 'df -h' or 'mount' should help identify the correct drive. Opening the gnome partition editor also makes it easy to recognize the device.
The partitioning itself can be done with either gparted, cfdisk or fdisk. The disk must be unmounted before doing the partitioning and all three methods are fairly easy, though someone used to GUIs may be more comfortable with gparted. These are a couple of screenshots with gparted.







Using fdisk and following the tutorial in the wiki also works perfectly (I tried it too). You will not yet be able to assign a label with any of these methods. As seen in the last screenshot, I ended up with the three partitions.
Now the following commands assign labels to these partitions - Ubuntu keeps automounting the partitions, so I had to unmount them before this step.


sudo mkfs.vfat -F 32 -n gutsy /dev/sdb1
sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2
sudo mkfs.vfat -F 32 -n data /dev/sdb3


Remember to change the device name if the name is not /dev/sdb* for you.
So I have the three partitions with the labels now. The second partition has to be labeled 'casper-rw' so that is is recognised by the system as the partition to use for storing changes. You can choose different labels for the other two, if you wish.
If the device is not mounted now, mount it manually or just unplug it and plug it back in to allow it to be automounted.


STEP TWO: Copy necessary files

I used the cd I had already burnt as the source for the files. If you have an iso only, you can mount the iso like this and use it as the source


mkdir /tmp/ubuntu
sudo mount /path/to/iso /tmp/ubuntu -t iso9660 -o loop


Now cd into the source directory (/media/cdrom or /tmp/ubuntu) from a terminal and then do the following to copy the files to the gutsy partition on the disk. I am assuming here that the partition is mounted as /media/gutsy.



#cd into source directory
cd /media/cdrom

#Copy these folders
cp -rf casper disctree dists install pics pool preseed .disk /media/gutsy

#Copy all files from isolinux directory
cp isolinux/* /media/gutsy

#Copy these files into the root destination directory
cp md5sum.txt README.diskdefines ubuntu.ico /media/edgy

#Copy the kernel image and initrd from casper directory and mt86plus from install dir
cp casper/vmlinuz casper/initrd.gz install/mt86plus /media/edgy

#rename isolinux.cfg as syslinux.cfg
mv isolinux.cfg syslinux.cfg


You can modify syslinux.cfg like this. Alternatively you can copy this and paste it in syslinux.cfg replacing everything else.


DEFAULT custom
GFXBOOT bootlogo
APPEND preseed/file=preseed/ltsp.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL custom
menu label ^Start Ubuntu in persistent mode
kernel vmlinuz
append preseed/file=preseed/ltsp.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL live
menu label ^Start or install Ubuntu
kernel vmlinuz
append preseed/file=preseed/ltsp.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL xforcevesa
menu label Start Ubuntu in safe ^graphics mode
kernel vmlinuz
append preseed/file=preseed/ltsp.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL check
menu label ^Check CD for defects
kernel vmlinuz
append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
LABEL memtest
menu label ^Memory test
kernel mt86plus
append -
LABEL hd
menu label ^Boot from first hard disk
localboot 0x80
append -
DISPLAY isolinux.txt
TIMEOUT 300
PROMPT 1
F1 f1.txt
F2 f2.txt
F3 f3.txt
F4 f4.txt
F5 f5.txt
F6 f6.txt
F7 f7.txt
F8 f8.txt
F9 f9.txt
F0 f10.txt


Note that you have most of the boot options as in the live cd, but the default is the custom option, which is the persistent mode here.


STEP THREE: Make USB drive bootable

We will install syslinux and mtools and use them to make the drive bootable


sudo aptitude install syslinux mtools
sudo umount /dev/sdb1
syslinux /dev/sdb1


Worked perfectly for me.


STEP FOUR: Checking it

Reboot and change bios settings so that you boot from the USB drive. I was able to boot in without problems. I created a username and password (default user is 'ubuntu' without a password). I logged into my new account and changed terminal settings, changed the metacity theme and installed gnumeric. Shutdown, reboot again - and voila - all the changes are there!

I had problem in a later session where I could not log into gnome with gnome complaining that it could not read the .ICEauthority file. Logging into a failsafe terminal and deleting the ~/.ICEauthority file allowed me to start gnome again.
The casper-rw partition is the place where all data and changes are stored without any compression. So if you store any data in your home folder, you can see it here - that means it is is easy to retrieve it without booting in with the drive and also has implications for privacy.

Things to explore:
Find what is the ideal size for the casper-rw partition?
Using an encrypted home or data folder?
Dual boot with another linux distro?
Is it possible to not automount the gutsy and casper-rw partitions by modifying udev rules so that all three partitions dont mount every time I insert the drive in my laptop?

Summary:
The process was much simpler than I had expected. Now I have a bootable Ubuntu drive with me all the time, while the 1 GB FAT partition is enough storage to use as a regular USB stick. Now when I am urging a friend to try out Linux, I know I have the gibbon ready in my pocket!

August 7, 2007

A simple stopclock for kde and gnome

Zenity and Kdialog are two awesome applications to rapidly create simple applications with a gui frontend. Needing a simple way to start a timer for a few seconds to minutes, I chose to write a small script using zenity. Translating this later to work on kde with kdialog was an interesting exercise with some things being more difficult, but there being more flexibility too.

Feel free to try these scripts in the DE of your choice. Typing 'stopclock 10' would start a countdown to 10, for example. Not something designed for practical use, but more as a demonstration of the use of zenity and kdialog. Also this is a good illustration of the use of dcop - another very powerful application that is not very well known or documented.

1. stopclock.sh for KDE


#!/bin/sh

if [ $# -ne 1 ]
then
echo $#
echo "Usage: stopclock (number of seconds)"
exit
fi

stime=$(date +%s) #starting time
etime=0 #elapsed time
stoptime=$1 #time at which to stop
ltime=$stoptime #time left

d=$(kstart --ontop --alldesktops kdialog --progressbar "Starting countdown..." $stoptime)
dcop $d setAutoClose true

while [ "$etime" -lt "$stoptime" ]; do
sleep 1
ctime=$(date +%s) #current time
: $((etime=$ctime-$stime))
: $((ltime-=1))
label=$ltime" seconds left"
dcop $d setLabel "$label"
dcop $d setProgress $etime
done


2. stopclock.sh for Gnome


#!/bin/bash

if [ $# -ne 1 ]
then
echo $#
echo "Usage: stopclock (number of seconds)"
exit
fi

stime=$(date +%s) #starting time
etime=0 #elapsed time
stoptime=$1 #time at which to stop
ftime=0 #fraction of time elapsed
label="counting down "$stoptime" seconds"

while [ "$etime" -lt "$stoptime" ]; do
sleep 1
ctime=$(date +%s) #current time
: $((etime=$ctime-$stime))
ftime=$(echo $etime*100/$stoptime | bc -l)
echo $ftime
done | zenity --progress --text="$label"

June 30, 2007

Archlinux - First Impressions

After having been faithful to Ubuntu for about 3 years, I decided a month back to try another distro on my Thinkpad X 40. Debian or Suse did not seem to be different enough to be of interest. So I decided to try out something that is more 'hands on' than Ubuntu. After trying out a couple of distros on Virtualbox (by the way - another use for virtual machines), I decided to give Archlinux a try.
Now I have Arch running for a week and am actually typing this from Arch - so it is time to give my first impressions. The main things that stand out in comparison to Ubuntu are -

System configuration

The Arch philosophy is to avoid using GUIs for configuration. Most of the configuration is done in /etc/rc.conf. The configuration files are well organized and nicely commented so that just a few days of using them and you begin to wonder why on earth you need a GUI for this.

Lean System

The recommended way to install Arch is to install the base only first and then add the packages you want. It is amazing how lean and fast the system feels when you do this. Ubuntu is very scaleable so that you can again do a server only install and then install the required packages, but I have never installed it that way and dont know if that would give a system as lean and fast as this.
I have installed the packages I want and overall the system is significantly faster than when I use Ubuntu - I think it is the combination of having only required packages and these being i686 optimized. Suspend works beautifully and suspend and resume are much faster too.

Rolling updates

Arch has a system of rolling updates so that the different 'releases' are little more than arbitrary snapshots. Each day is a new release! I did the base install from an older release, but it is a breeze from there to update the base packages and then proceed. The rolling release means that the packages are often newer than those in Ubuntu (where I have had problems with older versions for quite a few apps).

Package Manager

Pacman is an awesome package manager. While aptitude (or apt-get) has been good in Ubuntu, I think pacman is faster and more advanced. In Ubuntu, there is also some confusion with many ways of installing packages (Synaptic, Add/Remove, apt-get, aptitude, etc). Having one way to do it is simpler.

Summary

Archlinux is a splendid choice for an intermediate to advanced linux user who wants to try a leaner, faster and more flexible system. It is more demanding and takes more time to install than Ubuntu, but it is not as bad as Gentoo while still resulting in a very fast system and I think the extra time and effort is well spent.
Looking at Ubuntu a little critically, I think it has become a gateway for newcomers emigrating from Windows. So most of the development seems to be going into easier installs, newbie-friendly single click configuration, GUIs for everything, etc. Arch, with almost opposite philosophy has been a refreshing change.

June 2, 2007

10 tips to customise you new Ubuntu install

One of the best things about linux is that you can customise every aspect of it so that your computer really feel like yours. Here are a list of 10 things I do with a fresh install. These only reflect my preferences, but they should serve to let a newcomer know what tweaks are possible.
The first three are related to the terminal - so those resolved not to touch the terminal can safely skip them.

1. Terminal - looks

(i) Open the terminal, go to Edit -> Profiles and make a new profile with your name. In the 'General' tab, change the font and the font size to something you like.
(ii) In the 'Title and Command' tab, you can choose to keep a fixed title (maybe just your name or a favorite quote) or if you enable dynamically-set title, you can have the title show dynamic information like the current directory.
(iii) In the next tab 'Colors' you can choose the background and foreground colours for your terminal and then you can set some degree of transparency in the next tab if you like it.
(iv) Finally, in the scrolling tab, you can disable the scrollbar if you prefer. In addition, if you right click in the terminal and uncheck 'Show Menubar', you have a pristine looking terminal without a distracting menubar or scrollbar and in colours and fonts that you like !

2. Terminal - prompt

The default prompt in ubuntu is usually in the form 'user@hostname:directory'. No worries, you can change it to your heart's desire. Again open ~/.bashrc. 'PS1' represents you command prompt and is defined in this file. Below the line defining your default prompt, you will find a commented out section defining a color prompt. You can uncomment this to get a prompt which is of a different color from the rest of the text. In addition, you can change the format of the font. Just remember that '\u' stands for username, '\h' for hostname and '\w' for the present working directory.

3. Terminal - aliases

Setting up aliases for commands that you use commonly makes life a lot easier. You can define these in the .bashrc file again. Towards the end of the file you will notice that there are some aliases already defined and commented out - you can use them if you want to. In addition you can define your own aliases. My favorite is to set up an alias for installing programs so that I dont have to type 'sudo aptitude install' or 'sudo apt-get install' everytime. So at the end of my bashrc I have these lines -

#My aliases
alias getme='sudo aptitude install $1'
alias batt='acpi -V | grep Battery'

Now I can just type 'getme abiword', for example, when I want to instal abiword ! The other alias allows me to check the battery status on my laptop from the terminal by just typing 'batt'. Very useful when I have all the panels hidden and therefore cannot see the battery status applet.

4. Desktop - themes

Changing the wallpaper and windows themes to suit your taste is of course the most common way of customizing the looks. http://www.gnome-look.org/ is an excellent resource for wallpapers and themes if you want to go beyond the choices in the default install. A good idea is to choose the wallpaper first and then select a theme that matches the wallpaper in color and look. The themes are usually downloaded as 'xyz.tar.gz'. Dont uncompress them - just go to System -> Preferences -> Theme and drag the file you downloaded to install it.

5. Desktop - panels

Once you have the wallpapers and the theme set up, you can turn to the panels. You can add more panels or remove existing panels according to your taste. If you have a small screen, autohiding panels is useful to increase your screen estate. However, when you right click on a panel and choose 'autohide', you will find that a bit of the panel still sticks out. This is because the autohide size is 6 pixels by default. If you dont like it, open gconf-editor and then go to '/apps/panel/toplevels/top_panel_screen0' and change 'auto_hide_size' to 0. Now, the panels stay well hidden and you have the full screen.
However, to see something on the panel now, you have to hover over the edge with the mouse. A cool trick is to bind toggling the autohide to a keypress, so that you can hide and show the panels by just pressing a key. See this post to learn how to do this.

6. Custom keymaps

Extra keys that you dont need or that dont function can be mapped to suit your needs. On my thinkpad, for example, this allows me to use the 'Access IBM' key and the forward and backward keys.
So let us say you want to map a key to run the hide panel toggle script. We first need to find the keycode for this key. Open a terminal and type 'xev' and press enter. A small window opens now. Press the key and look at the output in the terminal. Among the output, you will find something like 'keycode 44'. We can now map this key as F13 for instance. To do this create a file called .Xmodmap in your home directory. Type 'keycode 44 = F13' in this file. The exact keycode will vary depending on the key you are mapping, of course. Save the file and reboot for the key to become active. Now you can map any command to this key.

7. Grub

(i) Open /boot/grub/menu.lst. There are a couple of things you can modify according to your taste. Look for the entry 'default'. This determines the default choice that will be booted. 0 means the first entry is default, you can count down the entries to select another to make the default.
(ii) If you rarely use the other options (like me), you can uncomment the line 'hiddenmenu'. This means that you wont see the menu during boot up normally, but you can press the Esc key to bring it up when you want it.
(iii) The entry 'howmany' determines how many kernels you can see in the menu. You can change it from default all to something like 'howmany=3' if you dont want all the kernels to accumulate in you menu.lst.
(iv) Finally, those who miss the text during the boot up, remove 'quiet' from the kernel line - now you will see the bootup steps being displayed while the system starts.

8. Boot up - splash

If you want to change the image that comes at the splash screen, you can look at http://www.gnome-look.org/ for some alternatives. Once you choose an image you like, gnome-splashscreen-manager is a nice frontend to modify the grub splashscreen. Just install this with aptitude or synaptic.

9. GDM

Similarly, you can change the gdm image that comes up when you log in. Again choose alternatives you like. You can run 'gdm-setup' to change the image.

10. Firefox - themes and add-ons

Finally, to get to the magic number of 10 - install a theme and add-ons for firefox. Again, you can choose the theme to match the system theme and the wallpaper. The add-ons that I find most useful are 'Download statusbar', 'Faviconize tab', 'Image zoom', 'Noscript' and 'tabmixplus'.

April 15, 2007

How to install Virtualbox in Ubuntu Feisty

04 October 2008
This post is considerably outdated. Virtualbox 2.0 and Ubuntu Intrepid (8.10) have been released. So while some of the steps might still be valid, it would be wiser to refer to the current documentation.


Virtualbox is a new opensource virtualization solution made by Innotek. It has all the features that vmware offers and is a smaller download and easier to install. It therefore appears poised to replace vmware as the main virtualization software in Ubuntu. This is a brief howto for installing Virtualbox on Ubuntu Feisty. It is based on two installations I did recently. By providing the relevant instructions on one page, I hope to make it easier for others to follow. Any feedback about problems or suggestions to improve the tutorial are welcome. Here we go.

First install the dependencies that are not present in Feisty by default.

sudo aptitude install libqt3-mt libxalan110 libxerces27

Now download the debian package for edgy and install it.

*UPDATE: A debian package is now available for Feisty. Replace 'edgy' with 'feisty' in the next two lines to use it.

cd /tmp
wget http://www.virtualbox.org/download/1.3.8/VirtualBox_1.3.8_Ubuntu_edgy_i386.deb
sudo dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

You will have to accept the PUEL license and select "yes" when asked if the vboxdrv kernel module should be compiled. The kernel should be created successfully now. A group called vboxusers is created and you have to add yourself as a user of this group.

sudo adduser $USER vboxusers

If you want to access usb devices from the virtual machine, follow these steps. You can omit them and directly reboot if you are not going to be using usb devices from the guest.

sudo addgroup usbfs
sudo adduser $USER usbfs

** For the next step you have to know the id for the usbfs group that you have created. To do this try

cat /etc/group | grep usbfs

and look for the number after "usbfs:x:". In the next command, replace 1002 in the next command with this number**
echo "none /proc/bus/usb usbfs devgid=1002,devmode=664 0 0" | sudo tee -a /etc/fstab

Now reboot to allow the new group and user permissions to be updated.

start VirtualBox

VirtualBox &

Once you create a virtual machine and install an OS on it, you may want to set up a shared folder between the host and the guest. Suppose the name of the virtual machine is "winXP" and the folder you wish to share is at /home/user/shared. Power off the virtual machine and then do this :

VBoxManage sharedfolder add winXP -name "sharedfolder" -hostpath "/home/user/shared"

Now you can mount the shared folder within the guest. For a windows guest you would boot up and then in the terminal type

net use G: \\vboxsvr\sharedfolder

Now you should be able to access the shared folder from within the guest and the host systems. To access a USB device from the guest, select the device in the USB controller in VirtualBox and enable it. Remember that the device may not be accessible to the guest if it is mounted in the host.


Edit (21 April 2007) - Corrected command for appending line to fstab. Thanks to ebash from Ubuntu forums for pointing out the right way to do it.


Powered by ScribeFire.

April 9, 2007

Hide and show panels with a keyboard shortcut in Ubuntu


I usually keep the default top and bottom panels in gnome, but especially on my laptop, place great value on the screen estate that I can get by hiding them. The usual way I do this is by using autohide and then setting the hidden size to 0 or 1. Mostly I dont need the panels because I can launch applications with Alt-F2 or with shortcuts. But when I need to access something from the panel, I have to mouse over the hidden panel to bring it up. The other minor irritation is that the panel may spring out when you dont really want it if your mouse wanders close to it.

In a recent post in the Ubuntu forums, it was suggested that it would be nice to set up a keyboard shortcut to show the panels when needed. Since it is easy to access the gconf-editor from the command line, it was easy to write a script to toggle the hide status of the panel. Here is a short how-to if someone is interested.

Copy this script, paste it a file and save it as toggle.sh. A good way to place it will be /home/username/.toggle.sh.

#!/bin/bash

#find the current state of the panels
state=`gconftool-2 --get "/apps/panel/toplevels/top_panel_screen0/auto_hide"`

#if autohide on, turn it off
if [ $state = "true" ]; then
gconftool-2 --set "/apps/panel/toplevels/top_panel_screen0/unhide_delay" --type integer "0"
gconftool-2 --set "/apps/panel/toplevels/top_panel_screen0/auto_hide" --type bool "false"
gconftool-2 --set "/apps/panel/toplevels/bottom_panel_screen0/unhide_delay" --type integer "0"
gconftool-2 --set "/apps/panel/toplevels/bottom_panel_screen0/auto_hide" --type bool "false"
fi

#if autohide off, turn it on
if [ $state = "false" ]; then
gconftool-2 --set "/apps/panel/toplevels/top_panel_screen0/unhide_delay" --type integer "100000"
gconftool-2 --set "/apps/panel/toplevels/top_panel_screen0/auto_hide" --type bool "true"
gconftool-2 --set "/apps/panel/toplevels/bottom_panel_screen0/unhide_delay" --type integer "100000"
gconftool-2 --set "/apps/panel/toplevels/bottom_panel_screen0/auto_hide" --type bool "true"
fi


Make the script executable:

chmod +x ~/.toggle.sh


Open gconf-editor and under /apps/metacity/keybinding_commands, change the value of command_1 (or any other unused command) to /home/username/.toggle.sh.

Then under /apps/metacity/global_keybindings, change the value of run_command_1 (if you used command_1 for the script) to controlF12 or any other key combination that you want. There, you are done! Now pressing the key combination will toggle the panels to hide or show. I have tested this with metacity and beryl on gnome and it works perfectly.

Edit: 10 April 2007 - Thanks to dzv (in the Ubuntu forums) for comments and the suggestion to change the unhide delay so that the panel stays hidden.





Powered by ScribeFire.