Modify DNS server address on Ubuntu

My ISPs DNS server responds slowly. So I was trying to modify /etc/resolv.conf on Ubuntu 12.04 with Google’s DNS server IPs (8.8.8.8, 8.8.4.4) as usual. To make the change permanent I ran chattr +i on the file but it failed. I found that in Ubuntu 12.04 it is a symbolic link to the following file:

/run/resolvconf/resolv.conf and /run is mounted as tmpfs in RAM.

Simple solution to add the DNS IPs using the GUI:

NetworkManager (in taskbar)  Edit Connections…  Select used connection  Edit…  IPv4 Settings  Method: Automatic (DHCP) addresses only [if your conneciton is DHCP based, otherwise select Manual]  Add the IPs (separated by comma) in DNS servers: field.

Quick tip: If you are using ADSL modem, you can set the Primary and Secondary DNS in the modem. Most modems support it nowadays.

Sync videos to iPod on Ubuntu

ipod

The only gadget which I had to render kaput years ago when I decided to move on solely with Ubuntu was my 120 GB iPod Classic. I have realized now the iPod was a bad investment 😉 but I couldn’t give it away either. At that time I did not find a reliable way to transfer my files from my laptop to iPod on Ubuntu or for that matter, Linux. After some months I searched and found that I could transfer only audio files but not video. It was not until recently I tried once again to find a solution to transfer videos when my wife asked me to load some movies in the iPod for her to watch from time to time. Luckily, I have found a solution now.

I tried with Banshee on Ubuntu 12.04 and I could transfer videos to the iPod. As I was afraid of accidentally deleting the already existing videos on the device I synced only the Unwatched videos from my library and they were synced fine. I could play them from the video playlist and could delete them from the device as well. Though I could not find the already existing videos in the iPod from Banshee I could browse and play them in the iPod just fine.

As far as I remember the iTunes installer was around a 80 MB garbage when I last used it on Windows. Thanks to Banshee I have a much simpler solution now which does let me access the iPod as a mounted storage device in parallel!

Update: I could sync a 1st gen 512MB ipod shuffle using Banshee as well. The additional step required was to fix the playlists using rebuild_db.py script that comes with rebuild_db package. I had to run the following as root:

# mkdir t
# mount /dev/sdb1 t //sdb1 is my ipod. being root is necessary
# cp rebuild_db.py t/
# chmod +x t/rebuild_db.py //make sure sdb1 is not mounted by any user
# t/rebuild_db.py

That’s it!

Disable extra ttys on Ubuntu

By default 6 consoles (ttys) are spawned at boot in Linux systems. All of them are not needed at any point of time. To save memory reduce the number of ttys. I keep only one tty enabled. On Ubuntu 12.04 (Precise Pangolin) to 13.04 (Raring Ringtail) do the following:

# sudo mv /etc/init/tty2.conf{,.bak}

Do the same for tty3 to tty6.
Oh yes! As Ubuntu 12.04 has disabled GUI root login (at least in Beta) I am learning to use sudo. :'(

Ubuntu 12.04 Beta is here!

Ubuntu 12.04 (Precise Pangolin) Beta is out! Gave it a trial run today from USB. Boot-up is faster and read that there are major enhancements in power management. Still Unity turns me off but liked the new HUD feature. Software center loads fast. May upgrade to this version if there is an way to get back to good old Gnome 2 environment on it. Compiz settings manager crashed twice when I tried to change the settings and the desktop because unusable once when the windows lost their menu bars. Rhythmbox integration is great but I don’t believe it can ever reach the quality of MPlayer/SMPlayer which come with numerous options to enhance every aspect multimedia experience. Kernel version in Beta is 3.2.7.

Update: Installed 12.04 Beta after some more testing. Working fine. Performance is good. Still minor glitches are there but hoping to get them fixed soon.

Did I mention that Firefox 11 and LibreOffice are blazing fast on 12.04? Nautilus did not improve so I started using Marlin, the successor of nautilus-elementary.

I have removed Empathy fully and installed Pidgin as I don’t do voice/video chat. The new Pidgin tray icon blinks on incoming messages, which was missing previously and is awesome. You won’t miss another friend pinging you.

Contrary to my previous opinion about Unity, after using it for 1 week I have got addicted to it, specially after I discovered what it has done with the “Windows” key!

How to remove PulseAudio on Ubuntu 10.10

I am still using Ubuntu 10.10 (Maverick Meerkat) as Unity/Gnome3 sucks. I was looking for a way to remove the userspace pulseaudio from Maverick.

