Skype for Linux doesn’t ring: How to fix it

I’ve been really annoyed at Skype for this weird behavior: When I was on a call, the audio worked fine. But when someone was calling me, I only got the small notification window but no ringing sound.

I couldn’t figure this out for a long time, but now I found a solution: Open the system-wide sound settings and unmute alerts/notification sounds. Now, you should get a ringing tone whenever somebody calls you.

This fixes one problem and creates a second one which I will fix below, but let me first give you some info on the origin of this behavior. When running on a system that uses PulseAudio, Skype doesn’t use the regular audio output methods for playing its notification sounds but plays the sounds through the audio notification channel. If you don’t like to hear system notifications such as log-in sounds et cetera and thus disable this channel in the audio settings, Skype doesn’t ring…

Fixing the original problem leaves us with a new one: If you’re like me and you don’t really appreciate the system notification sounds, you can configure the system to not play notification sounds without muting the notification channel. With Gnome 3, open the dconf-editor tool and go to org -> gnome -> desktop -> sound. Uncheck event-sounds. Done!

Now, you should hear a ringing sound if someone calls you, but no annoying system notification sounds.

Refresh your SSD

Just like yourself, your SSD likes to have some rest from time to time to perform well on the long run. After some use, it gets slower and slower if it isn’t told which parts of it are still in use and which hold only garbage. This is due to the internal workings of the disk that I won’t go into here. If you’re interested in the gory details, please head on to Wikipedia: TRIM.

On Ubuntu, you can refresh your SSD with the fstrim command:

sudo fstrim -v /

This applies the optimizations to the root filesystem. If there are other filesystems that are mounted from an SSD, replace the single slash by the path to the mount point(s).

On my laptop, which is equipped with a 250 GB Samsung SSD 840 drive, you get the following results:

New SSD

Measurements taken directly after the initial OS installation on the new drive. The performance measurements were taken using the Gnome disk utility called “palimpsest” (sudo apt-get install gnome-disk-utility).

Used SSD

Measurements after 8 months of use.

SSD after trimming

Measurements after running fstrim.

After trimming, the SSD is not as fast as when it was new, but the average reading transfer rate improved by 15%.

Adding Playlists to Sansa Fuze using Rhythmbox

I use a Sansa Fuze music player that I’m quite happy with. It supports the USB Mass Storage protocol and thus can be used (and filled with music) just as any other USB flash drive. This means it is fully supported by all operating systems since it doesn’t need proprietary software running on a PC.

However there’s one thing that tools such as Windows Media Player or iTunes are capable of that might be quite useful: managing playlists on the computer and transferring them to the media player. I recently accidentally found out that this can be achieved with Rhytmbox, the music player that comes with Ubuntu and other GNU/Linux distributions:

  • connect player to computer (tested with Sansa Vuze, MSC mode)
  • fire up Rhythmbox
  • left column: under “Devices”, right click on your player
  • choose “New Playlist”
  • enter a name for the playlist
  • drag music files from the player onto the newly created playlist
  • safely remove the player when done

Effect: A new .m3u file is created at the root directory of the player, containing the playlist. It now appears in the list of playlists of your player (Music -> Playlists).

Converting from or to Unix timestamps

Unix timestamps (sometimes also called epoch) encode date and time in a single number, counting the seconds since January 1, 1970, 00:00 (UTC). The format is used througout a lot of software, but how can it be decoded to our common format?

Naturally, there are web services like Epoch Converter, but how to decode it using the common GNU command line tools? Here’s a short summary: Continue reading

Recovery of passwords from Draytek Vigor routers

Recently, I needed to recover a DSL password that only persisted in an oldĀ  router (Draytek Vigor 2500/We). Since the web interface only shows the username, I tried the backup feature that dumps the entire configuration to a file that you can download. Unfortunately, this data comes in an encrypted form… which makes an excellent exercise for a student of computer science. Continue reading

Remove items from Ubuntu’s indicator applet

