Ubuntu Technical

Ubuntu technical problems and solutions reference, a modern cookbook.

Monthly Archives: November 2011

Grub 2/Burg bootloader customization tips

So, if you are like me, having multiple operating systems running, you may wish to customize the grub bootloader.

Note: All the information below are also valid for Burg customisation

Places of interest for Grub:
This is the main initialization file which is loaded. All the parameters you ever need can be set here.

This is automatically generated by grub-mkconfig.

Here are the files which load up the partitions when the command

sudo update-grub

is called.
This files need to be changed in order to achieve the desired loading priority and custom naming.

Form the file /boot/grub/grub.cfg you can copy all the menuentrys and paste them into the file: /etc/grub.d/40_custom.
A menuenty looks like this:

menuentry 'Ubuntu, 11.10' --class ubuntu --class gnu-linux --class gnu --class os {
	set gfxpayload=$linux_gfx_mode
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd1,msdos4)'
	search --no-floppy --fs-uuid --set=root #some code here
	linux	/boot/vmlinuz-3.0.0-12-generic root=UUID=#some code here
	initrd	/boot/initrd.img-3.0.0-12-generic

The file 40_custom contains the custom entries which you want. In order for grub to take the changes into consideration during the update, the file needs to be made executable. An then grub updated.

sudo chmod +x /etc/grub.d/40_custom
sudo update-grub

Enjoy 😉

Flattr this


Install ATI official drivers in Ubuntu

I find myself pretty often installing or re-installing my official ATI drivers for my video card. So here is a safe guide which will guide you through all the steps.

For a 64 bit system, install this first:

sudo apt-get install ia32-libs

Run each of these, one at the time, if getting any faults ignore it.

sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev*

Remove your xorg.conf file

sudo rm /etc/X11/xorg.conf

Re-install xorg

sudo apt-get install --reinstall libgl1-mesa-glx:i386 libgl1-mesa-glx:amd64 libgl1-mesa-dri:i386 libgl1-mesa-dri:amd64 xserver-xorg-core

Configure xorg

sudo dpkg-reconfigure xserver-xorg


sudo reboot

After the reboot all the fglrx packages will be gone, you will be using default ones.

Download the newest ATI driver (current version is 12.1)

wget http://www2.ati.com/drivers/linux/amd-driver-installer-12-1-x86.x86_64.run

Once downloaded go to the file location and set it to run as executable

cd /path_of_the_file
chmod 755 amd-driver-installer-12-1-x86.x86_64.run

Use these steps to install

sh ./amd-driver-installer-12-1-x86.x86_64.run --buildpkg Ubuntu/oneiric
sudo dpkg -i fglrx*.deb

Once the driver is installed you need to start up a new xorg.conf file with this command

sudo aticonfig --initial -f


sudo reboot

Flattr this

Grep is grepping itself

I sometimes need to stop an application with the kill command, due to it being frozen, or simply being buggy. The command to kill requires me to know the PID of the process.

ps aux | grep name-of-the-application

There will be at least 2 outputs: One with the application we want to kill, and the other one with the actual grep process we are running to find the PID in the first place:

pre      18775  1.2  0.0  12524  1972 pts/3    S    20:17   0:00 
pre      19137  0.0  0.0   9136  1068 pts/3    S+   20:17   0:00 grep --color=auto application-name

In order exclude grep from the output result I have found the following command

ps aux | grep application name | grep -v grep

Compliment of this answer

Flattr this

Ubuntu auto mount drives on login

I know there are a lot of people who are adding their drives in /etc/fstab. I personally don’t like that approach, because in Nautilus I will see 2 copies of the same drive. One mounted and the other unmounted and when it gets pressed I got an error saying that the drive is already mounted.
I prefer a solution where the drive gets mounted exactly as Nautilus does it, when the drive is mounted by simply pressing the unmounted drive.

First we need to find out where each drive is located, so that we know where each drive is located on the disk. Using the following command, we get the desired outcome:

ls /dev/disk/by-label -lah

The output look something like this:

lrwxrwxrwx 1 root root  10 2011-11-13 14:58 Storage -> ../../sda6

Assuming we need to auto mount the drive called Storage, we create it’s mounting point:

sudo mkdir /media/Storage

Now, a script needs to be created which mounts the drive:

vi ~/mountscript.sh
sudo mount /dev/sda6 /media/Storage

Need to make the script executable and then test it

sudo chmod +x mountscript.sh

You will notice that the script requires us to introduce the password. That’s not good when we are going to add this script to be run at start-up. So we need to exclude the 2 commands we are using (mount and the script we’ve just created) from sudo to ask us for the password.

sudo visudo

Add this line at the end replacing your user with the name of your own user:

your user   ALL=(ALL) NOPASSWD: ~/mountscript.sh, /bin/mount

Now both commands, mountscript.sh and mount are excluded from being prompted a password.

All you need to do is to add mountscript.sh to your start-up scripts and log-out and back in again.

Flattr this

Set custom width for Guake terminal

Because Guake is not yet Unity ready, the lower right corner of the terminal is not visible, hence you can not drag it to re-size the width.

Because there is no option for setting the width, the solution is to edit the python script, and manually set the desired init width. As soon as the lower right corner is visible, you can re-size with the mouse as much as you like.

Back-up /usr/lib/guake/guake.py

Because you need to be root to edit this script, run:

gksu gedit /usr/lib/guake/guake.py

Then, go line 817 (that’s valid for Ubuntu 11.10 at least), where you see the following code:

        screen = self.window.get_screen()
        height = self.client.get_int(KEY('/general/window_height'))
        width = 80
        halignment = self.client.get_int(KEY('/general/window_halignment'))

Here width=80 means the width of the starting window will be 80%. Set your desired window.

Thanks for the solution to Alin Andrei in his answer here

Flattr this

%d bloggers like this: