Archive for the 'Open Source' Category
Funny Ubuntu Error Message of the Day
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/ubuntu/+source/command-not-found
Please include the following information with the report:
No module named CommandNotFound
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 10, in
from CommandNotFound import CommandNotFound
ImportError: No module named CommandNotFound
Python version: 2.5.2 final 0
So the command /usr/lib/command-not-found could not find a required Python module called CommandNotFound, and instead crashed. Well that’s a well-thought out tool.
Faster than a speeding IMAP
In a previous post, I described two methods of moving 10 years of email into GMail.
I now have a newer, MUCH FASTER method, which eliminates having to go into Google and create labels and adjust the account preferences at each import… using nothing but Gmail and Thunderbird.
![]()
![]()
Here’s how:
- Download yourself a shiny new copy of Mozilla Thunderbird and install it.
- Download a copy of the Remove Duplicate Messages add-on and install that, then follow my instructions for removing duplicate emails.
- Add your local IMAP account to Thunderbird, and verify that it works
- Go through your folders and remove any of the duplicate email messages using the add-on above.
- Add your GMail account to Thunderbird. Make sure your GMail account is IMAP enabled in your GMail settings (Settings -> Forwarding and POP/IMAP -> IMAP Access -> Enable IMAP). Verify that you can see your GMail email via Thunderbird.
- Drag your local IMAP folders one-by-one into the Inbox of your GMail account in Thunderbird. Literally drag and drop the FOLDERS into your GMail Inbox. Don’t drag the messages, drag the entire folder.
What you should see, is that you will be creating folders under the Inbox in your GMail account in Thunderbird, and when you log into GMail, you will now see new labels for each IMAP folder you just dragged in there.
For example, if you dragged a folder called “Taxes” into your GMail folder, you will now have a label in GMail’s web interface called ‘INBOX/Taxes’. GMail applies the ‘INBOX’ prefix to the folder name and creates a label with that name.
From here, once you get all of your email into GMail, you can select ‘Edit Labels‘ in the left column of GMail and rename/delete those labels to suit your own personal preferences.
That’s it!
The benefits here are:
- MUCH faster than having Google fetch your email using pop3
- Auto-creates labels for you on the fly. Want a new label? Rename your local folder before you drag it over.
- No need to set up additional accounts inside Google to pull from
- Preserves dates and times of the original messages, including threading
I’ve imported hundreds of emails in the time it has taken me to write this post. Using the other methods, I would get 200 emails pulled over in about an hour. The older methods were S-L-O-W.
Open Source Advocacy on the Amtrak Train
I take the Amtrak train into work 3-5 days a week from Norwich, CT to Manhattan. The ride is a 2.5 hour commute each way (137 miles each direction, 275 miles total). It gives me a lot of “focus time” to work on the train, and the schedule is relatively reliable. I don’t mind it at all. The cost is a bit prohibitive, but that’s all a wash in the “cost of doing business”.
I basically travel the entire length of the state of CT twice a day, almost every weekday.
On the commute, I end up talking to dozens of people who are heading to various places along the East coast. Some are going to Richmond, VA… some are going to Boston, MA, and some are going to New York City as I am. There’s always someone interesting to have a side conversation with, and the Amtrak staff all knows me now from being on the train so often. I end up helping other passengers when the power is out in the cabin (GFCI is hidden at the end of the corridor) or when other things pop up, it’s really not boring at all… (except when the trains are 3 hours late, like they were Monday night. Arg!)
This week, I was in the cafe car working on the ride in, and a gentleman sat next to me with an old’ish Windows laptop, and was trying to copy some fonts from an external drive to his machine, overwriting the ones Windows was reading from C:\Windows\fonts. There were hundreds of them, and he had to confirm each overwrite from the GUI. He was tapping the Enter key for nearly 15 minutes straight until he decided to prop up his phone on the Enter key to hold it down for him, because he was tired of hitting it for each new font to be overwritten.
Being an uber-optimizer, I leaned over and told him that he could do it in a fraction of the time, if he did it from the shell. He didn’t even know what that was, so I walked him through how to open a Command Prompt, cd over to his external drive and copy all of the fonts from there to C:\Windows\fonts. It took about 4 seconds to do all of the fonts in one go.
He then explained that he had some sort of crash, and had to reinstall the operating system from scratch and that he didn’t have all of his programs installed yet. He specifically mentioned how he was behind on his deadlines, because he still couldn’t find and install his copy of Microsoft Office.
Since I always carry a cache of Open Source software for Windows with me in a directory in my code tree, I knew I had a fairly recent copy of OpenOffice.org for Windows in there. I explained to him what OpenOffice.org was, showed him how I was using it on my laptop at the time and said that I could get him a copy right then and there, on the train, so he could get back to working again. I had to answer all of his questions about compatibility and functionality, and he was sold.

