Archive

Archive for April, 2013

Force XMind to use Java 7

April 30, 2013 Leave a comment

XMind is the world’s coolest mind mapping software, the best way to brainstorm, the most efficient solution for saving your time, and powering your company.” (source)

Maybe it’s not the best but I like it :) And it has a free version, which is perfect for my needs.

Problem
I prefer to use the official Java version that I download directly from Oracle. However, I noticed that XMind tends to use some older versions of Java (OpenJDK, etc.). How to tell XMind which Java to use?

After starting XMind, you can verify which Java it uses. Go to: Help -> About XMind, and click on the button Installation Details. Finally choose the tab Configuration. Here find the line “-vm” and check its value in the next line. This is the virtual machine XMind has found.

Solution
Edit xmind.ini and add this line to the top:

-vm
/opt/java/bin/java

In my case “/opt/java/bin/java -version” produces the following output:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
Categories: java Tags:

After waking up from suspend, the keyboard doesn’t work properly

April 29, 2013 4 comments

Problem
This is not specific to Ubuntu 13.04; I had this problem before too. That is, after waking up the machine from a suspend, the keyboard doesn’t work properly. Not all key presses are accepted, only about 70% of them. Hitting the keys stronger helps but I don’t want to break the keyboard :)

Solution
I’ve found a stupid workaround but it works :) It’s a USB keyboard and pulling out the cable and reconnecting it fixes the issue. If someone has a more elegant solution, please tell me.

Downgrade your Nvidia driver

April 28, 2013 Leave a comment

Problem
I have an older laptop that I use to watch movies on my TV. It is connected to the TV and I use the TV as a “projector”. The resolution of our HD-ready TV is 1152×864. I also set this resolution on the laptop and the screen was cloned on the TV. It can be set with nvidia-settings easily. Everything worked fine for years when suddenly…

…I clicked on the “Update” button. And it updated the Nvidia driver. And from then on I couldn’t change the resolution. Aaaarrrrrghhhhh!

The nvidia driver offered one resolution only: the highest one, which is 1900×1200. It would be fine for my laptop but I want to clone the screen on the TV which doesn’t support such high resolution. Damn!

Solution
I tried everything. For hours. And finally I found the solution: I managed to downgrade the nvidia driver from 304.88 to 295.33.

nvidia graphics drivers: here

nvidia-settings: here

Note that the version of nvidia-settings must match the version of nvidia graphics driver!

So I downloaded the following files:

nvidia-current_295.33-0ubuntu1_i386.deb
nvidia-current-dev_295.33-0ubuntu1_i386.deb
nvidia-settings_295.33-0ubuntu1_i386.deb

I removed the current nvidia packages and then installed the 3 packages above. Here I suppose that the 3 files above are saved in a folder and you entered that folder.

sudo apt-get purge nvidia-*
sudo dpkg -i *

After restarting the machine it worked fine. On this laptop I will never ever update the nvidia driver, that’s sure as hell.

Links
The downgrade tip is from here.

What’s new in Linux kernel 3.8?

April 26, 2013 Leave a comment
Categories: Uncategorized Tags: , ,

Ubuntu 13.04

April 26, 2013 4 comments

So far I’ve upgraded two machines. I like the new Ubuntu (though it looks and feels like 12.10 :)) but the upgrade was not as smooth as before.

First, on my workplace machine the upgrade process stopped at 30% and the machine simply froze down. I could move the mouse but nothing else worked. Even the clock in the top right corner stopped. I gave it a try, restarted the machine and to my greatest surprise it came back alive and I even had a graphical interface. Wow! With my good_shape_safe.sh script (it’s the second one) I could continue the upgrade process and it finished in order. After a reboot I had a fully functional Ubuntu 13.04.

Second, my home desktop was upgraded without any freeze :) I brought home the update packages and thus the upgrade process finished in an hour. However, after reboot the X started in low resolution. When I launched “nvidia-settings“, it said that my Nvidia card was not enabled and I should re-generate the xorg.conf file. It told me how to do that so I copied/pasted that line to a terminal. After that I reinstalled the nvidia packages:

sudo apt-get --purge remove nvidia-*
sudo apt-get install nvidia-current nvidia-settings

After restarting the X (“sudo service lightdm restart“) the resolution was fine.

However, the torture was not over yet. The graphical interface (Unity) got messed up: the launcher didn’t appear; the Super key (Windows button) didn’t bring up the Dash; the top panel was covered by a Gnome2-ish panel, etc. Fortunately, I found a script that could reset my Unity: https://github.com/phanimahesh/unity-revamp. It worked perfectly and my Unity became usable again. With “ubuntu-tweak” I could fine-tune my new Ubuntu and now it looks like my 12.10 :)

Links

  • I read about the unity-reset script here
  • you can install ubuntu-tweak easily with my jabbatron installer script

