29 April 2013

400. XpressConnect on Debian, Arch: step by step

Here's a step-by-step write-up of this post: http://verahill.blogspot.com.au/2013/04/393-not-fix-xpressconnect-on-ubuntu-vs.html

The 'problem' with running Xpress Connect on non-Ubuntu linux distributions is entirely artificial -- XpressConnect checks whether you are using Ubuntu, and if you're not, it refuses to run.

So the solution is simply to pretend that you are using ubuntu, however annoying that is. I wish universities would take this into account and end their association with Cloudpath, or to force them to support other distributions.

Note: XpressConnect is completely superfluous -- it doesn't do anything other than set up your wireless connection, which is something you could easily do by hand. See e.g. here for eduroam: http://verahill.blogspot.com.au/2013/04/394-eduroam-using-wicd-and-network.html


How-to get XpressConnect running
1. Create the file /etc/lsb-release and put the following in it
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS"
If you are completely new to linux, one way of creating the file is to run
gksu gedit /etc/lsb-release

Alternatively, if you're not using gnome, try
sudo nano /etc/lsb-release 

2. Install lshw and iwlist

On debian (and clones like mint, ubuntu etc.):
sudo apt-get install lshw wireless-tools

On arch linux
sudo pacman -S lshw wireless_tools

3. Run XpressConnect
This is the vanilla version -- replace http://hosted.cloudpath.net/Xavier/Production/tools/XpressConnect-Linux.tar with the link to your universities version.

cd ~/Downloads
wget http://hosted.cloudpath.net/Xavier/Production/tools/XpressConnect-Linux.tar
tar xvf XpressConnect-Linux.tar
./XpressConnect-DoubleClickToRun

That's it. Simple as that.

27 April 2013

399. Looking at speeding up (re)boot on debian wheezy.

I'd be interested in getting my beowulf cluster nodes to boot a little bit faster -- (re)boots of the nodes very are infrequent, but the front node doubles as my work desktop and is normally rebooted at least once per month (kernel upgrades etc.) -- rebooting the front node makes me nervous, however, and the faster it boots, the better it is.

I should probably build a low-powered front node specifically for my cluster though...but that takes money, and money takes time.

Anyway, boot. In spite of the impetus for this post I'm testing this on my laptop which has wheezy, gnome 3.4 and an SSD -- it's not that representative of the target system and I'll have to repeat this on a normal desktop with a spinning hdd at a later stage.

I'm more or less following http://wiki.debian.org/BootProcessSpeedup. Note that insserv seems to be set up and enabled by default in Wheezy.


Timing it -- Setting up bootchart2
I first tried to define boot times arbitrarily as the time from me hitting enter in GRUB, to the visual appearance of the log-in prompt in GDM3, but it was too imprecise (up to +- 2) relative to the time a boot took (ca 9-10s).

I ended up installing bootchart and bootchart-view instead.
sudo apt-get install bootchart2

Then edit /etc/default/grub as shown here:
GRUB_CMDLINE_LINUX_DEFAULT="quiet initcall_debug printk.time=y init=/sbin/bootchartd"
and run
sudo update-grub

After a boot, run
pybootchartgui
eog bootchart.png

You'll get something like this:
Look at the top, right above the first chart -- it says 'time: 6.61s'. I'll use that as the metric.

Most of the time bootchart2 worked fine, but for the odd boot the /var/log/bootchart.tgz wasn't accepted by pybootchartgui.

Normal boot, pre-optimisation: 
'Cold' reboots: 6.61, 5.77 seconds
Warm* reboots: 6.46, 5.79, 5.97 seconds

*using shutdown -r now

The variability is very high -- there's almost a second between the fastest and slowest boots. Keep that in mind when looking at the numbers later on.


Using readahead-fedora to pre-load files
sudo apt-get install readahead-fedora

After install, readhead-early, -late and stop were enabled in rcconf.

The first boot took over 7 seconds, but later boots were typically around 6 seconds or faster. Note that readahead is solving an issue which isn't really present when using high bandwidth SSDs, and may even slow things down under conditions where you use an SSD or a spinning disk with a high rpm (e.g. >7200 rpm)

First run

'normal' run

Not exactly an improvement. Looking at /etc/readahead.d/custom.early shows that the wrong kernel files are loaded -- I'm using a custom kernel (3.8.5-ck1) but the stock kernel files are loaded (3.2.0-4). I edited custom.early to point towards my current kernel, and then did a warm reboot.


Speeding up reboots -Kexec
sudo apt-get install kexec-tools

Shutdown your computer once, then boot up. After that first time you can do warm reboots (sudo shutdown -r now) without going through the BIOS and grub stages. The only -- visible -- downside is that your screen will go crazy for a few seconds as the running kernel is being overwritten by the new kernel (I presume). Doesn't look pretty, but reboot is fast.

I couldn't get bootchart to time the hot reboots, but they look 'fast'.


I'll be repeating this on a system with a spinning disk at a later stage.

26 April 2013

398. Securing your Dropbox with encfs

Quite some time ago I made a post about how to use truecrypt and dropbox together. It wasn't a very elegant solution as it consisted of putting a truecrypt container in the dropbox folder.

 Apart from being pretty obvious, it suffers from drawbacks, such as the fixed size of the truecrypt container taking up space whether you're using it all or not.

[Note that mounting the dropbox folder inside a truecrypt container isn't a real solution either since it won't actually encrypt anything.]

Playing around with encfs made me realise that THIS is the perfect solution for secure Dropbox.

We'll make the assumption that you don't want to encrypt everything in your dropbox, but only things which is kept in a specific folder.

I'm presuming that you've got dropbox set up and working. If not, get the deb files from https://www.dropbox.com/

If you're having issues, make sure that fuse is installed, and that you belong to the group fuse (too add, do sudo usermod -a -G fuse $USER . To check do cat /etc/group|grep fuse)

Getting started:

sudo apt-get install encfs
mkdir ~/Dropbox/encrypted
encfs ~/Dropbox/encrypted ~/decrypted
The directory "/home/me/decrypted" does not exist. Should it be created? (y,n) Y Creating new encrypted volume. Please choose from one of the following options: enter "x" for expert configuration mode, enter "p" for pre-configured paranoia mode, anything else, or an empty line will select standard mode. ?> p Paranoia configuration selected. Configuration finished. The filesystem to be created has the following properties: Filesystem cipher: "ssl/aes", version 3:0:2 Filename encoding: "nameio/block", version 3:0:1 Key Size: 256 bits Block Size: 1024 bytes, including 8 byte MAC header Each file contains 8 byte header with unique IV data. Filenames encoded using IV chaining mode. File data IV is chained to filename IV. File holes passed through to ciphertext. -------------------------- WARNING -------------------------- The external initialization-vector chaining option has been enabled. This option disables the use of hard links on the filesystem. Without hard links, some programs may not work. The programs 'mutt' and 'procmail' are known to fail. For more information, please see the encfs mailing list. If you would like to choose another configuration setting, please press CTRL-C now to abort and start over. Now you will need to enter a password for your filesystem. You will need to remember this password, as there is absolutely no recovery mechanism. However, the password can be changed later using encfsctl. New Encfs Password: Verify Encfs Password:
Put the files you want to be encrypted in ~/decrypted -- NOT ~/Dropbox/encrypted. Once you're done, unmount ~/decrypted:
sudo umount ~/decrypted


When you want to access your encrypted files or add more files to the encrypted file, just mount ~/Dropbox/encrypted using encfs:
encfs ~/Dropbox/encrypted ~/decrypted/