Friday, 27 April 2012

Using multiple keys for github

Recently, I was working from my office laptop. I had set up ssh keys for Github on that system. However, when I had to work from my personal system, I realized that I don't have those ssh keys with me on this system. Also, the ssh keys on the current system were used for another purpose. So, I decided to have multiple keys on Github as well as on my system. I created my new keys with the following command:

ssh-keygen -t <rsa/dsa as per your choice> -f <new private key file like ~/.ssh/id_dsa.github> -C "comment"

This created a new key pair for me. Now, I had to configure ssh to use this key for github. So, I added the following lines to ~/.ssh/config file.

Host github.com
IdentityFile ~/.ssh/id_dsa.github
User git


Now, I had to add this new key to my ssh keys on Github. I opened the new public key file (id_dsa.github.pub in the above case) and copied its contents to add a new key on Github. I tried ssh -vT git@github.com and verified that it was using the new key and I was able to access Github successfully.

OpenSSH_5.9p1, OpenSSL 1.0.0g 18 Jan 2012
debug1: Reading configuration data /home/me/.ssh/config
debug1: /home/me/.ssh/config line 9: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/me/.ssh/id_dsa.github type 1
debug1: identity file /home/me/.ssh/id_dsa.github-cert type -1

Monday, 16 April 2012

AlpsPS/2 ALPS DualPoint TouchPad on Arch linux

In my new Dell Latitude, there is an AlpsPS/2 ALPS DualPoint touchpad. When I installed Arch linux on it the touchpad worked fine for me. I do not use the touchpad button and prefer to tap on the touchpad for a click. This feature worked fine with the initial configuration. However, after a system update which included a kernel update too, tap did not work.

I had not gotten into details of the touchpad before this incident. When I found it was not a Synaptics touchpad, I got scared that I might not get a decent linux driver for it. Just about a month ago I was looking for a decent driver that supports Nvidia Optimus tecnology; but all my efforts were in vain.

As I started looking for a driver for my touchpad, I found out that the synaptics driver is not only for synaptics touchpads. So, I installed xf86-input-synaptics package. Tap for click started working as the default /etc/X11/xorg.conf.d/10-synaptics.conf has the configuration for tap.

        Option "TapButton1" "1"
        Option "TapButton2" "2"
        Option "TapButton3" "3"


Also, two finger scroll started working. I had no idea that my touchpad supports it. The freedesktop.org documentation however specifies a config for Alps touchpads. I read through synaptics configuration on Arch wiki to configure the touchpad to suit my usage. The Gentoo wiki also provides a number of configurations, in case you want to try things out. The AccelFactor value mentioned in these wikis turns out to be too slow for me. So, I increased its value. 

Tuesday, 3 April 2012

Customizing system-wide gem install

I hardly use gem documentation and mostly install with --no-ri and --no-rdoc options. So instead of typing these options each time I install a new gem, I decided to apply these by default. Adding the following to /etc/gemrc achieved it.

gem: --no-ri --no-rdoc

Saturday, 31 March 2012

When "justified" is not justified

While using Microsoft Office, "justified" alignment is not properly implemented.

Thursday, 29 March 2012

System-wide accessible gems

As I was configuring my system for my friend's rails project, I found that when I install gems are root, they are available only to the root user and system-wide. When I install something as root, I expect it to be accessible system-wide. So, I dug into the issue and found that it was happening so because /etc/gemrc was configured to install gems for root user only. Getting system-wide installation of gems was achieved by commenting out the following line in /etc/gemrc

gem: --user-install

Now, instead of getting installed in /root/.gem/ruby/1.9.1/gems/ gems were installed to /usr/lib/ruby/gems/1.9.1/gems/ and were available to all users. Previously installed gems had to be uninstalled and re-installed so that they were available to all users.

Wednesday, 28 March 2012

Boot message: Unable to register miscdev on minor = 130

On my new Arch linux installation I was getting a line saying "Unable to register miscdev on minor=130 (err=-16)". In /var/log/errors.log, I was getting the following lines:

Mar 28 19:37:16 localhost kernel: [13926.292770] watchdog: error registering /dev/watchdog (err=-16).
Mar 28 19:37:16 localhost kernel: [13926.292771] mei: unable to register watchdog device.


A comment on Archlinux forum clarified that it was caused because the kernel supports only one watchdog. The solution is two blacklist MEI driver. That can be done using the following line.