To remove pulseaudio completely:

$ sudo apt-get purge libcanberra-pulse pulseaudio pulseaudio-esound-compat
pulseaudio-module-bluetooth pulseaudio-module-gconf pulseaudio-module-udev
pulseaudio-module-x11 gstreamer0.10-pulseaudio pulseaudio-utils pavucontrol

This will remove pulseaudio from your system and it will also remove your volume applet on your top panel. To get back your audible world:

$ sudo add-apt-repository ppa:dtl131/ppa
$ sudo apt-get update
$ sudo apt-get install gnome-applets gnome-media gnome-settings-daemon libcanberra0

Restart Ubuntu.

Placing Firefox cache in RAM on Ubuntu

firefoxTo enhance Firefox performance on Ubuntu (or Linux), we can place the cache in RAM. This is especially helpful if you are used to hours of continuous browsing sessions.

I have mounted some directories with temporary files using the tmpfs, which is RAM based filesystem. These files will be discarded at reboot, which also helps to keep my system clean.

The entries in /etc/fstab are like:

tmpfs /tmp tmpfs noexec,defaults,noatime,nodiratime 0 0
tmpfs /var/log tmpfs noexec,defaults,noatime,nodiratime 0 0

Add the following line at the end of /etc/sysctl.conf file:

vm.swappiness = 0

Run:

# sudo sysctl -p

In Firefox, go to about:config page and search for the following entry:

browser.cache.disk.parent_directory

If it is not there, right click and create a new String value and name it as

browser.cache.disk.parent_directory

Set the value to /tmp (or tmpfs directory of your choice). Restart Firefox.

Audio Convert: convert audio on Linux

musicWeeks back I faced a problem with playing my WMA files on Android. Due to DRM related issues Android does not support WMA on the fly. The only app I could find to play them was PowerAmp. But I was reluctant to waste some MBs (~ 6MB) on my phone just to play WMA files. While searching for a good converter on Ubuntu I came across Audio Convert, a script which converts audio files using a GUI. I have tried converting only WMA to MP3 till now and it works like a charm. Uses lame in the background to convert to MP3. By default it converted at minimum 128 kbps bitrate which I tweaked to 64 kbps (modify the audio-convert file to add kbps as “quality” to pass to the lame converter. Open-source goodness!). Can be installed as a nautilus extension. Can convert a single file as well as a whole directory of audio files with the same options when used with a wildcard like “*” from the terminal. A great solution for my problem.

Audio Convert can handle convert wav, ogg, mp3, mpc, flac, ape or wma files into wav, ogg, mp3, mpc, flac or ape files.

Webpage: Audio Convert

How to set up Compose Key on Ubuntu

Ever tried typing the characters like: ™ or ® or ½? Can be done very easily in Ubuntu using the compose key. Check this link to find out how. A list of supported sequences on Linux can be found here.

Compose key covers a subset of the Unicode characters you can type. For more Unicode characters, check this link. List of some common Unicode symbols.

Update: To enable compose key in Ubuntu 12.04 (Precise), 12.10 (Quantal) and 13.04 (Raring) go to System Settings ▸ Keyboard ▸ Layout Settings (at bottom left) ▸ Options ▸ Compose key position. As I seldom use the menu key, I am using it as my compose key now.

Random Ubuntu tips

ubuntu_logo_81x81Here’s a list of common tweaks I apply on Ubuntu to handle brightness, save power, disable ipv6 etc.

  1. To save power add the following in a script and add at startup:
    $ sudo echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    $ sudo echo 5 > /proc/sys/vm/laptop_mode
    $ sudo hal-disable-polling --device /dev/scd0
    $ gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true
    $ xmodmap -e "clear Lock"
  2. To set brightness in Ubuntu at login:
    $ sudo setpci -s 00:02.0 F4.B=50
  3. To enable brightness key in Acer laptops add in GRUB params*:
    acpi_osi=Linux
  4. To enable Touchpad lock in Acer laptops add in GRUB params*:
    i8042.nomux
  5. To disable ipv6 at boot:
    ipv6.disable=1
  6. To re-enable Touchpad after sleep in laptop:
    $ gconftool-2 --set --type boolean \
    /desktop/gnome/peripherals/touchpad/touchpad_enabled true

* To modify GRUB boot params, open the file /etc/default/grub as sudoer and change the list of params in the line starting with

GRUB_CMDLINE_LINUX_DEFAULT