Update (20130428)
This morning my Ubuntu got f* up completely. I was at the point that I reinstall the whole s* from scratch. Strangely, after some restarts it started to work OK. So, here is what happened.

First, after restart I got a blank screen. No X, nothing. I couldn’t even switch to console with Ctrl+Alt+F1. After a reset I got the graphical interface. But after a restart no X again. It was alternating… I edited the file “/etc/default/grub” and changed this line:

GRUB_CMDLINE_LINUX_DEFAULT="splash"

Now at least I could follow the bootup sequence and noticed that the boot stopped after mounting the swap partition. Following this post I could fix the swap partition. I am not 100% sure that it was the problem since I also installed a newer version of the nvidia driver.

Fixing the swap partition:

# run "sudo gparted" and figure out the partition of the swap
# for me it was /dev/sda2
sudo swapoff /dev/sda2
sudo mkswap /dev/sda2
sudo swapon /dev/sda2
sudo update-initramfs -u

Update the nvidia driver:

# previous version: 304.88
sudo apt-get --purge remove nvidia-*
sudo apt-get install nvidia-313 nvidia-settings-313

Now the blank screen problem was solved. However, I couldn’t stop the machine. It displayed “* Will now restart” but nothing happened. Again, I had to poke the “/etc/default/grub” file:

GRUB_CMDLINE_LINUX="reboot=b"

More info here. Now it seems OK. Damn, if I had known that I’d have so many problems, I wouldn’t have upgraded to 13.04…

Appendix
My “/etc/default/grub” file looks like this:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=7
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="splash"
GRUB_CMDLINE_LINUX="reboot=b"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
GRUB_GFXMODE=1024x768

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

When you edit this config file, run the following command:

sudo update-grub2

Update (20130503)
My upgraded Ubuntu 13.04 continued to behave strangely. I got fed up with that and today I reinstalled it from scratch. Now it works correctly. Something must have happened to it during the upgrade…

Ubuntu distro info

April 24, 2013 Leave a comment

Today I found an Ubuntu-specific command by chance called “ubuntu-distro-info“. Example:

$ ubuntu-distro-info -af
Ubuntu 4.10 "Warty Warthog"
Ubuntu 5.04 "Hoary Hedgehog"
Ubuntu 5.10 "Breezy Badger"
Ubuntu 6.06 LTS "Dapper Drake"
Ubuntu 6.10 "Edgy Eft"
Ubuntu 7.04 "Feisty Fawn"
Ubuntu 7.10 "Gutsy Gibbon"
Ubuntu 8.04 LTS "Hardy Heron"
Ubuntu 8.10 "Intrepid Ibex"
Ubuntu 9.04 "Jaunty Jackalope"
Ubuntu 9.10 "Karmic Koala"
Ubuntu 10.04 LTS "Lucid Lynx"
Ubuntu 10.10 "Maverick Meerkat"
Ubuntu 11.04 "Natty Narwhal"
Ubuntu 11.10 "Oneiric Ocelot"
Ubuntu 12.04 LTS "Precise Pangolin"
Ubuntu 12.10 "Quantal Quetzal"
Ubuntu 13.04 "Raring Ringtail"

This requires the “distro-info” package to be installed.

Update (20130426)
If you want info about your current distro version, use this instead:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 13.04
Release:        13.04
Codename:       raring
Categories: bash, ubuntu Tags: ,

MozRepl is broken in Firefox 20 but there is a patch

April 19, 2013 Leave a comment

I use the MozRepl Firefox add-on a lot but it stopped working with Firefox 20. But there is an updated version available. More info with the patch here.

Categories: firefox Tags: , ,

KeePassX + TrueCrypt + Dropbox: a secure and portable password management solution

April 14, 2013 4 comments

Read the update at the bottom.

Problem
I’ve arrived at the point that I’m fed up with the f* passwords. I can’t memorize them all so I usually write them in an exercise book that I keep at home. But what if I need something from it at my workplace? On the other hand, this booklet is already full (with other pieces of info too), so when I need a password from it, I need to search it for minutes… Damn. It would be so nice if I had all this information in a file on my machine but in a secure way.

Solution
The ideal solution is a password manager. But which one to choose? There are a lot. Since I also use Windows from time to time, I needed a cross-platform solution. First I thought of using a command line manager but finally I decided to use a graphical one; after all it looks nicer and easier to use (and I didn’t want to learn new command line options that I forget if I don’t use it for a few weeks…). This is how I got to KeePassX, which perfectly fulfills my needs. It’s also in the Ubuntu repos.

As I use several machines, the password database should be available everywhere. So let’s store it on Dropbox. But how safe is it? Well, it’s rather safe; your KeePassX database has a master password, which uses an AES-256 encryption but still… the devil never sleeps. Could we add an extra layer of security?

