SOLVED: HOWTO mount an external, encrypted LUKS volume under Linux
Tags: Debian, Encryption, linux, LUKS, UbuntuMy daughter recently dropped my computer flat on the floor from a standing height (she’s only 5), catastrophically crashing both hard drives in the laptop. I limped along for a few days because I had to function with it for work, and only just today, decided to rip it apart, back up the data that could be read, put in two new 500GB/7200 drives and reinstall everything from scratch.
The painful part, was that my original configuration was a dm-crypted LUKS volume inside an encrypted LVM container, and mounting the volume without booting to it, is not straightforward.
The first piece was to back up the data on it, as best as I could. That was a bit trickier than I’d originally assumed, because I had to be sure I wasn’t going to “fix” the area of the drive that contained the encryption key that unlocked the encrypted LVM container.
After booting in single-user mode and putting in my passphrase to unlock the volume, I ran:
Read the rest of this entry »
IBM/Lenovo Thinkpad tp_smapi patch for Debian and Ubuntu systems
Tags: Battery, Debian, IBM, linux, Thinkpad, UbuntuThinkPad 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