Setting up a website in home directory instead of /var/www

I have an Apache web server set up with cakephp as the framework on Ubuntu. But I got bugged very quickly at having to sudo to edit every file since they were placed in /var/www. Besides, it didn’t strike me as the right thing to do.

So, a quick google on “/var/www on ubuntu” took me to this page which turned out to be exactly what I was looking for. You can set it up so that http://localhost points to a folder in your home directory (/home/user/public_html). Now I can edit all files without sudo and it works with http://localhost.

Formatting SD Card on Ubuntu

This is a post just to remind me about the steps needed to format an SD Card on Ubuntu 9.10. I just got a class 4 8GB Kingston SD Card to replace the 1GB Stock SD Card on my G1. Since I’m using a rooted ROM (this one to be precise), I need an ext+fat+swap partition setup on my SD Card. I needed to format the new card identical to the old one and copy the old data onto the new card.

First of all, Ubuntu has a very weird delayed write mechanism that writes data to plugged in devices only when you eject or unmount them. So, if you write something to the card and pull it out, there’s a very good chance that it doesn’t show up. I haven’t seen this anywhere before, especially when using gentoo earlier.

GParted doesn’t display my card which is /dev/sdb. (Update in comments below) So, I decide to use the command line for this. There are three command line utilities for formatting, i.e. fdisk, cfdisk, sfdisk.

cfdisk gives you a UI so that you can select everything using arrow keys. But for some reason, when creating the partitions, it kept creating them as /dev/sdb1p1, /dev/sdb1p2 and /dev/sdb1p3 instead of /dev/sdb1, /dev/sdb2, /dev/sdb3. This kept the disk from showing up when listing the partition table with sudo fdisk -l. Didn’t really investigate why it was doing that. Checked out sfdisk, but the commands are different and looked like I’d need to learn a bit more before I could use it.

So, finally came down to fdisk which is quite handy once you get used to it. Important commands are ‘m’ which displays all the commands and ‘p’ which prints the partition table. So, first created the partitions using ‘n’ and setting them up as 7.4GB win95 fat32 (code ‘b’), 500MB ext3 (code ’83’), remaining 30+MB swap (code ’82’). The file system type can be set using ‘t’ and the codes obtained using ‘L’. The partition table is written using ‘w’.

Now, we need to format the different partitions with the corresponding file systems. This is done as follows:

  • Fat32: sudo mkfs.vfat /dev/sdb1
  • Ext3: sudo mke2fs -j /dev/sdb2 (the -j is required for ext3. Omit it for ext2)
  • Swap: sudo mkswap /dev/sdb3

Once this is done, you should immediately be able to see the different partitions in Nautilus.

Restore default settings in gnome on ubuntu

I got tired of the Mac theme for ubuntu and decided to get rid of it (also realised that Ubuntu needs to be unique and not look like a mac clone!). So after mucking around with the settings for a while and finding that it’s not easy to undo the damage, I started searching online. That’s when I came across this post and the idea is so simple that I wondered why I didn’t think about it to begin with. Take a look, it’ll reset your ubuntu gnome desktop to ‘factory settings’ :).


Update: As mentioned by A Y Siu in the comments, it would be safer to rename your folders using mv rather than delete them flat out.

Personal Diary options for Ubuntu

Looking for some software for a personal diary, I came across the following two utilities for Ubuntu:


It’s a pretty good diary option, but has a very major drawback – the diary entries are stored in plain xml on your hard disk and it doesn’t need a password to login. In fact, it doesn’t have a password option. If you want a diary just to take notes of your daily tasks or an alternative to an online blog (why?), you can go ahead with this.


This is exactly what I was looking for. It has password protection, keyboard shortcuts and easy to use interface. It even has a shortcut to insert the time in your diary post! It’s as if the developer was reading my mind. I would highly recommend this for anyone looking for a personal diary. Just remember that it needs gtkspell installed for python otherwise it won’t even start. If you’re using ubuntu, just search for it in synaptic and install the python libraries for gtkspell.


Alamanah (updated link)

Almanah looks good, but again the main negative for this one, just like thotkeeper,  is that it isn’t password protected. But apart from that it has a nice calendar and the ability to store the diary entries in encrypted format. One unique feature about Almanah is the ability to add a definition to some text. This definition can be used to link your text to a file, note or a URL. Pretty neat. Plus it’s available in synaptic, so you can give it a shot.

Update (23rd Sep, 2011):


Another personal diary option brought to my notice by Amit in the comments below. Unfortunately, I couldn’t get it to run on my Debian setup (yes, I’ve moved to a virtualbox Debian installation from a full blown Ubuntu install) and many of the dependencies seem to be in the unstable repo. But the screenshots look good and the features look great. It has been sometime since it was last updated (~10 months), but hopefully it will make it to stable some day.

Acer 4530 and Karmic Koala (Ubuntu 9.10)

Karmic has been out for a week now. Finally got over my insecurities and opted for the complete distro upgrade in the update manager and let it run overnight. By morning it was almost done, just cleaned up a few packages and fixed menu.lst and we were done.

But a reboot showed that it wasn’t to be a smooth transition. There were 2 kernels installed, 2.6.31-14 and 2.6.28-16. Trying out the first one caused my boot up screen to flicker and it didn’t even reach gdm. The flickr even prevented me from logging in. I think it was around the point when the console read “Starting consolefont and terminal yada yada” when it started doing it.

A search on the forums suggested that the problem might be because of the nvidia drivers. Which was exactly the problem. As per my earlier post, since I had installed Nvidia drivers manually, the updated didn’t install the drivers.

So, to fix it, I booted into the recovery kernel and dropped into a root terminal with networking. But for some reason the wifi wouldn’t work so I couldn’t connect to the net for synaptic to install the correct nvidia drivers (yes, they’re using 185.18.36 now, which is slightly later than the one I installed). But fortunately, I still had the drivers in my home directory. So kicked it off from the command line (no need to sudo since I was root).

But then the nvidia installer complains saying I need to be in init mode 3. So I quit the installer and ran telinit 3 (as mentioned in the installer itself!) and I was given a nice little login prompt.

Logged in and then ran the installer as sudo and waited for it to complete. Rebooted and everything works now.

My desktop works fine, and my MacOs ubuntu theme is intact.

PS: Initially, since I was having problems with kernel 2.6.31-14, I booted using 2.6.28-16 which actually worked and was able to log me in via gdm. But the touchpad wasn’t working. This seemed like a really strange issue. So I searched the forums for this and found this post. The touchpad started working after putting it in the options file and rebooting.

But with the new kernel, after fixing the flicker issue,  it was causing the mouse to be a bit sluggish and the scroll wasn’t working either. So I tried commenting it out and rebooting and the mouse is working fine now.

Ubuntu Jaunty: Error authenticating packages partial upgrade

Was getting this error when trying to do a partial upgrade in Ubuntu (I didn’t select ‘Partial Upgrade’, it brought it up on its own). Then checked in Synaptic->Repositories->Authentication. Apparently, jaunty was not authenticated.

A quick google brought me to this post. Looks like I’m not the only one with this problem. I followed the instructions left by one of the users and that fixed the authentication problem.

Then tried running the Partial upgrade again and it worked!