Yes, we could. With TrueCrypt you can create an encrypted file that can be mounted as a new volume (as if you had attached a USB stick for instance). I put the KeePassX database on this volume. Thus, in order to use the database, first I must mount the container file as a TrueCrypt volume, and then I can open the database file, but it also asks for the master password. Now I dare put the TrueCrypt container file on Dropbox :)

So, here is my setup (summary):

  • Create a KeePassX database and provide a master password. You can change this password later under the File menu. It uses AES-256 encryption.
  • Create a container file with TrueCrypt. The KeePassX database is very small so I set the container’s size to 1 MB. Encryption algorithm: AES-Twofish-Serpent cascading encryption with the XTS method. Hash algorithm: Whirlpool (tip from here). Of course, use a different password for this container file than for the KeePassX database. The TrueCrypt password should be long (20 to 30+ characters).
  • Mount the container file and move the KeePassX database on the mounted volume.

OK. So far so good. But how to use the database painlessly? I made a simple script that mounts the container file and then opens the database. Just customize the constants in the header part. Launch it and simply type in the passwords. Instead of one password (for the database), you will have to provide two extra ones (for the TrueCrypt volume and your root password for being able to mount a new volume). I think this sacrifice is worth considering the additional security you gain. It may be a bit paranoid but on the Internet be paranoid. You know: Trust is a weakness :)

#!/usr/bin/env python

"""
Start KeePassX.
Mount the truecrypt container if necessary.

by Jabba Laci 2013 (jabba.laci@gmail.com)

http://ubuntuincident.wordpress.com/2013/04/14/keepassx-truecrypt-dropbox/

"""

import os

TRUECRYPT = '/usr/bin/truecrypt'
KEEPASSX = '/usr/bin/keepassx'
#
CONTAINER_FILE = "{home}/Dropbox/keepassx/container.dat".format(
    home=os.path.expanduser('~')
)
MOUNT_POINT = '/media/truecrypt9'
KDB = '/media/truecrypt9/JabbaDB.kdb'

def mount_truecrypt_file():
    """
    Open the truecrypt container file that
    includes the keepassx database.
    """
    if not os.path.isfile(KDB):
        cmd = 'sudo {tc} {container} {mount}'.format(
            tc=TRUECRYPT, container=CONTAINER_FILE, mount=MOUNT_POINT
        )
        print '#', cmd
        os.system(cmd)
    else:
        print '# container already mounted to', MOUNT_POINT

def open_kdb():
    """
    Open the keepassx database file on the previously mounted volume.
    """
    if not os.path.isfile(KDB):
        print "Error: the container file was not mounted."
    else:
        cmd = "{kpx} {f} &".format(kpx=KEEPASSX, f=KDB)
        print '#', cmd
        os.system(cmd)

def main():
    mount_truecrypt_file()
    open_kdb()

###################################################################

if __name__ == "__main__":
    main()

[ comments @reddit ]

Update (20130501)
After two weeks of usage, I think adding truecrypt is an overkill. The problem is the following: I want to use this keepassx database on several machines, that’s why I put it on dropbox. That’s fine. But each time I need to mount the truecrypt volume that I often forget to dismount. At my workplace my machine is always on, so sometimes (often) I leave the volume mounted when I go home. If I want to add a new password to the database at home, dropbox creates a conflicted copy of the truecrypt file when I save the keepassx database. So I end up with two different databases that I will have to merge manually. It’s already happened to me 2 or 3 times…

So I removed truecrypt from the chain. Now I have a keepassx database (with a long password) stored on dropbox. I only have to pay attention to close keepassx when I leave my workplace but it’s feasible: when I copy a password from it, I close it immediately.

Best movie/game techno soundtracks

April 14, 2013 Leave a comment

Here I collect my favourite soundtracks. The entries come in no particular order. The list is not final, it will be extended over time.

Movies

Games

Categories: games, movie Tags: , ,

Install Adobe Flash for Firefox properly

April 14, 2013 Leave a comment

Let’s see how to install Adobe Flash under Ubuntu for Firefox properly.

Visit the official site (http://get.adobe.com/flashplayer/) and download the .tar.gz file. Create a temporary directory (e.g. /tmp/flash) and save the file there. This archive is a tarbomb, that’s why we put it in a dedicated folder.

Unzip the archive. There is a “usr” subfolder whose owner and group must be set before copying it to “/usr“. Switch to root (with “su“) and perform the following actions:

  1. chown -R root:root usr (where “usr” is the subfolder from the archive, not the system folder)
  2. copy this “usr” folder to “/usr“, i.e. copy it to the system folder

(Of course, you can also do these steps with “sudo” too.)

Finally, copy the file “libflashplayer.so” to the directory “$HOME/.mozilla/plugins/“. It’s very likely that this folder doesn’t exist yet so create it first.

Restart Firefox and enjoy the ultimate Flash experience :)

Categories: firefox, ubuntu Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 70 other followers