I also mentioned that Oo.org supported more file formats than Microsoft office, supported exporting to PDF (which requires an expensive application from Adobe to function within Microsoft Office), and that it also includes a handful of other things you’ll never get from Microsoft Office.
Oh, and it’s 100% free of any cost, of course (but donating to the project is good for the soul!).
I put it on a USB key I had with me, handed it over the aisle to him, he mounted it, copied the installer over, and installed it on his machine.
For the remainder of the ride as I continued to work on my projects, I glanced over and noticed he was not only doing what appeared to be “official work”, but he was also playing around in the features of Oo.org’s interface and applications. I saw him making a mock presentation in ooimpress, playing with the templates and slide layout and some other things.
It’s good to see how easy it is to convince someone of a better, faster, more-intuitive, secure way to function.. And all I was doing was taking the train into work.
IBM/Lenovo Thinkpad tp_smapi patch for Debian and Ubuntu systems
ThinkPad laptops include a proprietary interface called SMAPI BIOS (System Management Application Program Interface) which provides some hardware control functionality that is not accessible by other means.
This driver exposes some features of the SMAPI BIOS through a sysfs interface. It is suitable for newer models, on which SMAPI is invoked through IO port writes. Older models use a different SMAPI interface using “thinkpad” module from the “tpctl” package.
Unfortunately, out of the box it does not build on Ubuntu or Debian systems, because of the way those Linux distributions structure their kernel source and headers in /lib/modules/…/ and /usr/src/…/
It is a simple one-line patch to fix the tp_smapi Makefile to get these package to build on stock Ubuntu/Debian systems:
--- Makefile.orig 2008-03-21 14:07:34.604072067 -0400 +++ Makefile 2008-03-21 14:13:07.669091731 -0400 @@ -3,7 +3,7 @@ X:=$(shell false) KVER := $(shell uname -r) KBASE := /lib/modules/$(KVER) -KSRC := $(KBASE)/source +KSRC := /usr/src/linux-headers-$(KVER)/ KBUILD := $(KBASE)/build MOD_DIR := $(KBASE)/kernel PWD := $(shell pwd)
Basically you need to tell the KSRC variable that the kernel source is in /usr/src/linux-headers-1.2.3-foo/ and not in /lib/modules/1.2.3-foo/source/.
If you want to build tp_smapi with HDAPS support (and you probably do, if you’re on a laptop), then you’d build it as follows:
make load HDAPS=1 make install HDAPS=1
Depending on your particular configuration, you can then put tp_smapi and hdaps in your /etc/modules file to load at boot-time.
I personally use tp_smapi to set the charging and discharging thresholds of my Thinkpad batteries (3 separate Thinkpads at this point; T61p, T42p and X61s).
$ sudo echo 30 > /sys/bus/platform/drivers/smapi/smapi/BAT0/start_charge_thresh $ sudo echo 90 > /sys/bus/platform/drivers/smapi/smapi/BAT0/stop_charge_thresh
The values above tell tp_smapi to begin charging the battery when it reaches BELOW 30% of its total capacity, and to stop charging the battery when it reaches ABOVE 90% of its total capacity.
There’s a lot of other things to play with in here, and here is a table showing some of those options, courtesy of ThinkWiki.
Here’s what my battery details are on the T61p as I type this:
$ cat /proc/acpi/battery/BAT0/info present: yes design capacity: 84240 mWh last full capacity: 86790 mWh battery technology: rechargeable design voltage: 10800 mV design capacity warning: 4339 mWh design capacity low: 200 mWh capacity granularity 1: 1 mWh capacity granularity 2: 1 mWh model number: 42T4511 serial number: 21169 battery type: LION OEM info: SANYO
Building TrueCrypt 5.0a on Linux
The new TrueCrypt 5.0/5.0a was recently released, and because I’ve had to make a [few] [previous] [posts] on how to patch it to build and run cleanly on Linux, I thought it only appropriate that I follow that trend here with version 5.0a.
Here are some of the new features in TrueCrypt 5.0/5.0a:
- Ability to encrypt a system partition/drive (i.e. a partition/drive where Windows is installed) with pre-boot authentication (anyone who wants to gain access and use the system, read and write files, etc., needs to enter the correct password each time before the system starts). (Windows Vista/XP/2003)
- Pipelined operations increasing read/write speed by up to 100% (Windows)
- Mac OS X version
- Graphical user interface for the Linux version of TrueCrypt
- The TrueCrypt Volume Creation Wizard now allows creation of hidden volumes within NTFS volumes. (Windows)
- XTS mode of operation, which was designed by Phillip Rogaway in 2003 and which was recently approved as the IEEE 1619 standard for cryptographic protection of data on block-oriented storage devices. XTS is faster and more secure than LRW mode (for more information on XTS mode, see the section Modes of Operation in the documentation). Note: New volumes created by this version of TrueCrypt can be encrypted only in XTS mode. However, volumes created by previous versions of TrueCrypt can still be mounted using this version of TrueCrypt.
- SHA-512 hash algorithm (replacing SHA-1, which is no longer available when creating new volumes). Note: To re-encrypt the header of an existing volume with a header key derived using HMAC-SHA-512 (PRF), select ‘Volumes’ > ‘Set Header Key Derivation Algorithm’.
To build this to run on Linux, you will need two things:
- Download the tarball version of the 5.0a source
- Download the latest stable wxWidgets library (wxAll in that list)
This version requires a little more than the previous versions, because it now includes a fully-graphical UI like the Windows version has for quite some time. If you simply enter the ./truecrypt-5.0a-source directory and try to build it with ‘make’, you’ll get the following errors:
Compiling CoreLinux.cpp
Updating library Core.a
make[1]: /src/compiling/truecrypt-5.0a-source/wxrelease/wx-config: Command not found
make[1]: /src/compiling/truecrypt-5.0a-source/wxrelease/wx-config: Command not found
Precompiling SystemPrecompiled.h
In file included from /usr/include/wx/platform.h:88,
from /usr/include/wx/defs.h:19,
from /usr/include/wx/wx.h:15,
from SystemPrecompiled.h:9:
/usr/include/wx/chkconf.h:47:9: error: #error "wxUSE_DYNLIB_CLASS must be defined."
/usr/include/wx/chkconf.h:55:9: error: #error "wxUSE_FILESYSTEM must be defined."
/usr/include/wx/chkconf.h:68:9: error: #error "wxUSE_DYNAMIC_LOADER must be defined."
....
This is because the required ./wxrelease subdirectory is not built or prepared. Steps to building this correctly are as follows:
- Unpack the wxWidgets source tree into some local directory. I put mine in
/src/compiling/, but your own path may vary. The version used at the time I’m writing this post, is version 2.8.7 (direct download link from SourceForge). This will create a tree named./wxWidgets-2.8.7. - Unpack the TrueCrypt 5.0a source into another directory. This will create a tree named
./truecrypt-5.0a-source. - Change into the ./truecrypt-5.0a-source directory and run the following:
WX_ROOT=/src/compiling/wxWidgets-2.8.7 make wxbuild
You will see the following output:Configuring wxWidgets library... Building wxWidgets library...
This will build the./wxreleasesubdirectory of the./truecrypt-5.0a-sourcesource tree. You’ll get the following warning, which you can safely ignore:./wxWidgets-2.8.7/src/gtk/gsockgtk.cpp:134: warning: ‘wxDummyGsockVar’ defined but not used
- Now run the following:
WX_ROOT=/src/compiling/wxWidgets-2.8.7 make
As you build this, you’ll see the following warning:Compiling PlatformTest.cpp PlatformTest.cpp: In static member function ‘static bool TrueCrypt::PlatformTest::TestAll()’: PlatformTest.cpp:243: warning: unused variable ‘finally243’
And these:TextUserInterface.cpp:70: warning: unused variable ‘finally70’
TextUserInterface.cpp:297: warning: unused variable ‘finally297’
Unix/Main.cpp:55: warning: unused variable ‘finally55’
You can safely ignore this and similar warnings. They are simply internal self-tests, which checks the line of source code in that file, as follows:// finally TestFlag = false; { finally_do ({ TestFlag = true; }); if (TestFlag) throw TestFailed (SRC_POS); } if (!TestFlag) throw TestFailed (SRC_POS); TestFlag = false;
That’s it. Now you should have a truecrypt binary in ./truecrypt-5.0a-source/Main which includes full graphical capability.
Main/truecrypt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped
If everything builds clean, the new TrueCrypt 5.0a GUI will look like this:
