Tagged with deb

Prey anti-theft on Debian

Anti-theft solution

Prey is an open source anti-theft solution. I decided to install it on my laptop so I could track it in case I lost it or it was stolen.

Prey is scheduled to "call home" to check the status of the device it's protecting. If it finds out the device went missing, it build a report with useful information to track down the device and tries to send it to the user. It can do the check and send the report via the Prey Control Panel (simple to setup) or you can run it in standalone mode which offers more options. I used the simple setup to find out if and how it works.

Installation

Version 0.5.3 is currently in the Debian repositories, which is easy to install (apt-get install prey) but after a few hours of trying, I couldn't get it to do anything useful: Prey noticed when my laptop was missing and created and sent the reports but they never arrived.

A post on Prey's anwers list recommended to upgrade to version 0.5.9 to get things working. I decided to install the latest version, which was 0.6.0. There's .deb for Ubuntu that I tried first on Debian Jessie/Sid, but long story short: it didn't work. Instead, I downloaded the universal .zip for Linux and made a .deb from it, the quick and dirty way.

Because it was built the quick and dirty way, Prey was complaining about a missing cronjob and configuration file.

The cronjob was in /etc/cron.d/prey when Prey expected it to be in root's list of crons. I copied the lines from /etc/cron.d/prey to crontab -e -u root and then rm'ed /etc/cron.d/prey. I changed the frequency to every 5 minutes.

Prey looked for the configuration file in /usr/lib/prey/config, which I solved by symlinking /etc/prey/config there: ln -sv /etc/prey/config /usr/lib/prey/config.

Like I said: a very quick and dirty packaging.

Configuration

To use Prey, you need to register an account. Once you've done that, log in and you will find your API key in the Account page. This key goes in your configuration file on the api_key= line. When you've set that, you can run Prey in test mode where it will check its status and generate a device key. It will immediately add the device key to the config file as well. Some moments later, your device will appear in Prey's Control Panel.

In Prey's Control Panel you can set the information you want gathered in the Devices tab. I deselected all the actions to perform on the right to keep Prey inconspicuous to a possible thief.

Testing

Set your device's status to Missing and wait for the cronjob to kick in. You should be getting a report with some very useful information a few minutes later. I checked and even when I didn't have X running, I got a nice report with a webcam picture.

Don't forget to set the status back to normal when you've verified that everything works: the free Prey account only has space for 10 reports.

Sources

Tagged , , ,

FIXED: No sound from Thinkpad T430 when docked

Update (31/Jan/2013)

As of kernel 3.6.9 in Debian (experimental), the patch is included by default so this procedure is now obsolete. Save yourself a lot of trouble and simply install linux-image-3.7-trunk. ;)

</update>

My T430's speaker got muted as soon as I docked it in its Mini Dock Plus Series 3. Luckily a patch has been posted to the Linux' mailing list.

Here's a quick guide to get sound from the dock by patching the Linux kernel and building Debian packages for the patched kernel and for the proprietary nVidia module.

Get the latest kernel from kernel.org. I used version 3.6.4, released on 28 October 2012. Download it to /usr/src.

Extract the kernel's tarball in /usr/src, it will create a directory linux-3.6.4:

tar xf linux-3.6.4.tar.bz2

Create a symbolic link to /usr/src/linux for linux-3.6.4:

ln -sv /usr/src/linux-3.6.4 /usr/src/linux

chown the /usr/src directory to your normal user. This way you can build packages without having to be root.

chown -R youruser /usr/src

Install the nVidia kernel source. I installed version 304.60 from the unstable repo.

aptitude -t unstable install nvidia-kernel-source

Extract the nVidia kernel tarball, it was installed under /usr/src.

tar xf /usr/src/nvidia-kernel-source.tar.bz2

Configure your kernel manually (make menuconfig) or copy a config you already have (e.g. /boot/config-3.2.0-3-amd64) and run make oldconfig to set all the new options that have been introduced since v3.2.0.

Get the patch to get sound from the docking station: : https://lkml.org/lkml/2012/10/19/320. I just added the missing line manually to sound/pci/hda/patch_realtek.c: change the file from

SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),

to

SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),

Now use make-kpkg to build the kernel, the modules, an initial ramdisk, the kernel header files and the nVidia kernel module in one swift command:

make-kpkg --revision 3.6.4 --append-to-version -2-bgd -j4 --initrd kernel_image kernel_headers modules_image

See make-kpkg's manpage for more info on the parameters and switches to the above command.

Find your new packages in /usr/src:

  • linux-headers-3.6.4-2-bgd_3.6.4_amd64.deb
  • linux-image-3.6.4-2-bgd_3.6.4_amd64.deb
  • nvidia-kernel-3.6.4-2-bgd_304.60-1+3.6.4_amd64.deb

Install your patched kernel, headers and nVidia module:

dpkg -i linux-headers-3.6.4-2-bgd_3.6.4_amd64.deb linux-image-3.6.4-2-bgd_3.6.4_amd64.deb nvidia-kernel-3.6.4-2-bgd_304.60-1+3.6.4_amd64.deb

Reboot and enjoy sound from the dock!

Update

When I installed the 3 .deb files above, I still had the nVidia packages from Debian unstable installed as well. This was not a good idea: after a few weeks a new nVidia driver was available (v304.64), and it got installed with aptitude safe-upgrade. It clashed with my custom package to the extent where X would not show an image anymore. I ended up with hundreds of Xorg.[0-999].log files in /var/log too.

I fixed this by removing all official Debian packages for nVidia, and reinstalling my own custom package.

Source: Debian Wiki - NvidiaGraphicsDrivers

Tagged , , , , ,