www.hutsky.cz / blog / twitter /

Archive for the ‘Operating systems’ Category

Encrypt partition with dm-crypt

Wednesday, November 30th, 2011

Ever wnated to have your external disk or USB stick encrypted? This is a way to get there on a Debian-based system using dm-crypt and LUKS.

First, make sure dm-crypt module is loaded (see if /dev/mapper/ is present), and if not, load the module:

modprobe dm-crypt

Now you can use cryptsetup to encrypt your device (you’ll be asked for a password):

cryptsetup --verbose --key-size 256 --verify-passphrase luksFormat /dev/sdd1

After this step, you can open the encrypted disk.

cryptsetup luksOpen /dev/sbd1 mydisk

The disk is not ready yet, we need to format it first, just as if we connected an empty device. In theis example, I’ll format it using ext3 file system.

mkfs.ext3 -j -m 1 -O dir_index,filetype /dev/mapper/mydisk

Now you can finally mount and access your disk.

mount -t ext3 /dev/mapper/mydisk /media/mydisk

When you’re done and want to unplug the device, you unmount it the usual way:

umount /dev/mapper/encr-zipdisk

and then use LUKS to close the encrypted connection:

 cryptsetup luksClose encr-zipdisk

Now you can remove the device.

Add a keyboard layout in LXDE

Sunday, November 6th, 2011

With the latast Ubuntu 11.10 out, I had to go for something that would be less resource hungry than Unity on my laptop. After considering a downgrade to one of the older releases, or switching to Mint or Debian, I chose Lubuntu as it seemed to combine up-to-date Ubuntu software sources that contain all I’m used to having on my laptop, and a more lightweight desktop environment.

I have to say I took to it immediately as there are no lags or glitches that I experienced before. All configuration was easy to find, with the only exception of adding a secondary keyboard layout. I added Keyboard Layout Switcher to the panel and then went to the general Preferences -> Keyboard and Mouse -> Keyboard section. But there was no way to add another layout, I could only go to LXKeymap application from there and change to another layout system-wide, but not to add a secondary layout.

After some time, I found help on this forum:

http://forums.linuxmint.com/viewtopic.php?f=175&t=62681

One has to go to this configuration file:

/etc/xdg/lxsession/LXDE/autostart

and add the following:

@setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,cz

Naturally, you add whatever locales you need instead of us,cz. You can switch between the layouts using Alt + Shift after you’ve logged out and in.

I also prefer qwerty version of the Czech layout so there was one minor thing to change:

@setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,cz_qwerty

Apart from this small drawback, I have to say I’ve become quite partial to LXDE so far.

Python os.sytem() and Windows Program Files directory

Saturday, April 2nd, 2011

I ran across a problem when trying to run a program located in “Program Files” directory from within a Python application using os.system(). It was obvious that the problem was caused by the space character in the name of the directory. I didn’t know how to solve the issue as I’m not proficient in Python and also not very comfortable in the Windows environment. Luckily, once again, there were others before me, who had found the way:

 os.system( '""C:\\\\Program Files\\\\WinProgram\\\\PROGRAM.EXE" -params "')

Adding an extra pair of qotation marks did the trick.

Debian 6 is out – testing in Virtualbox

Tuesday, March 15th, 2011

It’s been a while since Debian 6 got released. Now I found some spare time to check it out. Before I get to installing it on my home server, I decided to have a peek using Virtualbox. At first I encountered a problem while while loading the system after the installation. The startup process would stop, saying:

BUG: soft lockup - CPU#0 stuck for 61s! [modprobe :90]

Luckily, I wasn’t the only one to come across this issue so after lowering the amount of memory allocated to the virtual machine, the system managed to start smoothly.

(more…)

Opensolaris – my first encounter

Sunday, January 24th, 2010

I got a liveCD with Opensolaris from my brother today. I know he has been toying with it for some time now, but all I know about Opensolaris is that it’s based on Solaris by Sun, it is UNIX-like, supposedly very stable and famous for its file system. My brother had asked me if I wanted to try it out several times, but unlike him, who earns his bread maintaining OS, I never really got to it with that little time I have.

(more…)

Ubuntu / Debian remote desktop problem

Thursday, January 21st, 2010

Sometimes, it happens that when I want to connect to one of my Debian machines over the vncviewer tool, I just can’t type in the password to unlock the screen. (more…)