<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Pablo&#039;s blog &#187; Kubuntu</title>
	<atom:link href="http://pupeno.com/tag/kubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://pupeno.com</link>
	<description>A bit of this, a bit of that and a lot about computers</description>
	<lastBuildDate>Wed, 15 Feb 2012 08:39:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='pupeno.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/57ca76f9fb1bf9d10a9dd732ea88cc57?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Pablo&#039;s blog &#187; Kubuntu</title>
		<link>http://pupeno.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://pupeno.com/osd.xml" title="Pablo&#039;s blog" />
	<atom:link rel='hub' href='http://pupeno.com/?pushpress=hub'/>
		<item>
		<title>Installing Rails 2 on Ubuntu</title>
		<link>http://pupeno.com/2007/11/13/installing-rails-2-on-ubuntu/</link>
		<comments>http://pupeno.com/2007/11/13/installing-rails-2-on-ubuntu/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 00:00:13 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://263</guid>
		<description><![CDATA[Ubuntu, like many other free operating systems, have a beautiful package management system that will track what depends on what, what is installed, what is not, what is not longer needed, which versions of each. If you tamper with it, you are asking for trouble. If you do a manual upgrade, from sources, eventually a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=263&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://ubuntu.com/">Ubuntu</a>, like many other free operating systems, have a beautiful package management system that will track what depends on what, what is installed, what is not, what is not longer needed, which versions of each. If you tamper with it, you are asking for trouble. If you do a manual upgrade, from sources, eventually a package upgrade will downgrade your version or some other application being incompatible will not work. And once you start throwing files in /usr, you start to ask for trouble. I’ve been using this type of operating systems for years and I’ve learned this by experience.</p>
<p>Nevertheless you, as I, want to try and code with <a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done">Rails 2</a>, right? Well, this is how I installed it in my <a href="http://kubuntu.org/">Kubuntu</a> box (should work the same for any Ubuntu and Debian derivate as well as others). I’ve decided to install everything on /opt/rails. I like to keep more-or-less self-contained directories in /opt. So I started with:</p>
<p><span id="more-263"></span></p>
<pre>
$ sudo mkdir /opt/rails
$ sudo chown pupeno:pupeno /opt/rails
</pre>
<p>and that’s the last time I’ll ever use root access in this document, and that’s the way I like it. Another important detail is that I’ll keep all the environment entirely optional. All you’ll do here will be in a separate directory and will not interfere with the rest of your computer. Actually, to use it, you’ll have to load a file, which means, you control when you are entering the Rails 2 environment. In ~/bin/rails.sh I put:</p>
<pre>
#!/usr/bin/env bash

RAILS_PREFIX=/opt/rails

export PATH="$RAILS_PREFIX/bin:$RAILS_PREFIX/lib/ruby/gems/1.8/bin/:$PATH"
export MANPATH="$RAILS_PREFIX/share/man:$MANPATH"
export LD_LIBRARY_PATH="$RAILS_PREFIX/lib:$LD_LIBRARY_PATH"

PS1="[rails] $PS1"
</pre>
<h1>Ruby</p>
<p>I started installing Ruby. Maybe this wasn’t needed, but I wanted a really clean and separated environment (after downloading and unpacking):</p>
<pre>
$ cd ruby-1.8.6-p111/
$ ./configure --prefix=/opt/rails/
$ make
$ make install
</pre>
<p>Time to enter the Rails 2 environment:</p>
<pre>
$ source ~/bin/rails.sh
[rails] $ which ruby
/opt/rails/bin/ruby
[rails] $ ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
</pre>
<p>Good! To have a nice irb and actually be able to run Rails’ console, we also need the <a href="http://tiswww.case.edu/php/chet/readline/rltop.html">readline</a> gem:</p>
<pre>
[rails] # cd ext/readline
[rails] # ruby extconf.rb
[rails] # make
[rails] # make install
</pre>
</h1>
<h1>Gems</h1>
<p>Installing rubygems is easy as well, after downloading and unpacking, be sure to be in the rails 2 environment and run:</p>
<pre>
[rails] $ cd rubygems-0.9.5/
[rails] $ ruby setup.rb
...
Removing old RubyGems RDoc and ri...
Installing rubygems-0.9.5 ri
into /opt/rails//lib/ruby/gems/1.8/doc/rubygems-0.9.5/ri...
Installing rubygems-0.9.5 rdoc
into /opt/rails//lib/ruby/gems/1.8/doc/rubygems-0.9.5/rdoc...
As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
...done.
No library stubs found.
[rails]  $ which gem
/opt/rails/bin/gem
[rails]  $ gem --version
0.9.5
</pre>
<p>Good!</p>
<h1>Rails</h1>
<p>Just as explained on the Rails web site:</p>
<pre>
[rails]  $ gem install rails
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
OpenURI::HTTPError: 404 Not Found reading

http://gems.rubyforge.org/gems/activesupport-2.0.1.gem
</pre>
<p>Ooops, I’ve got some of those. Just try again:</p>
<pre>
[rails]  $ gem install rails
Successfully installed actionmailer-2.0.1
Successfully installed activeresource-2.0.1
Successfully installed rails-2.0.1
3 gems installed
Installing ri documentation for actionmailer-2.0.1...
Installing ri documentation for activeresource-2.0.1...
Installing RDoc documentation for actionmailer-2.0.1...
Installing RDoc documentation for activeresource-2.0.1...
</pre>
<p>And that’s it, you are ready to rail! (as you can see, all the magic is in that little rails.sh file)</p>
<p><strong>Update 2007-12-31:</strong> include installation of readline.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/263/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/263/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/263/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=263&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2007/11/13/installing-rails-2-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Encrypted home in Ubuntu 8.10</title>
		<link>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-8-10/</link>
		<comments>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-8-10/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 00:00:41 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[cryptsetup]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[luks]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://328</guid>
		<description><![CDATA[This article is like a third edition to &#8220;Encrypted home in Ubuntu (or Kubuntu… or Debian…)&#8221;, although I keep changing the name. It&#8217;s the 8.10 edition. Many things changed and I updated the article for those, and the rest should work as well. Motivation Every day we put more and more personal information on our [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=328&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article is like a third edition to &#8220;Encrypted home in Ubuntu (or Kubuntu… or Debian…)&#8221;, although I keep changing the name. It&#8217;s the 8.10 edition. Many things changed and I updated the article for those, and the rest should work as well.</p>
<h1>Motivation</h1>
<p>Every day we put more and more personal information on our computers, and our computers become lighter, smaller, more mobile. In other words, the importance of the information gets higher and the possibility of being loosed or stolen gets higher as well.</p>
<p><span id="more-328"></span></p>
<p>I think that if anyone gets a-hold of the information in my personal computer (s)he’d be able to impersonate me and make my life a mess. That’s why I like keeping all my information encrypted. That is, I have a separate partition for /home and it is encrypted.</p>
<p>The level of security for this scheme is not very high and if you are a real paranoid you should be reading some other tutorials. I am using just a pass-phrase for the encryption so I am susceptible to dictionary attacks, my swap is not encrypted, so some personal information would be available there. But that’s OK. I am not trying to protect from the people with enough sophistication to perform the needed operations to retrieve that information. Those are not many and they have other means.</p>
<p>My goal is to protect from the regular thieve or from loosing it… so I would mourn for some money being lost but I will sleep well at night.</p>
<p><strong>Disclaimer: the information will be encrypted, you’ll be able to access it with a key: a pass-phrase. If you loose it, you won’t be able to access than information again, so, be careful and make backups.</strong></p>
<h1>Installation</h1>
<p>You should install the operating system as you always do with a little detail: create the root partition, the swap partition and the home partition. But don&#8217;t assign any filesystem to the home partition, do not make or format it and do not set it as home.</p>
<p>After you did that you should be booting into a fresh system. Be sure not to store any sensitive information now, because it’ll be accessible to anyone. Some thinks to take care, if you use a browser or some instant messaging client, do not make them save the password, if you can avoid typing the passwords at all, that will be better.</p>
<p>Once you got pass that you’ll need two packages: cryptsetup and libpam-mount. You can install them with a command like:</p>
<pre>aptitude install cryptsetup libpam-mount</pre>
<p>During installation, limpam-mount request to convert the previous configuration. As we don&#8217;t really have a previous configuration, I&#8217;m not sure what it&#8217;s going to convert so I just choose &#8220;No&#8221; (the default) and let it install a fresh configuration.</p>
<h1>Partitioning</h1>
<p>The encryption we are going to use works like this. Linux puts a layer around a device and creates a new virtual device. Whatever is written to this new virtual device is written to the real device but encrypted. All this works at a very low level and it is called mapping. There are other kind of mappings (to perform other operations than encrypting… think for example as creating volumes of various partitions so they’d be seen as one).</p>
<p>To create the mapping run:</p>
<pre>sudo modprobe dm-crypt</pre>
<pre>sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/sda6</pre>
<p>replacing /dev/sda6 with your particular (real) device.</p>
<p>A bit more about that command. cryptsetup is a program to create this encryption mappings. –-verbose is there because I like to see a lot of useless data and feel more geeky. –-verify-passphrase is there to be asked twice for the pass-phrase, so we don’t insert a wrong pass-phrase by accident. luksFormat is the action. luks is a new system that lets us have more than one password, change passwords, add passwords, etc to some encrypted device. Very handy.A complete execution of that command will look like:</p>
<pre>sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/sda6

WARNING!
========
This will overwrite data on /dev/sda6 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
</pre>
<h1>The new partition</h1>
<p>This new system, luks, also let us inspect what is in a luks-formatted partition. It works like this:</p>
<pre>sudo cryptsetup luksDump /dev/sda6
LUKS header information for /dev/sda6

Version:       	1
Cipher name:   	aes
Cipher mode:   	cbc-essiv:sha256
Hash spec:     	sha1
Payload offset:	1032
MK bits:       	128
MK digest:     	ff c3 22 a1 d1 fe 5e e4 e3 37 26 a7 8e 93 43 22 fa 83 c5 91
MK salt:       	27 59 46 c5 f2 21 5a 93 46 eb 2a cf 80 f1 46 95
               	b6 05 79 02 55 a4 49 33 87 d1 25 ae 49 74 40 b6
MK iterations: 	10
UUID:          	819cf83a-7c9b-49b8-9b74-e0d952aa1234

Key Slot 0: ENABLED
	Iterations:         	208350
	Salt:               	be 31 c7 e3 c9 a8 d5 37 09 12 34 e2 4a 3f a3 85
	                      	e0 fd bc 1e e4 3a fb d6 70 7c 7f 12 34 1a 6d 8e 43
	Key material offset:	8
	AF stripes:            	4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED</pre>
<p>Lot’s of nice information, don’t you feel super-geek ? You can see there that you have 8 spaces for pass-phrases, you have 8 slots of which you are using one, the 0.</p>
<p>To be able to access the encrypted partition you have to open it… and to do it you’ll need a key of course (your pass-phrase). We’ll see the mappings on /dev/mapper/, which should be empty by now (except for a control file… I wouldn’t name a mapping control, just in case):</p>
<pre>ls /dev/mapper/
control</pre>
<p>Ok! Now open it:</p>
<pre>sudo cryptsetup luksOpen /dev/sda6 home
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.</pre>
<p>Great! We have opened it. The last parameter, &#8220;home&#8221;, is the name of the mapping. Let’s take a look at the mappings:</p>
<pre>ls /dev/mapper/
control  home</pre>
<p>Good. This device file is like a partition itself. So, we’ll make a file-system in there in the same way you’d make it in sda6 (from now on, don’t do anything with sda6 except opening and other luks operations, your partition is /dev/mapper/home now). In my case I’ve picked ReiserFS, but you can use whatever you want:</p>
<pre>sudo mkfs.reiserfs -l home /dev/mapper/home
...lot's of geeky output...
ReiserFS is successfully created on /dev/mapper/home.</pre>
<p>and we are done. We can mount it:</p>
<pre>sudo mount /dev/mapper/home /media</pre>
<p>copy the current data (the home of a user and a couple of files):</p>
<pre>sudo cp -a /home/* /media/
cp: ne povas trovi stato-informon pri '/home/pupeno/.gvfs': Permeso rifuzita</pre>
<p>If you don&#8217;t speak the <a href="http://wikipedia.org/wiki/Esperanto">international language</a>, that mean: &#8220;cp: cannot stat `/home/pupeno/.gvfs&#8217;: Permission denied&#8221;. Everything seems to be OK anyway. Un-mount it:</p>
<pre>sudo umount /media/</pre>
<p>and close it:</p>
<pre>sudo cryptsetup luksClose home</pre>
<h1>Automagically mounting</h1>
<p>There are various ways to open and mount the encrypted file-system but after trying many different ones, this is the best one from my point of view. I like that it is not intrusive: when you log in, your user password will be used to open the file-system and it&#8217;ll be mounted automatically. Of course, then, the password of your user should match the pass-phrase in at least one of the slots of the encrypted device.</p>
<p>You need to modify /etc/pam.d/common-auth adding, at the end:</p>
<pre>@include common-pammount</pre>
<p>And /etc/pam.d/common-session to add that same line.</p>
<p>In /etc/security/pam_mount.conf.xml, around line 107 you have a list of &#8220;Linux encrypted home directory examples&#8221;, since what we are going to do is related to that it makes sense to put these lines after that comment (around line 183):</p>
<pre>
</pre>
<p>Of course replace &#8220;pupeno&#8221; with your username and &#8220;/dev/sda6&#8243; with your device. And that is the line that will make the magical mount happen.</p>
<p>Now just try it. It is very simple, log out, log in again and that’s it. You should have you newly super-encrypted home partition mounted. To check it out issue a mount command and among a huge amount of cryptic information you should see:</p>
<pre>/dev/mapper/_dev_sda6 on /home type reiserfs (rw)</pre>
<p>You can also list the files on /dev/mapper to find the _dev_sda6 mapping.</p>
<p>And that’s it, it wasn’t so hard, was it ?</p>
<h1>More users, more pass-phrases</h1>
<p>If there are more users add more lines to /etc/security/pam_mount.conf.xml, I haven’t tested it but it should work. Also just add more pass-phrases to the device using cryptsetup in this way:</p>
<pre>sudo cryptsetup luksAddKey /dev/sda6</pre>
<p>It’ll ask you for a current pass-phrase as well. This is also useful if you are changing pass-phrases, while you work on remembering the new one, don’t delete the old one, so if you forget the new one you should still be able to access your information with the old one. After you are confident of the new one, you can delete the old one with:</p>
<pre>sudo cryptsetup luksDelKey /dev/sda6 0</pre>
<p>where &#8220;0&#8243; is the slot where you have your old pass-phrase (hint: use luksDump). And here I want to remind you that if you lost the password you won’t be able to access the information. There’s no password recovery here: it is gone, forever, as scrambled, processed and destroyed as the dinner of Tuesday of the last week. Be very careful and always make backups.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/328/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/328/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/328/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=328&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-8-10/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Encrypted home in Ubuntu (or Kubuntu… or Xubuntu…)</title>
		<link>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-xubuntu%e2%80%a6/</link>
		<comments>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-xubuntu%e2%80%a6/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 00:00:16 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[cryptsetup]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[luks]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://210</guid>
		<description><![CDATA[This article is like a second edition to Encrypted home in Ubuntu (or Kubuntu… or Debian…). Important changes include that I have tested it for Ubuntu 7.04 Feisty Fawn and it works, but the devices are sd instead of hd due to all hard disk being viewed as SCSI (I am not sure why). Also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=210&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article is like a second edition to Encrypted home in Ubuntu (or Kubuntu… or Debian…). Important changes include that I have tested it for Ubuntu 7.04 Feisty Fawn and it works, but the devices are sd instead of hd due to all hard disk being viewed as SCSI (I am not sure why). Also I corrected some text layout problems of the previous article and I am no longer targeting Debian. Since Debian 4.0 Etch encrypting the whole file system (but /boot) is trivial because it is supported on the install, so you are not likely going to need this. Also, it seems more and more Ubuntu is taking a different direction than Debian so we may start to find big differences and I am not going to test this on Debian.<span id="more-210"></span></p>
<h1>Motivation</h1>
<p>As we put more and more personal information on our computers or computers become lighter, small, more mobile. In other words, the importance of the information gets higher and the possibility of being loosed or stolen gets higher as well.</p>
<p>I think that if anyone gets a-hold of the information in my notebook (s)he’d be able to impersonate me and make my life a mess. That’s why I like keeping all my information encrypted. That is, I have a separate partition for /home and it is encrypted.</p>
<p>The level of security is not high and if you are a real paranoid you should be reading some other tutorials. I am using just a pass-phrase for the encryption so I am susceptible to dictionary attacks, my swap is not encrypted, so some personal information would be available there. But that’s Ok. I am not trying to protect from the people with enough sophistication to perform the needed operations to retrieve that information. And if the thing becomes really nasty I bet people can find other ways to access my information. My goal is to protect from the regular thieve or from loosing it… so I will mourn for some dollars being lost but I will sleep well at night.</p>
<p><strong>Disclaimer: the information will be encrypted, you’ll be able to access it with a key: a pass-phrase. If you loose it, you won’t be able to access than information again, so, be careful.</strong></p>
<h1>Installation</h1>
<p>You should install the operating system as you always do with a little detail: create the root partition, the swap partition but not the home partition. Leave some space for the home partition, we’ll create it latter.</p>
<p>After you did that you should be booting into a fresh system. Be sure not to store any sensitive information now, because it’ll be open to attacks. Some thinks to take care, if you use a browser or some instant messaging client, do not make them save the password, if you can avoid typing the passwords at all, that will be better.</p>
<p>Once you got pass that you’ll need two packages (in Ubuntu and Kubuntu, exactly this, in Debian probably too, in others you’ll have to figure it out; actually, this applies to all the document so I won’t repeat it again): cryptsetup and libpam-mount. You can install them with a command like:</p>
<pre>aptitude install cryptsetup libpam-mount</pre>
<h1>Partitioning</h1>
<p>Create the partition that will be your home partition. Do it in whatever way you prefer, I’ve personally use cfdisk a lot, but you can also use fdisk or any other partitioning tool. After that to ensure that the partition table is written and read by Linux reboot. Avoiding rebooting might not cause any problem or it may cause weird problems with error messages that are hard to understand and that made me loose an hour or so. So, be safe and reboot.</p>
<p>The encryption we are going to use works like this. Linux puts a layer around a device and creates a new virtual device. Whatever is written to this new virtual device is written to the real device but encrypted. All this works at a very low level and it is called mapping. There are other kind of mappings (to perform other operations than encrypting… think for example as creating volumes of various partitions so they’d be seen as one).</p>
<p>To create the mapping run:</p>
<pre>cryptsetup --verbose --verify-passphrase luksFormat /dev/sda3</pre>
<p>replacing /dev/sda3 with your particular (real) device. In my case sda1 is root and sda2 is swap. One important piece of advice here would be putting random information on /dev/sda3 so it is harder to guess what’s in there. I haven’t done it because I was working over some other encrypted partition which was created over random data… enough randomness for me. If you are working in a new or blank this putting the random data might be important. Using your favorite search-engine you can find how to do it in 30 seconds.</p>
<p>A bit more about that command. cryptsetup is a program to create this encryption mappings. –verbose is because we like to see a lot of useless data and feel more geeky. –verify-passphrase is to be asked twice for the pass-phrase, so we don’t insert a wrong pass-phrase by accident. luksFormat is the action. luks is a new system that lets us have more than one password, change passwords, add passwords, etc to some encrypted device. Very handy.</p>
<p><em>Update: I’ve recently installed Kubuntu in a MacBook Pro and I’ve had to modprobe aes (and possible modprobe dm-crypt too) before being able to run the following command line succesfuly, otherwise I’ve got this message:</em></p>
<pre>Failed to setup dm-crypt key mapping.
Check kernel for support for the aes-cbc-essiv:sha256 cipher spec and verify that /dev/sda5 contains at least 133 sectors.
Failed to write to key storage.
Command failed.</pre>
<p>A complete execution of that command will look like:</p>
<pre>WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
root@pulab:~#</pre>
<h1>The new partition</h1>
<p>This new system, luks, also let us inspect what is in a luks-formatted partition. It works like this:</p>
<pre>root@pulab:~# cryptsetup luksDump /dev/sda3
LUKS header information for /dev/sda3

Version:        1
Cipher name:    aes
Cipher mode:    cbc-essiv:sha256
Hash spec:      sha1
Payload offset: 1032
MK bits:        128
MK digest:      65 d9 47 47 f0 74 5c ad ae 79 03 6c c9 11 4d 56 b2 11 78 90
MK salt:        19 d7 3b c6 04 2d ee e1 77 c0 4b f1 ac e1 3a 21
                ce 02 10 9a c5 f7 5a b7 fd f5 d4 96 96 6d 79 0d
MK iterations:  10
UUID:           bf5ca0c3-a68f-4544-8840-ba2p2af98918

Key Slot 0: ENABLED
        Iterations:             70156
        Salt:                   08 e1 75 0e d1 1b 92 d1 f1 5f bd 50 9c ec a0 a2
                                b9 ea f8 da 1a 62 5d 4b 15 f3 4c a3 f3 49 12 83
        Key material offset:    8
        AF stripes:             4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED</pre>
<p>Lot’s of nice information, don’t you feel super-geek ? You can see there that you have 8 spaces for pass-phrases, you have 8 slots of which you are using one, the 0.</p>
<p>To be able to access the encrypted partition you have to open it… and to do it you’ll need a key of course (your pass-phrase). We’ll see the mappings on /dev/mapper/, which should be empty by now (except for a control file… I wouldn’t name a mapping control, just in case):</p>
<pre>root@pulab:~# ls /dev/mapper/
control</pre>
<p>Ok! Now open it:</p>
<pre>root@pulab:~# cryptsetup luksOpen /dev/sda3 home
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.</pre>
<p>Great! We have opened it. The last parameter, &#8220;home&#8221;, is the name of the mapping. Let’s take a look at the mappings:</p>
<pre>root@pulab:~# ls /dev/mapper/
control  home</pre>
<p>Good. This device file is like a partition itself. So, we’ll make a file-system in there in the same way you’d make it in sda3 (from now on, don’t do anything with sda3 except opening and other luks operations, your partition is /dev/mapper/home now). In my case I’ve picked reiserfs, but you can use whatever you want:</p>
<pre>root@pulab:~# mkfs.reiserfs -l home /dev/mapper/home
.
lot's of geeky output
.
root@pulab:~#</pre>
<p>and we are done. We can mount it:</p>
<pre>root@pulab:~# mount /dev/mapper/home /media/</pre>
<p>copy the current data (the home of a user and a couple of files):</p>
<pre>root@pulab:~# cp -a /home/* /media/</pre>
<p>un-mount it:</p>
<pre>root@pulab:~# umount /media/</pre>
<p>and close it:</p>
<pre>cryptsetup luksClose home</pre>
<h1>Automagically mounting</h1>
<p>There are various ways to open and mount the encrypted file-system but after trying many different ones, this is the best one from my point of view. I like that it is not intrusive: when you log in, your user password will be used to open the file-system and it’ll be mounted automatically. Of course then the password of your user should match the pass-phrase in some of the slots of the encrypted device.</p>
<p>You need to modify /etc/pam.d/common-auth adding, at the end:</p>
<pre>@include common-pammount</pre>
<p>And /etc/pam.d/common-session to add that same line:</p>
<pre>@include common-pammount</pre>
<p>In /etc/security/pam_mount.conf, around line 174 you have a list of &#8220;Linux encrypted home directory examples&#8221;, since what we are going to do is related to that it makes sense to put this line:</p>
<pre>volume pupeno crypt - /dev/sda3 /home cipher=aes - -</pre>
<p>there changing &#8220;pupeno&#8221; with your username and &#8220;/dev/sda3&#8243; with your device. And that is the line that will make the magical mount happen.</p>
<p>Now just try it. It is very simple, log out, log in again and that’s it. You should have you newly super-encrypted home partition mounted. To check it out issue a mount command and among a huge amount of cryptic information you should see:</p>
<pre>/dev/mapper/_dev_sda3 on /home type reiserfs (rw)</pre>
<p>You can also list the files on /dev/mapper to find the _dev_sda3 mapping.</p>
<p>And that’s it, it wasn’t so hard, was it ?</p>
<h1>More users, more pass-phrases</h1>
<p>If there are more users add more lines to /etc/security/pam_mount.conf, I haven’t tested it but it should work. Also just add more passphrases to the device using cryptsetup in this way:</p>
<pre>cryptsetup luksAddKey /dev/sda3</pre>
<p>It’ll ask you for a current pass-phrase as well. This is also useful if you are changing pass-phrases, while you work on remembering the new one, don’t delete the old one, so if you forget the new one you should still be able to access your information with the old one. After you are confident of the new one, you can delete the old one with:</p>
<pre>cryptsetup luksDelKey /dev/sda3 0</pre>
<p>where &#8220;0&#8243; is the slot where you have your old pass-phrase (hint: use luksDump). And here I want to remind you that if you lost the password you won’t be able to access the information. There’s no password recovery here: it is gone, forever, as scrambled, processed and destroyed as the dinner of Tuesday of the last week. Be very careful and always make backups.</p>
<h1>Comments on the original blog</h1>
<p><cite><a rel="external nofollow" href="http://borys.musielak.eu/en/">michuk</a> Says: </cite></p>
<p>Two more articles describing the same:<br />
* <a rel="nofollow" href="http://polishlinux.org/howtos/truecrypt-howto/">http://polishlinux.org/howtos/truecrypt-howto/</a><br />
* <a rel="nofollow" href="http://polishlinux.org/howtos/encrypted-home-partition-in-linux/">http://polishlinux.org/howtos/encrypted-home-partition-in-linux/</a></p>
<p><a href="http://pupeno.com/2007/06/10/encrypted-home-ubuntu/#comment-250">June 11th, 2007 at 5:47</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/210/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/210/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=210&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-xubuntu%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Encrypted home in Ubuntu (or Kubuntu… or Debian…)</title>
		<link>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-debian%e2%80%a6/</link>
		<comments>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-debian%e2%80%a6/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 00:00:14 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[cryptsetup]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[luks]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://202</guid>
		<description><![CDATA[The explanations you’ll find here have been tested with Ubuntu 6.10 (Edgy Eft) and Kubuntu 6.10 (Edgy Eft), they should work without any problem in other members of the Ubuntu family and with minimal changes in other Debian-based distributions like Debian itself or Mepis. In other distributions it might require even more changes. Motivation As [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=202&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The explanations you’ll find here have been tested with Ubuntu 6.10 (Edgy Eft) and Kubuntu 6.10 (Edgy Eft), they should work without any problem in other members of the Ubuntu family and with minimal changes in other Debian-based distributions like Debian itself or Mepis. In other distributions it might require even more changes.<br />
<span id="more-202"></span></p>
<h1>Motivation</h1>
<p>As we put more and more personal information on our computers or computers become lighter, small, more mobile. In other words, the importance of the information gets higher and the possibility of being loosed or stolen gets higher as well.</p>
<p>I think that if anyone gets a-hold of the information in my notebook (s)he’d be able to impersonate me and make my life a mess. That’s why I like keeping all my information encrypted. That is, I have a separate partition for /home and it is encrypted.</p>
<p>The level of security is not high and if you are a real paranoid you should be reading some other tutorials. I am using just a pass-phrase for the encryption so I am susceptible to dictionary attacks, my swap is not encrypted, so some personal information would be available there. But that’s Ok. I am not trying to protect from the people with enough sophistication to perform the needed operations to retrieve that information. And if the thing becomes really nasty I bet people can find other ways to access my information. My goal is to protect from the regular thieve or from loosing it… so I will mourn for some dollars being lost but I will sleep well at night.</p>
<p><strong>Disclaimer: the information will be encrypted, you’ll be able to access it with a key: a pass-phrase. If you loose it, you won’t be able to access than information again, so, be careful.</strong></p>
<h1>Installation</h1>
<p>You should install the operating system as you always do with a little detail: create the root partition, the swap partition but not the home partition. Leave some space for the home partition, we’ll create it latter.</p>
<p>After you did that you should be booting into a fresh system. Be sure not to store any sensitive information now, because it’ll be open to attacks. Some thinks to take care, if you use a browser or some instant messaging client, do not make them save the password, if you can avoid typing the passwords at all, that will be better.</p>
<p>Once you got pass that you’ll need two packages (in Ubuntu and Kubuntu, exactly this, in Debian probably too, in others you’ll have to figure it out; actually, this applies to all the document so I won’t repeat it again): cryptsetup and libpam-mount. You can install them with a command like:</p>
<pre>aptitude install cryptsetup libpam-mount</pre>
<h1>Partitioning</h1>
<p>Create the partition that will be your home partition. Do it in whatever way you prefer, I’ve personally use cfdisk a lot, but you can also use fdisk or any other partitioning tool. After that to ensure that the partition table is written and read by Linux reboot. Avoiding rebooting might not cause any problem or it may cause weird problems with error messages that are hard to understand and that made me loose an hour or so. So, be safe and reboot.</p>
<p>The encryption we are going to use works like this. Linux puts a layer around a device and creates a new virtual device. Whatever is written to this new virtual device is written to the real device but encrypted. All this works at a very low level and it is called mapping. There are other kind of mappings (to perform other operations than encrypting… think for example as creating volumes of various partitions so they’d be seen as one).</p>
<p>To create the mapping run:</p>
<pre>cryptsetup --verbose --verify-passphrase luksFormat /dev/hda3</pre>
<p>replacing /dev/hda with your particular (real) device. In my case hda1 is root and hda2 is swap. One important piece of advice here would be putting random information on /dev/hda3 so it is harder to guess what’s in there. I haven’t done it because I was working over some other encrypted partition which was created over random data… enough randomness for me. If you are working in a new or blank this putting the random data might be important. Using your favorite search-engine you can find how to do it in 30 seconds.</p>
<p>A bit more about that command. cryptsetup is a program to create this encryption mappings. –verbose is because we like to see a lot of useless data and feel more geeky. –verify-passphrase is to be asked twice for the pass-phrase, so we don’t insert a wrong pass-phrase by accident. luksFormat is the action. luks is a new system that lets us have more than one password, change passwords, add passwords, etc to some encrypted device. Very handy.</p>
<p>A complete execution of that command will look like:</p>
<pre>WARNING!
========
This will overwrite data on /dev/hda3 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
Command successful.
root@pulab:~#</pre>
<h1>The new partition</h1>
<p>This new system, luks, also let us inspect what is in a luks-formatted partition. It works like this:</p>
<pre>root@pulab:~# cryptsetup luksDump /dev/hda3
LUKS header information for /dev/hda3

Version: 1
Cipher name: aes
Cipher mode: cbc-essiv:sha256
Hash spec: sha1
Payload offset: 1032
MK bits: 128
MK digest: 65 d9 47 47 f0 74 5c ad ae 79 03 6c c9 11 4d 56 b2 11 78 90
MK salt: 19 d7 3b c6 04 2d ee e1 77 c0 4b f1 ac e1 3a 21
ce 02 10 9a c5 f7 5a b7 fd f5 d4 96 96 6d 79 0d
MK iterations: 10
UUID: bf5ca0c3-a68f-4544-8840-ba2p2af98918

Key Slot 0: ENABLED
Iterations: 70156
Salt: 08 e1 75 0e d1 1b 92 d1 f1 5f bd 50 9c ec a0 a2
b9 ea f8 da 1a 62 5d 4b 15 f3 4c a3 f3 49 12 83
Key material offset: 8
AF stripes: 4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED</pre>
<p>Lot’s of nice information, don’t you feel super-geek ? You can see there that you have 8 spaces for pass-phrases, you have 8 slots of which you are using one, the 0.</p>
<p>To be able to access the encrypted partition you have to open it… and to do it you’ll need a key of course (your pass-phrase). We’ll see the mappings on /dev/mapper/, which should be empty by now (except for a control file… I wouldn’t name a mapping control, just in case):</p>
<pre>root@pulab:~# ls /dev/mapper/
control</pre>
<p>Ok! Now open it:</p>
<pre>root@pulab:~# cryptsetup luksOpen /dev/hda3 home
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.</pre>
<p>Great! We have opened it. The last parameter, &#8220;home&#8221;, is the name of the mapping. Let’s take a look at the mappings:</p>
<pre>root@pulab:~# ls /dev/mapper/
control home</pre>
<p>Good. This device file is like a partition itself. So, we’ll make a file-system in there in the same way you’d make it in hda3 (from now on, don’t do anything with hda3 except opening and other luks operations, your partition is /dev/mapper/home now). In my case I’ve picked reiserfs, but you can use whatever you want:</p>
<pre>root@pulab:~# mkfs.reiserfs -l home /dev/mapper/home
.
lot's of geeky output
.
root@pulab:~#</pre>
<p>and we are done. We can mount it:</p>
<pre>root@pulab:~# mount /dev/mapper/home /media/</pre>
<p>copy the current data (the home of a user and a couple of files):</p>
<pre>root@pulab:~# cp -a /home/* /media/</pre>
<p>un-mount it:</p>
<pre>root@pulab:~# umount /media/</pre>
<p>and close it:</p>
<pre>cryptsetup luksClose home</pre>
<h1>Automagically mounting</h1>
<p>There are various ways to open and mount the encrypted file-system but after trying many different ones, this is the best one from my point of view. I like that it is not intrusive: when you log in, your user password will be used to open the file-system and it’ll be mounted automatically. Of course then the password of your user should match the pass-phrase in some of the slots of the encrypted device.</p>
<p>You need to modify /etc/pam.d/common-auth adding, at the end:</p>
<pre>@include common-pammount</pre>
<p>And /etc/pam.d/common-session to add that same line:</p>
<pre>@include common-pammount</pre>
<p>In /etc/security/pam_mount.conf, around line 174 you have a list of &#8220;Linux encrypted home directory examples&#8221;, since what we are going to do is related to that it makes sense to put this line:</p>
<pre>volume pupeno crypt - /dev/hda3 /home cipher=aes - -</pre>
<p>there changing &#8220;pupeno&#8221; with your username and &#8220;/dev/hda3&#8243; with your device. And that is the line that will make the magical mount happen.</p>
<p>Now just try it. It is very simple, log out, log in again and that’s it. You should have you newly super-encrypted home partition mounted. To check it out issue a mount command and among a huge amount of cryptic information you should see:</p>
<pre>/dev/mapper/_dev_hda3 on /home type reiserfs (rw)</pre>
<p>You can also list the files on /dev/mapper to find the _dev_hda3 mapping.</p>
<p>And that’s it, it wasn’t so hard, was it ?</p>
<h1>More users, more passphrases</h1>
<p>If there are more users add more lines to /etc/security/pam_mount.conf, I haven’t tested it but it should work. Also just add more passphrases to the device using cryptsetup in this way:</p>
<pre>cryptsetup luksAddKey /dev/hda3</pre>
<p>It’ll ask you for a current pass-phrase as well. This is also useful if you are changing pass-phrases, while you work on remembering the new one, don’t delete the old one, so if you forget the new one you should still be able to access your information with the old one. After you are confident of the new one, you can delete the old one with:</p>
<pre>cryptsetup luksDelKey /dev/hda3 0</pre>
<p>where &#8220;0&#8243; is the slot where you have your old pass-phrase (hint: use luksDump). And here I want to remind you that if you lost the password you won’t be able to access the information. There’s no password recovery here: it is gone, forever, as scrambled, processed and destroyed as the dinner of Tuesday of the last week. Be very careful and always make backups.</p>
<h1>Comments in the original blog</h1>
<div><cite><a rel="external nofollow" href="http://www.codixx.de/polarizer.html"></a></cite></div>
<ol>
<li><cite><a rel="external nofollow" href="http://borys.musielak.eu/en/">michuk</a> Says: </cite><br />
Two more articles describing the same:<br />
* <a rel="nofollow" href="http://polishlinux.org/howtos/truecrypt-howto/">http://polishlinux.org/howtos/truecrypt-howto/</a><br />
* <a rel="nofollow" href="http://polishlinux.org/howtos/encrypted-home-partition-in-linux/">http://polishlinux.org/howtos/encrypted-home-partition-in-linux/</a></li>
</ol>
<p><a href="http://pupeno.com/blog/encrypted-home-ubuntu/#comment-250">June 11th, 2007 at 5:47</a> <a href="https://pupeno.com/wp-admin/post.php?action=editcomment&amp;comment=250">e</a></p>
<li>
<div><cite>Andrew Says: </cite></div>
<p>In Ubuntu 8.04, instead of editing /etc/security/pam_mount.conf you need to edit /etc/security/pam_mount.conf.xml and add something like</p>
<p>Make sure to add the line to /etc/crypttab:<br />
cryptohome /dev/devicename noauto luks</p>
<p>You wrote:<br />
And /etc/pam.d/common-session to add that same line:</p>
<p>48c77b0112e4613</p>
<p>this number should be<br />
@include common-pammount</p>
<p>as written above.</p>
<p><a href="http://pupeno.com/blog/encrypted-home-ubuntu/#comment-31061">September 10th, 2008 at 8:50</a> <a href="https://pupeno.com/wp-admin/post.php?action=editcomment&amp;comment=31061">e</a></p>
<div><!-- --></div>
<div>
<h5>Document Actions</h5>
</div>
</li>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/202/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/202/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=202&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2007/06/10/encrypted-home-in-ubuntu-or-kubuntu%e2%80%a6-or-debian%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Unstable packages on Ubuntu</title>
		<link>http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/</link>
		<comments>http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/#comments</comments>
		<pubDate>Sun, 17 Dec 2006 00:00:07 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[aptitude]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[unstable]]></category>

		<guid isPermaLink="false">http://127</guid>
		<description><![CDATA[I’ve recently switched from Gentoo to Ubuntu. The main reasons is that in Ubuntu I have less things to take care about that I don’t really care about (like compiling Linux). In the switch I also lost some interesting features. The most interesting feature is to be able to easily tell the packaging system that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=127&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve recently switched from <a href="http://gentoo.org/">Gentoo</a> to <a href="http://ubuntu.com/">Ubuntu</a>. The main reasons is that in Ubuntu I have less things to take care about that I don’t really care about (like compiling Linux). In the switch I also lost some interesting features.<br />
<span id="more-127"></span></p>
<p>The most interesting feature is to be able to easily tell the packaging system that I want the unstable versions of this and that packages. I normally use the latest of <a href="http://www.haskell.org/ghc/">GHC</a> and <a href="http://erlang.org/">Erlang</a> (for example, the current GHC is just too old, and for Erlang, I like living on the edge; and the same for lots of other packages).</p>
<p>Although I was not able to reproduce that functionality completely I’ve found a good alternative. As usual this applies verbatim to other members of the Ubuntu family like <a href="http://kubuntu.org/">Kubuntu</a> and <a href="http://www.edubuntu.org/">Edubuntu</a>. They also apply to Debian, but for Debian there are already <a href="http://backports.org/">Backports</a> so it doesn’t make any sense there. In this case I’ll do it for Ubuntu Edgy and Erlang, you’ll have to adapt it to your case.</p>
<p>Open the sources definitions in /etc/apt/sources.list and add the sources you want, but only to get sources and not binary packages (that is, the deb-src record and not the deb one). This is very important, if you add the deb you’ll get your whole system upgraded into the unstable version hence your system will be unstable. That option is only for developers, testers and adventurous people. In my case I added:</p>
<pre>deb-src http://ar.archive.ubuntu.com/ubuntu/ feisty main restricted universe multiverse</pre>
<p>Note that it is the mirror for Argentina (the &#8220;ar.&#8221; there), pick a mirror closer to you.</p>
<p>As usual you have to update the database of sources:</p>
<pre>sudo aptitude update</pre>
<p>where you should see something like:</p>
<pre>Get:16 http://ar.archive.ubuntu.com feisty/main Sources [278kB]
Get:17 http://ar.archive.ubuntu.com feisty/restricted Sources [1740B]
Get:18 http://ar.archive.ubuntu.com feisty/universe Sources [1106kB]
Get:19 http://ar.archive.ubuntu.com feisty/multiverse Sources [43.3kB]</pre>
<p>among the normal output. Very good.</p>
<p>I recommend running all the commands I’ll mention latter in a<br />
particular directory for this purpose, like ~/pkg/Ubuntu/Erlang.<br />
Basically, the build is done by one line:</p>
<pre>fakeroot apt-get source --build erlang</pre>
<p>but something can go wrong:</p>
<pre>bash: fakeroot: command not found</pre>
<p>We are missing fakeroot, we just install it:</p>
<pre>sudo aptitude install fakeroot</pre>
<p>and now we try the build command,</p>
<pre>fakeroot apt-get source --build erlang</pre>
<p>again:</p>
<pre>Reading package lists... Done
Building dependency tree
Reading state information... Done
Need to get 10.2MB of source archives.
Get:1 http://ar.archive.ubuntu.com feisty/universe erlang 1:11.b.2-2 (dsc) [845B]
Get:2 http://ar.archive.ubuntu.com feisty/universe erlang 1:11.b.2-2 (tar) [10.2MB]
Get:3 http://ar.archive.ubuntu.com feisty/universe erlang 1:11.b.2-2 (diff) [33.7kB]
Fetched 10.2MB in 2m33s (66.5kB/s)
gpg: Signature made Thu 23 Nov 2006 02:59:49 AM ART using DSA key ID C4CF8EC3
gpg: Can't check signature: public key not found
dpkg-source: extracting erlang in erlang-11.b.2
dpkg-source: unpacking erlang_11.b.2.orig.tar.gz
dpkg-source: applying ./erlang_11.b.2-2.diff.gz
dpkg-buildpackage: source package is erlang
dpkg-buildpackage: source version is 1:11.b.2-2
dpkg-buildpackage: source changed by Erlang Packagers &lt;erlang-pkg-devel@lists.berlios.de&gt;
dpkg-buildpackage: host architecture i386
dpkg-buildpackage: source version without epoch 11.b.2-2
dpkg-checkbuilddeps: Unmet build dependencies: debhelper (&gt;= 4.0.0) dpatch unixodbc-dev
dpkg-buildpackage: Build dependencies/conflicts unsatisfied; aborting.
dpkg-buildpackage: (Use -d flag to override.)
Build command 'cd erlang-11.b.2 &amp;&amp; dpkg-buildpackage -b -uc' failed.
E: Child process failed</pre>
<p>Believe it or not, that was better. We can see that it downloaded three file, a dsc, a tar and a diff. Those are the sources of a deb package. It tried to verify the gpg signature and it failed, don’t worry about that. The real problem is in the line that starts with &#8220;dpkg-checkbuilddep&#8221;, to build Erlang we need some packages we don’t have. So we install them:</p>
<pre>sudo aptitude install debhelper dpatch unixodbc-dev</pre>
<p>It is possible that a unstable package would depend on other unstable packages. Imagine if Ubuntu Edgy shipped debhelper 3.6.2, then it would not be enough to satisfy the dependency of debhelper (&gt;= 4.0.0). In that case you should restart all this process for that other package until you have all the packages you need. You may run into trouble if you hit basic packages such as linux or libc… that’s beyond the scope of this little tutorial. With those packages installed we are ready to issue the build command again:</p>
<pre>fakeroot apt-get source --build erlang</pre>
<p>This time nothing goes wrong and we can see the familiar compiling output. Now it is just a matter of waiting. Wait. After the wait, and if everything went right, you’ll see your newly created Erlang packages:</p>
<pre>$ ls *.deb
erlang_11.b.2-2_all.deb             erlang-dev_11.b.2-2_i386.deb      erlang-nox_11.b.2-2_all.deb
erlang-base_11.b.2-2_i386.deb       erlang-examples_11.b.2-2_all.deb  erlang-src_11.b.2-2_all.deb
erlang-base-hipe_11.b.2-2_i386.deb  erlang-mode_11.b.2-2_all.deb      erlang-x11_11.b.2-2_all.deb</pre>
<p>All we have to do know is install them:</p>
<pre>sudo dpkg -i erlang_11.b.2-2_all.deb erlang-base_11.b.2-2_i386.deb erlang-dev_11.b.2-2_i386.deb erlang-examples_11.b.2-2_all.deb erlang-mode_11.b.2-2_all.deb erlang-nox_11.b.2-2_all.deb erlang-src_11.b.2-2_all.deb erlang-x11_11.b.2-2_all.deb</pre>
<p>Dpkg knows about dependencies and how to solve them but doesn’t know where to get packages from, that is what APT does (with all its repositories and all that). During that installation I’ve run into a problem:</p>
<pre>dpkg: dependency problems prevent configuration of erlang-x11:
 erlang-x11 depends on tk8.4 | wish; however:
  Package tk8.4 is not installed.
  Package wish is not installed.</pre>
<p>To solve it I just run:</p>
<pre>sudo aptitude install tk8.4</pre>
<p>and that was it:</p>
<pre>$ erl
Erlang (BEAM) emulator version 5.5.2  [async-threads:0] [kernel-poll:false]

Eshell V5.5.2  (abort with ^G)
1&gt;</pre>
<p>Enjoy!</p>
<h2>Comments in the original blog</h2>
<ol>
<li><cite>Gwern Says: </cite><br />
Wow. That’s pretty complex. Couldn’t you just pin packages to experimental or unstable, or run out of a local darcs repository?<a href="http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/#comment-226">March 16th, 2007 at 2:49</a> <a href="http://pupeno.com/wp-admin/post.php?action=editcomment&amp;comment=226">e</a></li>
<li>
<div><em><a href="http://pupeno.com/">Pupeno</a> Says:</em></div>
<p>You<br />
can’t just run packages from experimental or unstable because they are<br />
compiled for experimental or ustable. They are not likely to work with<br />
older versions of libraries, and if you start updatnig those libraries<br />
as well you are likely to soon hit libc6 and kaboom, your whole system<br />
will be upgraded to experimental or unstable.</p>
<p>I don’t know what you mean by a local darcs repository, but if it is<br />
download the source code, compiling (like in configure, make) and<br />
install (make install), of course you can… but you loose the hability<br />
to do package-related actions, like uninstalling (aptitude uninstall<br />
package), finding out what files it installed (dpkg -L package),<br />
finding out to what package a file belongs when it belongs to our<br />
experimental software (dpkg -S /some/file) or spread the experimental<br />
package across comptures.</p>
<p>I hope I have answered your question.</p>
<p><a href="http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/#comment-227">March 16th, 2007 at 7:56</a> <a href="http://pupeno.com/wp-admin/post.php?action=editcomment&amp;comment=227">e</a></li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/127/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/127/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=127&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2006/12/17/unstable-packages-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>The lambda revolution, Episode V, the deb strikes back</title>
		<link>http://pupeno.com/2006/12/12/the-lambda-revolution-episode-v-the-deb-strikes-back/</link>
		<comments>http://pupeno.com/2006/12/12/the-lambda-revolution-episode-v-the-deb-strikes-back/#comments</comments>
		<pubDate>Tue, 12 Dec 2006 00:00:37 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://108</guid>
		<description><![CDATA[There’s an excellent article by Don “dons” Stewart called The lambda revolution which explains how to build a Haskell library in way that it is easy to download, compile, install, test, distribute, etc. I believe all those qualities are essential for successfully software. The next logicall step is to make OS-specific packages of it and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=108&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There’s an excellent article by <a href="http://www.cse.unsw.edu.au/%7Edons/contact.html">Don “dons” Stewart</a> called <a href="http://cgi.cse.unsw.edu.au/%7Edons/blog/2006/12/11">The lambda revolution</a> which explains how to build a <a href="http://haskell.org/">Haskell</a> library in way that it is easy to download, compile, install, test, distribute, etc. I believe all those qualities are essential for successfully software. The next logicall step is to make OS-specific packages of it and since today I’ve had a short talk with Ian “Iglo” Lynagh, maintainer of many Haskell packages on <a href="http://debian.org/">Debian</a>, who dissipated all my doubts about how to build a deb package of a Haskell library. Armed with that knowledge I am going to turn Don’s dlist into a beautiful deb package for Debian, <a href="http://kubuntu.org/">Kubuntu</a> or any other deb based operating system and tell you how.<br />
<span id="more-108"></span><br />
We start downloading this new package and extracting it:</p>
<pre>$ wget http://www.cse.unsw.edu.au/~dons/dlist/dlist-0.1.tar.gz
$ tar xvfz dlist-0.1.tar.gz
dlist-0.1
dlist-0.1/Data
dlist-0.1/Data/DList.hs
dlist-0.1/dlist.cabal
dlist-0.1/Setup.lhs
dlist-0.1/tests
dlist-0.1/tests/Parallel.hs
dlist-0.1/tests/Properties.hs
dlist-0.1/LICENSE
dlist-0.1/README</pre>
<p>All the files we are going to create for packaging go in the “debian” directory inside dlist-0.1:</p>
<pre>$ cd dlist-0.1/
~/dlist-0.1$ mkdir debian
~/dlist-0.1$ cd debian</pre>
<p>We are going to take the files from another Haskell package to use them as templates. There are some Debian tools that generate a huge set of files inside the debian dir for making a package, but they are not targeted to Haskell and since you’d have to make so many changes that it’ll be easier to start from another Haskell package. Pick almost any from package from <a href="http://haskell-unsafe.alioth.debian.org/haskell-unsafe.html">Haskell Unsafe</a>, I’ve picked <a href="http://haskell-unsafe.alioth.debian.org/archive/i386/unstable/h/haskell-hunit/haskell-hunit_1.1-1.diff.gz">haskell-hunit</a>:</p>
<pre>~/dlist-0.1/debian$ wget http://haskell-unsafe.alioth.debian.org/.../haskell-hunit_1.1-1.diff.gz</pre>
<p>It is a diff we have to apply after uncompressing it:</p>
<pre>~/dlist-0.1/debian$ gunzip haskell-hunit_1.1-1.diff.gz
~/dlist-0.1/debian$ patch &lt; haskell-hunit_1.1-1.diff
patching file copyright
patching file compat
patching file control
patching file rules
patching file changelog
patching file control.in
patching file libghc6-hunit-dev.prerm
patching file libghc6-hunit-dev.postinst
patching file libghc6-hunit-dev.prerm.in
patching file libghc6-hunit-dev.postinst.in</pre>
<p>Some of those files are automatically generated (this is very different to normal Debian packages), so, we delete them:</p>
<pre>~/dlist-0.1/debian$ rm control libghc6-hunit-dev.postinst libghc6-hunit-dev.prerm</pre>
<p>And we can also remove the diff now:</p>
<pre>~/dlist-0.1/debian$ rm haskell-hunit_1.1-1.diff</pre>
<p>Now it is time to edit the files and customize them accordingly. Let’s start with changelog. The format of this file is very precise, one extra or missing space in some places and you’ll get an error. The result now looks like:</p>
<pre>dlist (0.1-1) unstable; urgency=low

* Initial release.

-- José Pablo "Pupeno" Fernández

Mon, 11 Dec 2006 12:08:04 -0300</pre>
<p>From that file the system will get the version of the package: 0.1-1. The first part, 0.1 is the mainstream release. The second part, -1, is the Debian release. It is there so you can correct a packaging mistake and release a new package, 0.1-2. The next file is control.in:</p>
<pre>Source: dlist
Section: devel
Priority: optional
Maintainer: José Pablo "Pupeno" Fernández
Standards-Version: 3.7.2
Build-Depends: debhelper (&gt;= 4), haddock (&gt;= 0.6), $ghc6_lib_bdeps,
haskell-utils (&gt;= 1.5), libghc6-base-dev, libghc6-base-prof
Package: libghc6-dlist-dev
Provides: libghc6-dlist-prof
Architecture: any
Depends: $ghc6_lib_deps, ${shlibs:Depends}, ${misc:Depends},
libghc6-base-dev, libghc6-base-prof
Description: A Haskell list type supporting O(1) append and snoc operations.
dlist provides Data.DList, a list type supporting O(1) append and snoc operations.</pre>
<p>Build-Depends and Depends should be on one line, they were broken just to fit in the screen here. Description has two parts. The one in the first line is the short description. The rest, indented by spaces, is the long description. If the long description has more than one paragraph, each paragraph should be separated by an indented line containing a dot, like this:</p>
<pre>this is the first paragraph.
.
this is the second paragraph.</pre>
<p>The first line with nothing in it finishes the description. Now the copyright. This file contains some general information about who created the deb and who created the software itself:</p>
<pre>This package was debianised by José Pablo "Pupeno" Fernández
on Mon, 11 Dec 2006.
It was downloaded from:

http://www.cse.unsw.edu.au/~dons/dlist/dlist-0.1.tar.gz

The homepage for the module is:

http://www.cse.unsw.edu.au/~dons/dlist.html

Copyright (c) 2006, Don Stewart
Licensed under the BSD3 license. A copy can be found at:
/usr/share/common-licenses/BSD</pre>
<p>We now rename some files:</p>
<pre>~/dlist-0.1/debian$ mv libghc6-hunit-dev.postinst.in libghc6-dlist-dev.postinst.in
~/dlist-0.1/debian$ mv libghc6-hunit-dev.prerm.in libghc6-dlist-dev.prerm.in</pre>
<p>And that’s all. We don’t have to change anything in those last two files. In file rules we only have to replace Setup.hs for Setup.lhs, but that obviously depends on wether the package comes with a Setup.hs or a Setup.lhs. We now have to run some commands to get our beloved .deb file:</p>
<pre>~/dlist-0.1/debian$ chmod +x rules</pre>
<p>Generate the real control and other files:</p>
<pre>~/dlist-0.1/debian$ cd ..
~/dlist-0.1$ debian/rules update-generated-files
update-haskell-control
ghc5 varfile not found
nhc98 varfile not found
hugs varfile not found
sed "s/@PACKAGE@/`dh_listpackages`/g"
debian/`dh_listpackages`.prerm.in
&gt; debian/`dh_listpackages`.prerm
sed "s/@PACKAGE@/`dh_listpackages`/g"
debian/`dh_listpackages`.postinst.in
&gt; debian/`dh_listpackages`.postinst</pre>
<p>And to build the package:</p>
<pre>$ dpkg-buildpackage -rfakeroot</pre>
<p>That generates a lot of output, and in the end:</p>
<pre>dpkg-deb: building package `libghc6-dlist-dev' in `../libghc6-dlist-dev_0.1-1_i386.deb'.</pre>
<p>We can now try installing it:</p>
<pre>$ sudo dpkg -i libghc6-dlist-dev_0.1-1_i386.deb
Password:
Selecting previously deselected package libghc6-dlist-dev.
(Reading database ... 137227 files and directories currently installed.)
Unpacking libghc6-dlist-dev (from .../libghc6-dlist-dev_0.1-1_i386.deb) ...
Setting up libghc6-dlist-dev (0.1-1) ...
Reading package info from stdin ... done.
Saving old package config file... done.
Writing new package config file... done.</pre>
<p>Let’s check what was installed:</p>
<pre>$ dpkg -L libghc6-dlist-dev
/.
/usr
/usr/bin
/usr/lib
/usr/lib/libghc6-dlist-dev
/usr/lib/libghc6-dlist-dev/unregister.sh
/usr/lib/libghc6-dlist-dev/register.sh
/usr/lib/dlist-0.1
/usr/lib/dlist-0.1/ghc-6.6
/usr/lib/dlist-0.1/ghc-6.6/Data
/usr/lib/dlist-0.1/ghc-6.6/Data/DList.p_hi
/usr/lib/dlist-0.1/ghc-6.6/Data/DList.hi
/usr/lib/dlist-0.1/ghc-6.6/libHSdlist-0.1.a
/usr/lib/dlist-0.1/ghc-6.6/HSdlist-0.1.o
/usr/lib/dlist-0.1/ghc-6.6/libHSdlist-0.1_p.a
/usr/lib/dlist-0.1/ghc-6.6/include
/usr/share
/usr/share/doc
/usr/share/doc/libghc6-dlist-dev
/usr/share/doc/libghc6-dlist-dev/copyright
/usr/share/doc/libghc6-dlist-dev/changelog.Debian.gz</pre>
<p>Very nice. That’s it. The only missing step is letting the people at <a href="http://urchin.earth.li/mailman/listinfo/debian-haskell">Debian Haskell</a> know about it so it may be included in Debian. When people approach a new language they often want to do something with it. When that something is half done in a library, they are more likely to use the language. When that library has a simple and sane build system they are more likely to be able to use the library. When the library is sane and simple, it is more likely to be pre-packaged for different operating systems. When getting a library is such a matter of running a familiar command that is safe and simple, with easy removal and tracking of file, people feel safer and indeed is safer. So, if you follow Don’s advice when making your library you are helping improve the Haskell comunity. I’ve tried many languages and the ultimate test is how easy or hard is getting the libraries in place and working (and wether the libraries exist or not). I see a great potential here in Haskell.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/108/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/108/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=108&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2006/12/12/the-lambda-revolution-episode-v-the-deb-strikes-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Cleaning up a Debian GNU/Linux (or Ubuntu), reprise</title>
		<link>http://pupeno.com/2006/12/12/cleaning-up-a-debian-gnulinux-or-ubuntu-reprise/</link>
		<comments>http://pupeno.com/2006/12/12/cleaning-up-a-debian-gnulinux-or-ubuntu-reprise/#comments</comments>
		<pubDate>Tue, 12 Dec 2006 00:00:07 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://105</guid>
		<description><![CDATA[My little article Cleaning up a Debian GNU/Linux was published at Debian Administration where lot’s of people replied with other ways to achieve the same goals. It was very nice to see all the different approaches with all the different pros and cons. In the end I ended up changing my own approach for one [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=105&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>My little article <a href="/2006/12/08/cleaning-up-a-debian-gnulinux/">Cleaning up a Debian GNU/Linux</a> was <a href="http://www.debian-administration.org/articles/462">published at Debian Administration</a> where lot’s of people replied with other ways to achieve the same goals. It was very nice to see all the different approaches with all the different pros and cons.</p>
<p>In the end I ended up changing my own approach for one that is faster and cleaner so I wanted to share it with you. Still, go to the Debian Administration version of the article and read the comments, they are very cool (thanks to all those who posted!).</p>
<p><span id="more-105"></span></p>
<p>Here’s the approach: I mark all the packages as automatically installed:</p>
<pre>aptitude --schedule-only markauto ~i</pre>
<p>This doesn’t really mark them; if it did, it would also remove them (try dropping the &#8220;–schedule-only&#8221; and you’ll see what I am talking about).</p>
<p>Then I run aptitude in graphical mode, that is, by:</p>
<pre>aptitude</pre>
<p>there I press &#8220;g&#8221; to perform the actions… what actions ? the previously scheduled ones. It’ll mark every single package as automatically installed so it’ll show you a long list of packages to remove (all of them ? it’d be interested to let it run and see where it dies). I read the list, one by one, pressing &#8220;+&#8221; on each one I want to mantain installed. Automatically the dependencies will be marked as not-to-delete (although they’ll remain in auto mode). Once you finish you press &#8220;g&#8221; again and that’s it, it’ll remove all the un-needed packages.</p>
<p>To remove the configurations of those packages no longer needed (you have made backups first… no, it’s not a question) I run:</p>
<pre>aptitude purge ~c</pre>
<p>Thank you to the anonymous poster of this last tip and <a href="http://www.debian-administration.org/users/kevinoid">Kevin Locke</a> for the previous one and let me repeat again: if you are interested in this, go see the <a href="http://www.debian-administration.org/articles/462#comment_1">comments</a>, they are very interesting.</p>
<p>I also mentioned Ubuntu because this works for Ubuntu as well (actually, the last times I’ve used it was on Ubuntu installations). It will also work in other members of the Ubuntu family, like Kubuntu, Edubuntu and Xubuntu as well as other Debian derivate like Mepis.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/105/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/105/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=105&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2006/12/12/cleaning-up-a-debian-gnulinux-or-ubuntu-reprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
		<item>
		<title>Cleaning up a Debian GNU/Linux</title>
		<link>http://pupeno.com/2006/12/08/cleaning-up-a-debian-gnulinux/</link>
		<comments>http://pupeno.com/2006/12/08/cleaning-up-a-debian-gnulinux/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 00:00:01 +0000</pubDate>
		<dc:creator>Pablo</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://101</guid>
		<description><![CDATA[You arrive at a Linux server which has some history of neglect. Let’s suppose someone else neglected it but if your new-year resolution is to stop neglecting your beloved server, this applies as well. One form of neglect is to install, install, install and never un-install any package. The common utility to perform installation and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=101&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You arrive at a <a href="http://linux.org/">Linux</a> server which has some history of neglect. Let’s suppose someone else neglected it but if your new-year resolution is to stop neglecting your beloved server, this applies as well.</p>
<p>One form of neglect is to install, install, install and <em>never un-install</em> any package. The common utility to perform installation and un-installation of packages is apt-get which adds to the problem because it doesn’t have automatic removal of non-needed dependences.</p>
<p>PHP and ton of other packages. phpMyAdmin was removed when it was no longer needed but Apache, PHP and the ton of packages remain there.</p>
<p>Aptitude to the rescue. Aptitude is another package manager front-end like apt-get but it can keep track of automatically and non-automatically installed packages. That means that when you installed phpMyAdmin it was marked as non-auto while Apache and company was marked as auto. When you remove phpMyAdmin all the non-needed automatically installed packages like Apache would be removed.</p>
<p><span id="more-101"></span></p>
<p>That is nice, but since the neglecting previous administrator didn’t use Aptitude, all the packages are marked as non automatically installed. The safe way so Aptitude doesn’t remove anything that it is needed.</p>
<p>So, what to do now ?</p>
<p>Well, the answer is: try to mark all files as automatically installed except those that you really want. To do that you can use the following (which you could write in one line if you want):</p>
<pre>for pkg in $(aptitude search ~i | grep -v "i A" | cut -d " " -f 4) ; do
  echo "-- markauto $pkg --"
  aptitude markauto $pkg
done</pre>
<p>A little explanation about this. This piece:</p>
<pre>aptitude search ~i | grep -v "i A" | cut -d " " -f 4</pre>
<p>you can run it by itself. It list all installed packages, then grep remove all those marked as automatically (we really don’t care about them). The cut part extracts the name of the package.</p>
<p>Once you have the name of each package you print a little header to know what package we are talking about and then try to mark it as automatic with:</p>
<pre>aptitude markauto &lt;pkg name&gt;</pre>
<p>in many cases marking a package as auto will not remove it, because another package depends on it, on other cases it’ll remove the package and maybe some other non-needed packages. In those cases Aptitude will ask you wether you want to continue or not. That is where you’ll have to do your job, analyze wether those packages are needed or not. If they are, tell Aptitude not to perform the operation and the for loop will continue with the next package.</p>
<p>At last, you may also consider removing the configurations of all those removed packages. Before doing this, make backups, that’s very important and I meant it.</p>
<p>To remove the configurations you can use the following code:</p>
<pre>for pkg in $(dpkg -l | grep ^rc | cut -d " " -f 3) ; do
  dpkg -P $pkg ;
done</pre>
<p>At the end you’ll have a system that is a bit cleaner.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pupeno.wordpress.com/101/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pupeno.wordpress.com/101/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pupeno.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pupeno.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pupeno.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pupeno.com&amp;blog=8470507&amp;post=101&amp;subd=pupeno&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pupeno.com/2006/12/08/cleaning-up-a-debian-gnulinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/931970b8dc51b72e05e3a12b88612d61?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">Pablo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
