What it does is simple. Should your machine be stolen, if the thief logs in (this is the only pitfall, in my opinion) the program will automatically email you a load of details every few minutes. These include its IP address, wi-fi network name, screenshots and – if you have a webcam attached – a picture from it. With luck that may even capture the thief.
How does the machine know it’s stolen and not being used by the real user? When it fires up, Prey checks for the existance of a web page. Any web page, it’s customisable. I’ve told it to look for a page on my blog called “stolen”, so should I find my laptop’s gone walkies then I create that page on my blog. If the page exists then Prey starts emailing details.
It’s only on v0.2 so it’s pretty much beta but it works as far as I can test it under Ubuntu. I’ve not installed it on XP or Win7 as yet. The only thing that’s not clear about the Ubuntu version is how to change the configuration once it’s installed – there’s no menu item or command to run. Go to the directory where you’ve installed it (default is /usr/share/prey) and edit the “config” file with your choice of text editor. It’s well-commented.
As I mentioned above, Prey will only trigger once a user has logged in. As it’s installed as root and runs under root’s crontab (or in the case of Windows as a system process) it will execute no matter what user logs in. Of course, if you have only password-protected accounts then a lot of people will just shrug their shoulders, format it and sell it on.
Hidden in the config file is what looks like a feature that’s not yet implemented – to create a dummy “guest” account with no password that will lure a thief into having a snoop and therefore giving Prey a chance to execute. Of course, you could to this manually. Prey will automatically attempt to locate the nearest publicly-accessible wi-fi connection should it be activated in a bid to get that information out to you.
It’s a teeny program, may or may not help… but for the effort it takes to install it I reckon it’s worthwhile. Of course, I’d also recommend opening the machine up and scrawling your postcode in indelible marker or UV pen somewhere as well. And registering the serial number with Immobilise (or Immobilise in the US).
Just a quickie. I’ve found an error message that may be a little confusing in Ubuntu. I may raise it as a bug, in fact.
I was trying to copy the Windows 7 DVD ISO file from my hard drive to a 4Gb USB stick. The stick was empty with roughly 3.7Gb of space free, and the ISO file is 2.4Gb in size. Normally, if you try to copy too large a file in Ubuntu, it tells you at the start to save you time. On this occasion, the copy began and trundled along until an error appeared telling me that the file was too big after around three minutes.
The problem is that the stick was formatted in FAT16 – which has a file size limit of 2Gb or thereabouts. A quick reformat to FAT32 and the copy worked fine.
A simple little thing, but one that did puzzle me for a few minutes until something clicked.
My laptop’s more responsive and web pages seem to render so much quicker now. YouTube videos don’t stutter. Scrolling is smooth. All great.
Have I installed Windows 7? Nope, I’m just messing in XP.
I can’t believe how badly upgrading to Jaunty Jackelope has crippled my Ubuntu install. With the exception of the time taken to get to a useable desktop, Ubuntu on the whole is now slower in use than Windows – predominantly as I spend a lot of my time within a web browser.
The only real issue I have with XP right now, aside from the above, is that for some reason it just won’t connect wirelessly to our new router. This, obviously, is a bit of a bummer. I’ve had issues getting it to connect to some wifi signals while I’ve been travelling, to be fair. Ubuntu works with some, Windows with some, both with some. Sod’s law we get a router my XP install won’t work with. Strange as my dad’s laptop connects fine. I guess it’s driver/hardware-related.
Still. I can’t get over how smooth XP feels compared to Ubuntu. That’s just wrong. Example: I’m typing in a box on my WordPress install to post this blog entry. Under Ubuntu if I hit “backspace“, it pauses. If I hold the key down, I can expect a pause of a few seconds before I gain control of my machine again with a random chunk of characters deleted. Under XP it’s realtime. I hold “backspace” and I watch the characters being gobbled up.
I’ve been randomly offline a lot over the last few days. Partially because I’ve been visiting friends and family, partially as I’ve been migrating hard drives in my laptop. Again.
Currently I run Windows XP and UbuntuJaunty Jackalope (9.04) – predominantly the latter, though I keep the former around for a couple of utilities and for checking things when I’m doing support. I’ve also decided I want to install the Windows 7 release candidate I downloaded. However, disc space wouldn’t let me do that without ditching one of the other OS‘s so I turned to Amazon and ordered a 160Gb ATA drive (the largest available in 2.5″ format, I think) and an external caddy into which to place the soon-to-be-spare 120Gb device.
The procedure should be simple with the right tools:
Use some partition software to increase the size of data partition, leaving space for Windows 7 install
Remove 120Gb and swap it with the 160Gb which becomes my internal drive
Of course, these are computers. So it wasn’t going to go smoothly. Especially with the mixed operating systems.
First up, the hard drive enclosure I bought didn’t seem to like the 160Gb drive. If I connected it under Ubuntu, it detected it fine. Windows, however, did not. It “bing”ed to say a USB device had been attached, then never let me see it. Not even through Disk Manager so it wasn’t the fact that it was empty. I couldn’t even create a partition. If I rebooted the machine while the device was attached, the reboot stalled on the BIOS screen.
I disassembled another enclosure I have and tried that with more success. Reboots were fine and the drive was detected under both OSs. Hopefully the new enclosure would have more success with the older 120Gb drive I was soon to have spare.
Next step was to mirror the drive. I tried Paragon Partition Manager’s imaging (which has worked for me in the past), but it kept getting partway through and then rebooting with only a fraction of the drive copied. I began to worry about the new disc, but an attempted surface scan looked like taking 24 hours+.
Instead, I downloaded the (simple and free) Easus Disk Copy program. Burn the ISO onto a CD, reboot with the disc in the drive and away you go.
Slowly. Very slowly indeed.
The initial estimated time was around an hour. The copy eventually took a smidgen under 21 hours.
I had planned on using GParted to shift the partitions around, but it seems it’s not capable of doing this. What I needed to do was to alot roughly half of the increased 40Gb to my FAT32 data partition and leave the rest unallocated so that Win7 could use this when I installed it. So, back into XP and Partition Manager Pro for this task.
Before the repartitioning would complete, I had to run checkdisk on the two FAT32 source drives. On my copy run, it had to come up with read errors. In all, there were 200 and PMP would not continue until these were cleared.
So off I went to play Lego Batman and Guitar Here while the checks and the data migration occured. Finally I had a hard disc with everything organised as required. Phew.
Out with the old, in with the new, reboot… and a screen full of flickering “GRUB“s. No boot menu, no progress. Ah. By moving all the partitions around, I’d shafted GRUB. And possibly the MBR on the boot drive. Here’s where it got technical.
Step one was to repair the MBR and this is where having a bootable CD/DVD with your operating system on is very useful. Laptop manufacturers can burn in Hell if they don’t supply these. If you don’t have one, download it via a Torrent. You’ve paid for a license, there’s nothing wrong in having a copied disc with the software on in case you need to fix it.
Quickly boot off the Windows CD, go to the recovery console, boot into the Windows install on the C: and run one command:
It takes less than a second and on reboot, the PC went right into Windows. A step forward, but still no GRUB so I couldn’t access Ubuntu. Out with the 8.10 CD that I have kicking around, and into a Live session. With a terminal open, the commands to fix things weren’t too hard (thankfully).
Well, it would have been nice if it were that simple. First of all, finding the correct partition to use in “root” takes a little digging.
As I’d jiggled things around, what had been (0,4) in my old setup had been changed to (0,5) – this can be discovered by running the command:
sudo fdisk -lu
Assuming you only have one Linux install, only one of these will be labelled “Linux”. Take the number “x” from the left column “/dev/sdax”.
That gave me (0,5) as I used. However, I then got an “Error 12: Invalid device requested” when running the “setup” command. A lot of digging online got me a solution to this. First “quit” out of the grub program to the command prompt again. Then:
sudo fdisk /dev/sda
At the prompt that comes up, enter “w” (no quotes) and hit return. Then repeat the grub commands listed above.
sudo gedit /dev/sda/boot/grub/menu.lst
And ensure all the menu entries are correct. As I said, I had to change all my (0,4)s to (0,5)s.
Save, reboot, clap with glee.
Next step is to install Win7, which is tomorrow’s little job. I fully expect to have to repair GRUB again afterwards. Windows (all versions) has a habit of deciding that all other boot loaders are “wrong” and places itself before them. At least I’m expecting it!
This is a post mainly to remind myself how to do something that I discovered after a bit of a dig, but it may come in useful for anyone with a repetitive task to do under Linux.
What I had was a flat set of directories, each with a number of files in. What I wanted to do was to go through these and, where the contents were jpegs, archive them into a zip file and erase the jpegs. Then move the resultant zip file up a level into the parent directory and erase the resulting empty one.
I managed to work out a fairly simple solution, although with one failing – it doesn’t take into account directories which didn’t have jpegs in. What I did was move those which contained non-jpegs (there were no mixtures, in this instance – directories were either 100% jpeg or 100% not) into another folder for safe keeping before I ran the routine. This means I could keep the command as simple as possible.
Do note, though, that I specified “rm *.jpg” rather than moving the zip and deleting the directory contents. Just in case I was wrong and a directory had a non-jpeg in it, I specified jpeg deletion. That way, if something else random was in there I could easily see when the directory couldn’t be deleted. If necessary I could then manually edit the resultant zip file and remove the offending item before manually erasing the directory.
Having said that, it wouldn’t have been dangerous to run it as-is without moving them. The command would simply have created archives I didn’t want, failed to have erased the non-existent jpegs, and therefore not have been able to erase the directories in question. “rmdir” cannot erase a non-empty directory without specific qualifiers (-rf, for instance) so the remaining data would have been safe. And I could simply have deleted the unwanted zips. However, as they were often from folders full of large movie files, this would have slowed down the whole process a lot and also have caused possible hard drive capacity issues.
The resultant command was as follows:
for dir in *;do (cd "$dir"; tar -c -z -f "$dir".zip *; rm *.jpg; mv * ..; cd ..; rmdir "$dir"); done
Note that this can also be re-written as a script. Simply line-break it where it makes sense and ditch the semi-colons. Of course, it can also be used as th ebasis for anything else that involves whipping through a flat directory structure.
Before some UNIX guru tells me my solution is inelegant and nasty, I know you’re probably right. But it did what I need and I’m not an expert! By all means, furnish me with something more professional – I’m always happy to learn.