echo blacklist mei > /etc/modprobe.d/mei.conf

You read more about IMEI here.

Sunday, 25 March 2012

Reusing packages from one system in building a new one

While installing Arch linux on my new Dell Latitude, I wanted to reuse packages on my existing Arch installation on my old laptop. As soon as I was through with the initial install using the net install image, I put all packages from /var/cache/pacman/pkg to a folder called repo on a USB stick. From the command line I mounted the usb stick on my new installation to /mnt/usb.

mount -t vfat /dev/sdb1 /mnt/usb
 
Now, all I had to do was to tell pacman to look for packages in the repo folder in the USB stick. I achieved this by setting CacheDir variable in pacman.conf to /mnt/usb/repo.

#DBPath      = /var/lib/pacman/
CacheDir    = /mnt/usb/repo/
LogFile     = /var/log/pacman.log


Actually, you can also try creating a local repo. It is there in the pacman manual pages. However, this seemed easier and faster to me and worked on first go.

After this setting, when I tried installing Xorg it told me that there is no extra.db and community.db; but I had those repos enabled and therefore it failed. I realized only core.db existed in my system and I had not synced the repo databases even once. I could have achieved that by pacman -Syu; but for my internet connection to work I needed to install wvdial and usb_modeswitch as I use a 3G USB internet card. So, I just copied extra.db and community.db from my old system into the new one and things worked fine.

Wednesday, 22 February 2012

Partial upgrade messed my system

Although I am aware of the potential risks of a partial upgrade, due to slow connection I thought I will go ahead with it. I was feeling confident that if things mess up I will be able to handle them. I had installed grep and udev without installing upgraded versions of kmod and pcre.



When I restarted [may be I should not have done that], during boot only the system started throwing errors about grep being unable to find libpcre and kmod not being found. I was able to boot into kdm but my keyboard and touchpad were not working. The root of the problem is still unknown; but I thought of trying installing pcre and kmod. However, to install I had to get to the command prompt at least.

So, I created a Gentoo boot disk using my flash drive and chrooted into my system. I connect using 3G USB dongle and from the chrooted environment the mode was not switched. So, I had to get packages downloaded separately and then install them through the chrooted environment. I should have installed the same version as in my system's pacman database; but I installed the latest one. With that I fixed the boot problems and my keyboard was working but it broke a few other things and kdm did not work any more. When I booted now, it took me to the command line. I reinstalled kdebase-workspace; yet the issue persisted. To make things worse, I found that emacs and irssi were also not working. So, I couldn't get to any IRC channel to ask for help. The only good thing that happened was I was able to get to a command line. So, I did not have to download packages elsewhere and install it.

 When I connected to the internet from my system and ran pacman -Syu it showed me downloads of around 650 mb. I found that many of those packages like libreoffice and 32-bit libs are not absolute necessity from a repair perspective. So, I decided to download a small subset to get my KDE back. I downloaded

  • avahi 
  • ca-certificates 
  • compositeproto 
  • cpio 
  • kdelibs 
  • kactivities 
  • libxrandr 
  • xdg-utils 
  • qt  
  • oxygen-icons 
  • kdepimlibs 
  • kdepim-runtime 
  • libxml2 
  • libqalculate  
  • libxcomposite 
  • libmysqlclient 
  • libvorbis 
  • libshout 
  • sdl_image 
  • zvbi 
  • vlc
 The list above is a subset of the packages pacman wanted to download for the system upgrade; but at the same time they also form a superset of the packages I believed could cause my KDM issues.This solved my problem and now I am blogging from my revived linux system.


Caution:
Experiments like these should not be undertaken unless
1. You are crazy like me.
2. You have a backup system and have your /home folder on a separate partition so that even if your system can't be fixed, you can install a fresh new system without losing data. [You can also save configurations in /etc.]
3. You have sufficient bandwidth.

Sunday, 5 February 2012

Cleaning KDE "Open with" list

I had installed MPlayer and uninstalled it long back. However, since then KDE always showed it in the "Open With" list for media files. Just to make sure it was not installed on my system I ran

pacman -Rcus mplayer

as root. Obviously the target was not found. After some chatting on #gentoo, I resolved the issue by deleting mplayer.desktop file from ~/.local/share/applications. Along with that, I cleaned some other stale applications from that directory.