Ubuntu 10.04 (Lucid Lynx) features new panel applets called “indicator applets”. If you want to get rid of some of them, they can be removed by removing the corresponding package(s) using your favourite tool (Synaptic, aptitude, apt-get, …):

  • indicator-me provides the menu with your avatar and your availability status
  • indicator-messages provides the menu for email/Evolution, social networks/Gwibber etc.
  • indicator-session provides the menu with the shutdown/logout button (if uninstalled, this functionality will be provided by the “System” menu)
  • indicator-sound provides the sound/audio settings menu

For more information, have a look at the Launchpad page and the Ubuntu Wiki page for the indicator applets.

Automated MySQL backup for shared webhosting

What to do if you want to use mysqldump in a shared hosting environment without being able to access the shell (SSH…)? Use a Perl CGI script:

#!/usr/bin/perl -w

use strict;
use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/plain\nContent-disposition: attachment; filename=\"db_backup.sql\"\n\n";
print qx(mysqldump -uUSERNAME -pPASSWORD DATABASE 2>&1);

Replace USERNAME, PASSWORD and DATABASE with the configuration data for your database and drop the script into your cgi-bin directory. Don’t forget to make it executable (chmod +x) and apply some form of access restrictions! Here’s an Apache .htaccess file which serves well for this purpose: Continue reading

ionice: Controlling the Linux I/O scheduler

Linux is quite good at scheduling the CPU time of running programs: Even when a process is running which constantly uses up all processor power, it is still possible to use another (interactive) program nearly as fast as on an idle system. But if a process is doing heavy I/O operations (i.e. backup software), the response times of interactive programs can be heavily increased.

A possible solution for this problem is the command line tool ionice which can be used to control the I/O scheduler. For example, if a backup tool is to be run, running

ionice -c3 COMMAND

will execute COMMAND with the scheduling class “idle” (will only run when no other process needs I/O).

Have a look at the man page for more information.

Clean MySQL backup using mysqldump

If you need to configure a backup of a MySQL database server, you shouldn’t simply copy it’s database files from /var/lib/mysql since they might be inconsistent (due to simultaneous changes). mysqldump is a safe choice for this task. I wrote a simple script for Debian that uses the pre-configured “debian-sys-maint” account and compresses the output:

#!/bin/bash

BACKUP_FILENAME=/var/backups/mysql/mysql.dump
mysqldump --defaults-extra-file=/etc/mysql/debian.cnf --all-databases --lock-all-tables --result-file=$BACKUP_FILENAME
gzip $BACKUP_FILENAME

Please take care that you need to create the output directory (/var/backups/mysql in the above example) first!

If you need more than one revision of the backup, you might want to use “date” to format the filename. Since I run a normal (rdiff-)backup of a big part of the server afterwards, I don’t need this.

Strato V-Server/Virtuozzo: Memory usage

This blog runs on a virtual server offered by Strato. They use Virtuozzo for virtualization which has a drawback: If you use top, free or other tools to show the current memory usage, not only your “slice” of the machine but more (all?) of the memory is measured. This doesn’t help much if you try to find out how much of it your own processes use, which is important as you can use only a certain part of the machine’s memory.

I could not find a better way to circumvent this but to sum up the numbers of every single process, listed by ps. Here’s a little shell script that does the job:

#!/bin/bash
echo -ne "Allocated virtual memory: "
ps auxh | sed 's/ \+/ /g' | cut -d' ' -f 5 | \
php -r '$c=0; while($line=fgets(STDIN)) $c+=intval($line); echo "$c";'
echo " kB"

echo -ne "Used physical memory: "
ps auxh | sed 's/ \+/ /g' | cut -d' ' -f 6 | \
php -r '$c=0; while($line=fgets(STDIN)) $c+=intval($line); echo "$c";'
echo " kB"

You need to have the command line version of PHP 5 installed to run this script. The corresponding Debian package is called php5-cli.