Monthly Archives: March 2008

Back from California

Published / by mario / 4 Comments on Back from California

As my mate Berto has already commented on his blog, we’re back from California after attending to the Mobile Rules! ’08 awards ceremony, and I’d like to say that we had a great time there, even though we didn’t win the prize… but being a finalist was already a very nice kind of price, don’t you think?

Mario at the San Jose City Hall Rotunda

Moreover, maybe we didn’t get the acknowledgement of being the “Mobile Ruler ’08” under the Multimedia category, but we met a lot of people indeed, and we enjoyed a lot of the event, which was nicely arranged to allow all the participants to meet each other and to have a good dinner at the San Jose City Hall Rotunda (look at the picture to see me in front of the beautiful San Jose City Hall).

So, maybe the next time we could have more luck with Vagalume, but now it’s the present and, as Berto said in his last post, it’s time to get back to work and keep on getting Vagalume even better with some nice improvements we already have in mind and others that I’m sure are still to come.

PS: This was the first time I’ve been to the US West Coast, and I have to say that I loved California… such a lovely place, such a lovely place. I hope I could go back soon :-)

Automatically mounting LUKS encrypted partitions with pam_mount

Published / by mario / 2 Comments on Automatically mounting LUKS encrypted partitions with pam_mount

Yesterday I’ve got my new Thinkpad T61 laptop and I had to spend some time installing a GNU/Linux distribution on it, so doing all those related tasks that are a must: partitioning, installing linux, installing emacs… and besides to all those tasks a very important one: encrypting some disk partitions.

To do that, I just followed the instructions that Berto had posted some months ago in his blog, either for encrypting full regular partitions with LUKS as for encrypting temporary filesystems, say, /tmp and swap partitions.

So, once I got those tasks done (quite easy if you follow the steps Berto‘s explained in his posts), only one more task was still left: to make those LUKS encrypted partitions to be automatically mounted when logging into the system with my username.

The idea behind this is just that you use the same password both for logging into the system with your username as for decrypting those LUKS partitions before mounting them. To do this, I’ve just used the pam_mount module so it took care of using the user password to automatically mount those partitions right after the user gets identified in the system. And of course, that pam module also takes care of unmounting those partitions right after you log out and no open sessions with your username remains active.

So, I’d like to share with you a recipe to get all this stuff easily working:

  1. Follow the steps in Berto‘s post to encrypt a full partition with LUKS.
  2. When you add a LUKS password for that encrypted partition, use the same password you use to log into your system with your username. LUKS allows you to add more than one password for your partitions, so at least one of them should be the same than your user password.
  3. Install the pam_mount module:
  4. sudo apt-get install libpam-mount

  5. Edit your /etc/security/pam_mount.conf file and append there a line like the following one (one for each encrypted partition you’d like to automatically mount):
  6. volume USERNAME crypt – DEV_FILE MOUNTPOINT – – –

    For example, to mount a encripted partition present in /dev/sda6 under a /encrypted folder whenever the user ‘mario’ logs into the system, you should append the following line:

    volume mario crypt – /dev/sda6 /encrypted – – –

  7. Edit /etc/pam.d/login so it looks as follows at the end of the file
  8. […]
    # Standard Un*x account and session
    @include common-account
    @include common-session
    @include common-pammount
    @include common-password

  9. And, if you use GDM (as me), you should also edit /etc/pam.d/gdm in a similar way:
  10. […]
    @include common-account
    session required pam_limits.so
    @include common-session
    @include common-pammount
    session optional pam_gnome_keyring.so auto_start
    @include common-password

  11. At last make sure that you have removed (or commented) some lines in /etc/fstab and /etc/crypttab, in order to avoid both asking for the LUKS password at startup (because the crypttab file) as trying to mount a not decrypted partition (because of fstab). For instance, this is how those files would look for the example given:
      • /etc/crypttab:

        #encrypted /dev/sda6 none luks,check=ext2
        cswap /dev/sda8 /dev/urandom swap
        ctmp /dev/sda9 /dev/urandom tmp

      • /etc/fstab:

        […]
        #/dev/mapper/encrypted /encrypted ext3 defaults 0 2
        […]

    Once you have followed all those steps, you should be able to reboot and see how the encrypted partition gets mounted right after you login in your system, either by using GDM as by using a text-mode terminal.

    And that’s all. I hope you find it useful.

My sloppy, dirty, ugly… but (maybe) useful script for the Vagalume D-Bus interface

Published / by mario / 4 Comments on My sloppy, dirty, ugly… but (maybe) useful script for the Vagalume D-Bus interface

Vagalume playing on my hi-fi system

Today, while doing the houseworks, I plugged the N800 to the AUX input of my mini hi-fi system (see the photo), in order to listen my online radios with Vagalume while I was doing several tasks all around my flat.

Then, after finishing those tasks, I sat in front of my laptop and I began to do some tipical tasks: read mail, surf the internet, talk with some friends through IM… while Vagalume kept playing music through my hi-fi system in the living room. And then, while I was thinking how nice is to listen Last.fm through a couple of good speakers, I suddenly found out that I should face the big dilemma:

  • Sometimes I’d like to change the radio station which is being played in Vagalume, or just to Skip some songs.
  • I love to listen music through the hi-fi system, even when I’m not in the living room (likely, my neighbours love this too), so stopping Vagalume from running on the N800 and running it in my laptop would not be an option.
  • The N800 is in another room, so I should leave the chair if I want to interact with Vagalume.

Maybe, you could be thinking of me as a very lazy person, but first just think of yourself in a similar situation and maybe you could understand what I’m talking about :-)

So, this stupid situation was the perfect excuse for me to write an small, sloppy and ugly script that, at least, works pretty well on the N800, and which allows to easily manage some of the functions of Vagalume that are available via its D-Bus interface:

  • Run / Close Vagalume application (via D-Bus methods).
  • Play / Skip / Stop songs.
  • Setting the current radio to:
    • A ‘global tags’ radio, specifiying tags separated by spaces.
    • A ‘similar artists’ radio, specifying an artist name.
    • A ‘last.fm group’ radio, specifying the name of the group.
    • An ‘user’s loved / neighbours / personal / playlist’ radio, specifying the username.
    • A custom radio, just specifying a valid lastfm URL.

So, now I’m able to remotely manage Vagalume in the N800 in an easy way, while it’s playing music in the living room and I am, say, in my bedroom working on my laptop, just by ‘implementing’ the following recipe:

  • A ssh server (available through the maemo-extras repository, IIRC) running on the N800.
  • My sloppy script installed on the N800 as well.
  • A X terminal running on my laptop, to remotely control Vagalume.
  • A bottle of a good beer near the laptop, to minimize the need of leaving the chair without a good reason (not mandatory ;-)).

For instance, this is how I’d skip a song and then I’d set a hard rock radio:

$ vagalume-dbus skip
$ vagalume-dbus tag “hard rock”

So, here you are the script just in case you’re so lazy as me and you’d like to use it too: vagalume-dbus script.

Please notice that this is not an official script of Vagalume, at least not yet :-). I’ll talk to Berto to see if it would be or not a good idea to bundle it with the next release of Vagalume. Perhaps it could be useful after all :-).

What do you think?