Technical miscellanea by D Coetzee

iTunes not starting when network drives hang

Recently I discovered iTunes was not starting up on my Windows 7 machine. I was pretty mystified – it worked with my other user account, yet even after I closed all applications and stopped services, and reinstalled all Apple applicaitons, I still had the same problem on my primary user account. I eventually noticed that when I unplugged my network, it started working! I investigated further with Wireshark to determine what iTunes was doing on the network to make it hang and found this:

19 1.947615 192.168.2.105 192.168.2.119 SMB 302 Session Setup AndX Request, User: dcoetzee-dv8t\dcoetzee; Tree Connect AndX, Path: \\192.168.2.119\RAID

Sure enough, my FreeNAS RAID had gotten itself into a bad state and was hanging whenever an attempt was made to contact it over SMB/Windows File Sharing. Apparently unbeknownst to me, iTunes scans mapped network drives at startup. I rebooted the RAID and the problem went away.

How to use a web proxy auto-config (PAC) on Android (no rooting required)

My university, University of California, Berkeley (UC Berkeley), provides access to the library journal subscriptions through a web proxy auto-config (PAC). This is a trivial setting on desktop platforms and on iOS, but on Android, there is no UI to access the native support in the OS for web proxies, and modifying it requires you to root your device. Even after rooting it, existing applications like ProxyDroid have limited and problematic support for PAC.

The solution turns out to be pretty simple: use Firefox, and modify its advanced settings. To do so:

  1. Install Firefox from Google Play.
  2. Start it and visit the URL “about:config” in a new tab.
  3. Enter “proxy” as your settings search term and search.
  4. Modify “network.proxy.autoconfig_url” to be your PAC URL.
  5. Modify “network.proxy.type” to be “2″.
  6. You’re now using your proxy. When opening URLs in other applications, such as Gmail, you should get a choice to open the URL in Firefox.

If you’re attached to Chrome, I’m afraid there’s no known way at the moment to use a PAC in Chrome, but you can just switch to Firefox on the occasions you need to use the proxy, and use Chrome the rest of the time.

HP dv8t runs slow on battery power on Windows 7

With my HP dv8t on Windows 7, whenever I took it off AC and put it on battery when it was in the default “Balanced” power mode, it would immediately become so slow as to be unusable, with UI latency in the range of seconds to minutes. I suspect this is the reason: by default, in “Balanced” power mode, Windows 7 will use passive cooling on battery, meaning it slows your CPU down to cool it instead of turning on the fan. In the HP dv8t this doesn’t work very well, as the CPU runs quite hot and will tend to get scaled down to the minimum frequency, especially if you’ve recently been using it on AC power. Instead, it’s better to use active cooling all the time. To do so, follow these steps:

  1. Open Control Panel.
  2. Click System and Security -> Power Options. Next to “Balanced”, click “Change plan settings”.
  3. Click “Changed advanced power settings”.
  4. Under “Processor power management” -> “System cooling policy” -> “On battery”, set from “Passive” to “Active”.

This should resolve the issue. This also shouldn’t cost a lot of battery life, because the CPU still scales down whenever it’s idle, as long as the “Minimum processor state” is left at 5% – it should be much more efficient than the “High performance” power state.

Full disk encryption for both Windows and Ubuntu on a dual-boot drive

I recently set up a dual-boot system with Windows 7 Professional and Ubuntu 11.10, both  64-bit, and I was looking to get full disk encryption for both of them, including the swap and hibernation files. It turns out that this is not too difficult, but does require a careful order of operations to get the desired result. The solution below results in all of the Windows volume being encrypted, and all Ubuntu partitions except for the boot partition.

Prelude and cleaning drive

I recommend downloading the latest service pack for your version of Windows on another system while you do the rest of this – then you’ll be able to install it quickly once you’re done. Windows 7 SP1 is downloadable as an ISO.

Similarly, if you have another Ubuntu machine, you may wish to update it to the most recent packages during your install, then copy the packages over later.

In this tutorial I’m describing how to build a fresh installation, so first back up any important data on the drive. If your existing drive had any sensitive data on it, use a third-party tool like CMRR’s Secure Erase to do a secure wipe of it. Even if it doesn’t contain sensitive information, if it is an SSD, a secure wipe may be needed if your Windows install freezes unexpectedly.

Install Windows

In the Windows installer choose the option to manually partition the disk. Delete any existing partitions and then create a new one, leaving enough space for your desired Ubuntu partitions. Windows will automatically create a small system partition. Proceed with the rest of the install normally.

Install Ubuntu

The easiest way to get full disk encryption with Ubuntu is using the alternate installer CD, which includes partition encryption options. Follow this guide (“Installing Ubuntu 8.04 with full disk encryption”, yungchin, Learning in Linux) to set it up with encryption for your root partition and swap (it still works in Ubuntu 11.10). This method of encryption covers everything but the boot partition and supports hibernation and resume from an encrypted swap partition, unlike some other methods. When asked to install the bootloader, install it to the MBR.

Test booting into Ubuntu. You should be asked for your passphrase during boot. In my case, I had to boot in recovery mode first to install the restricted NVIDIA drivers, and then could reboot and boot in normal mode. You can also test hibernation and resume under Linux now.

Install Grub into boot partition

This is the trickiest bit – and I’m not even totally sure it’s necessary (because TrueCrypt may chain the old MBR when it’s installed, I’m just not sure).

Boot into Ubuntu. Find your boot partition device with “df”. Install grub into it with: sudo grub-setup –force (your boot partition device, e.g. /dev/sda3) (note: make sure to use grub-setup, not grub-install)

If you did not install grub into the MBR during setup, you’ll get an error saying that /boot/grub/core.img does not exist. You can create it with this command: grub-install –grub-setup=/bin/true /dev/sda (or whatever your boot device is). This will not actually write to the MBR, but will create core.img. Then try grub-setup as above.

TrueCrypt

Reboot into Windows, download the latest version of TrueCrypt, install it, and then open TrueCrypt and do System->Encrypt System Partition/Drive. This will encrypt your entire system partition including your swap and hibernation files, your users directory, and so on. Select to encrypt only the system partition. It will ask if you are multibooting (say yes) and if you have another bootloader loaded into the MBR (lie and say no). You do not need to erase the drive, since it has no private data on it yet.

It will then create a recovery disc and do a test reboot. During the test reboot, make sure you can still boot into Ubuntu normally by pressing ESC, selecting Linux from the grub menu, and entering your passphrase. Reboot, enter your TrueCrypt passphrase, and if the grub menu appears, select your Windows OS. TrueCrypt should verify that the test boot succeeded, and give you the option to being encrypting the drive. Let the drive encryption complete before proceeding (since any disk activity will slow it down). If you downloaded SP1, you may install Virtual CloneDrive while you’re waiting.

You now have Windows and Linux with full disk encryption on a single drive!

Install updates on Windows and Linux

On Windows, use Virtual CloneDrive to mount the Service Pack downloaded earlier and install it. You will have to temporarily set the boot volume created by Windows, a small volume of size 100 MB, to be the active partition in Disk Management (under Control Panel->Administrative tools->Computer Management) in order to install SP1.

Then retrieve any additional updates from Windows Update.

On Linux, install Synaptic and use its Settings->Repositories->Download from->Other->Select Best Server to choose a good package server. Then use the update manager or “sudo apt-get update && sudo apt-get upgrade” to upgrade to the latest versions of packages. You can also do “sudo apt-get dist-upgrade” to upgrade your kernel.

Is not encrypting the boot partition okay?

Most of us don’t keep any kind of secrets in the boot partition, so the only reason to encrypt it would be to make tampering more difficult. However, this isn’t really what encryption is designed for – encryption is not authentication. Moreover, while someone could capture your passphrase by tampering with your boot files, if they had physical access anyway, they could just replace the MBR and capture it anyway. It’s still essential to ensure that you don’t leave your device unattended in a place others can access it.

Cold boot attacks

The primary reason that I wanted so badly to get hibernation working properly in both OSs with a fully encrypted hibernation file is that hibernation and shutting down are essentially the only viable defenses against cold-boot attacks, an attack on disk encryption in which a person with physical access to your machine extracts and reads the contents of your memory modules before the information has faded, including your encryption keys. You should always hibernate your machine if you are leaving it unattended, especially for a long period of time or in an easily-accessible area.

Expanding an Ubuntu EC2 root volume

I have a VM on EC2 running Ubuntu 11.10 (which hosts this very blog). I was running out of space in my initial 8 GB and decided to expand to 20 GB. It took me a while to figure out how to do this, but it’s actually quite straightforward.

  1. Create a new volume of the desired size.
  2. Launch another instance (ideally the same distro/version as the server you’re expanding, but doesn’t really matter). This server will be used to migrate the data from the old disk to the new disk.
  3. Attach the new volume to the migration server as /dev/sdf and boot it up. Connect to it via SSH. Format the new volume (e.g. with “mkext4 /dev/sdf”), and mount it with “mkdir /mnt/new; mount /dev/sdf /mnt/new”.
  4. Stop the instance that you want to expand the root volume for. Detach its volume. To be safe, take a snapshot at this point for backup purposes. Attach it to the migration server as /dev/sdg, and then mount it with “mkdir /mnt/old; mount /dev/sdg /mnt/old”.
  5. Do: “cd /mnt/old; cp -a . /mnt/new”. The “-a” switch preserves all file attributes including owner, mode, etc. You can monitor progress easily with “df -h”.
  6. Dismount the new volume. Run this command to mark the new volume as a valid root volume: e2label /dev/sdf uec-rootfs
  7. Stop the migration server. Detach the new volume from the migration server, and attach it to the original server as “/dev/sda1″ (it suggests /dev/sdf, etc. but you can type “/dev/sda1″ in directly).
  8. Start up the original server. Make sure to reassociate the public IP if necessary.

And now I have 60% space free! Let me know if you have trouble with this or need extra steps to get it working in your environment.

Using Eclipse’s EGit with GitHub

Although most people seem to rely on the command-line git client, I recently tried to get Eclipse integration for Git going in order to help someone out who was not so command-line savvy. But I want them to also be able to store their public repositories on GitHub easily. So I figured out how to go about this on Ubuntu 11.10, using the standard version of Eclipse, currently version 3.7.0, and installed version 1.3.0 of EGit. I relied on the Getting Started and Pushing a Local Project to GitHub parts of the EGit user guide.

Plugin installation:

  1. Open Eclipse. Make sure it is either installed in your home directory (user directory on Windows) or that you are running as root/administrator.
  2. I read claims that EGit comes with version 3.7.0, but it didn’t come with mine. To see if yours has it, go to Help->About and choose “Installation Details”. If you see “Eclipse EGit”, it is already installed.
  3. Go to Help->Install new software. Enter the EGit plugin update URL http://download.eclipse.org/egit/updates and hit “Add…” Enter EGit for the name. Click OK.
  4. Open up the items provided and check “Eclipse EGit”, “EGit Project Set Support”, and “Eclipse JGit”. Don’t check the remaining items.
  5. Click Next. Continue clicking Next until the install is complete, then Finish.
  6. Close Eclipse and re-open it as your normal user.

Setting up keys (must be done only once per user)

  1. Go to Window->Preferences. Select General->Network connections->SSH2.
  2. If you have already generated a key pair for use with Github, skip to step 4. Otherwise, go to the Key management tab and select Generate RSA Key. Then click Save Private Key to save the private key file, which you will use in step 3. Copy the public key. If you wish to use an existing key pair you generated in the past, instead click Load Existing Key, then copy the public key.
  3. Go to Github, log in, click your username in the upper-right, click the “Edit your profile” button, click SSH keys, click Add SSH key, and paste in the public key from step 2.
  4. Go back to the Eclipse SSH2 preferences. Select the General tab. Click Browse and select the directory where your private key is stored. Enter its filename in the “Private keys” field.

Putting a new/existing project into a new GitHub repository

  1. Go to Github. Click your username in the upper-right. Click New repository.
  2. Fill out the fields and click “Create repository”. You will be given an information screen. You’ll need to refer back to this screen.
  3. Go to Eclipse. Create/open the project.
  4. Right-click the project in the Package Explorer pane and select Team->Share Project. Select Git. Click Next.
  5. Click “Create”. Enter a name (the same name as your GitHub repository is fine). Click OK. Click Finish. Your project should now say next to it “NO-HEAD”.
  6. Right-click your project, choose Team->Commit. The name should be the name you wish your check-ins to be attributed to, and the e-mail should match the one given on Github’s information page from step 2 (after user.email).
  7. Check all the files you want to commit – you should usually include at least any source files, “.classpath”, and “.project”. Enter a commit message. Click OK.
  8. Right-click your project, choose Team->Remote->Push. On Github’s information page from step 2, find the line that looks like “git remote add origin git@github.com:username/Blah.git” and copy the part after “origin”. Put it in the “URI” field.
  9. For Protocol select SSH. Change nothing else. Click Next. If you are asked to accept Github’s host key, click Yes.
  10. For Source ref select from the dropdown “master [branch]“. Destination ref will fill in with the same. Click “Add all branches spec”. Click Finish.
  11. Refresh the information screen on Github to verify your check-in completed successfully.

Importing an existing GitHub repository

  1. Choose File->Import. Select Git->Projects from Git. Click Next.
  2. Choose URI. Click Next.
  3. On the GitHub project’s page, click “SSH” (selected by default), then copy the full URI (starting with git@…). Make sure it says “Read+Write access” to the right of it.
  4. Enter the URI in Eclipse. Select SSH for protocol. Click Next.
  5. Select the branches you want (usually only one, master, will be offered and will be automatically selected). Click Next.
  6. Select where the local files and git metadata will be stored. The default should be fine. Click Next.
  7. If it is an Eclipse project previously added using EGit, choose Import existing project. Otherwise choose one of the other options.
  8. Click Next. Click Finish.

Once you’ve gotten your project set up, try right-clicking on source files and messing around with the options under “Team” to see what they do. “Show in history” is particularly useful, opening the history view which allows you to explore previous versions of files. If you do Team->Commit, it should automatically select previously committed files that have changes, but new files have to be checked to add them.

You can use the “Compare with” menu to view changes to your file over time; “Compare with HEAD revision” shows changes since your last commit. Compare views dynamically update as you make modifications.

Flickr geofences and EXIF metadata

Flickr recently implemented geofences, a simple but neat mechanism to hide locations of photos taken near your home, your kid’s school, or any other place whose location you consider private. You set the center point, radius, and who should be able to see locations of those photos.

There is one enormous problem with this: if your Flickr is set up to allow downloads of original images, those original images are unprocessed/unmodified and contain any EXIF data that was in the original file. If your camera automatically inserts location information using a GPS, or you added it using a third-party tool, most likely it’s still available in there. Flickr, to their credit, has a giant scary warning about this:

Please note: If you upload a photo with geo data, that info will be embedded in the EXIF data of the original file. If you don’t want people to have access to this information, you should restrict who can download your originals.

This is a terrible solution however, since I want people to have the full-size versions of my images. Is there another way?

Turns out yes, but it requires some manual steps and is a bit taxing:

  1. Visit http://www.flickr.com/map/ and visit the private location. Zoom until only the area you want to remove location information from is in view (or as close as possible).
  2. Use “Search the map” and select “Your photostream” to show only your photos.
  3. There is a strip with two arrows listing every photo of yours in the map area. Click each one and, if it is close enough to your center point, open it in a new tab. (Don’t use the pink bubbles on the map itself. The pink bubbles may not be displayed for every photo or may be hard to click on.) Download the original size versions of each of them. Put them all in a single directory.
  4. Strip the geographical EXIF data. To do this: Install exiftool. Make sure it’s in your path. Open a command prompt, cd to the directory where you downloaded the files, and type: exiftool -a -gps:all= *
    Note that this will destroy the EXIF data forever, so make a private copy of the images first if you want to preserve the original versions with full EXIF data. Flickr location data, although based on your EXIF data, is stored separately and will still be displayed to you and people permitted to see inside your geofence.
  5. Use “Actions->Replace this photo” to re-upload the modified images over the old ones. When replacing, you can easily find the matching image by copying the last bit of the URL after the final “/”, which will be the prefix of the filename.
  6. You have to do this again if you upload new photos in this area, preferably before your initial upload for maximum security – if you do it afterwards, someone quick enough may still grab the data.
This is quite a pain and I hope Flickr will in the future make it easy to automatically remove GPS EXIF from photos inside your geofence.
Geofences can be dangerous and can actually give more information about your location if you’re not careful. If you take many photos in the area just outside the perimeter of the circle, anyone looking at your photostream on Flickr will notice a giant empty circle with a very precise center location. A sufficiently clever attacker could infer the circle’s center from an even smaller number of photos. This isn’t a concern if most of your photos are not taken anywhere near you, but keep it in mind.
Also note that if you implement a geofence that covers existing images, anyone who is already actively tracking you will notice exactly which locations were hidden. This will point out which ones are near you. For this reason it’s best used as a pre-emptive measure.

Redirecting access log with .htaccess

I had an account on a seedbox server with a shared web server. The access logs were off limits to me, and the admins weren’t about to reconfigure the server for me. But I really wanted to see who was accessing my site. What to do?

Turns out I do have .htaccess on this server. However, the access log is not one of the configurable parameters. But through a hackish combination of several tricks, I can log all accesses to my public_html tree. Here’s my .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/hitcounter.php
RewriteRule ^ http%1://www.%{HTTP_HOST}/hitcounter.php?uri=%{REQUEST_URI} [L,R=301]

It redirects all incoming accesses to the “hitcounter.php” script, which logs the access to a file called “log” in the usual Apache access log format:

<?php
if (getenv(HTTP_X_FORWARDED_FOR)) {
    $ip = getenv(HTTP_X_FORWARDED_FOR);
    $vip = getenv(REMOTE_ADDR);
} else {
    $ip = getenv(REMOTE_ADDR);
}
$uri = $_GET['uri'];
$date = date('d/m/Y:H:i:s O');
$fh = fopen('log', 'a');
fwrite($fh, "$ip - - [$date] \"GET $uri HTTP/1.0\" 200 -\n");
fclose($fh);

header("Location: /nocount$uri");
?>

At the end of the script it redirects to the original URL prepended with “/nocount”. The directory “/nocount” simply contains symbolic links to everything in the webroot, along with a new .htaccess that turns rewriting back off again:

RewriteEngine off

One handy feature of this is I can bookmark or give out links containing “nocount” and those won’t be logged, so I can avoid self-logging. Downside is, this particular scheme results in “/nocount” being prepended to all my URLs.

I ended up abandoning this scheme because I was using my web server to web seed torrents and these redirects confused and broke the uTorrent client somehow. It also turned out to be unnecessary because Feral Hosting actually lets me configure my own private Apache server even on shared hosts via the .apache2 directory in my home directory.

Installing Eclipse with PyDev for Python development in Ubuntu

The following instructions been tested with Ubuntu 11.04 (Natty Narwhal), Eclipse 3.5.2, Python 2.7.1+, and PyDev 2.2.1, all of which were current on 2011 August 22. They were later tested again with Ubuntu 11.10 (Oneiric Ocelot).

Installation part based on this blog entry, with modifications.

Installing Sun JDK

First, assuming you want to use the Sun JDK, we need to get access to the Sun JDK package. Uncomment this in your /etc/apt/sources.list:

deb http://archive.canonical.com/ubuntu natty partner
deb-src http://archive.canonical.com/ubuntu natty partner

And do this (from this post):

sudo add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update

Install Eclipse and Sun JDK and plug-in:

sudo apt-get install eclipse sun-java6-jdk sun-java6-jre sun-java6-bin sun-java6-plugin

Accept license terms when prompted. After this completes, make Sun’s JDK the default:

sudo update-java-alternatives -s java-6-sun

Installing PyDev

  1. Run Eclipse and then go to Help | Install New Software
  2. Click Add… next to the “Work with” drop down. Specify the following:
    Name: PyDev
    URL: http://pydev.org/updates
  3. Check “PyDev”. Do not check “Pydev Mylyn Integration”. Press Next.
  4. Press Next again, accept license terms, click Finish to begin install. Installation may proceed in background – see lower-right of the window for status.
  5. If prompted to accept a certificate, click Select All, then OK. If prompted to restart Eclipse, click Yes.
  6. Open Windows | Preferences | Pydev | Interpreter – Python.
  7. Click Auto Config. A “selection needed” window will appear for the SYSTEM pythonpath. Click Select All, click OK.
  8. When Auto Config completes, click OK and wait for Pydev to scan your system Python libraries.

PyDev installation is now complete.

Trying out PyDev

To create a new (fresh) Python project in Eclipse with PyDev:

  1. Click File | New | Project | PyDev | PyDev Project, and click Next.
  2. Enter a project name. Click Finish.
  3. An Open Associated Perspective dialog will appear. Check the checkbox and click Yes.
  4. Right-click “src” and choose New | PyDev Module. Enter a Name (you need not enter a Package). Click Finish.
  5. Type some Python into the text file, like:
    print(‘hello world’.capitalize())
    You can press ENTER to autocomplete the capitalize() call while typing it.
  6. Click Run | Run. Leave set to “Python Run” and click OK. A Console window tab should appear showing the program output.
  7. Add the following two lines of source code:
    x = ‘hello there’
    print(x)
    Right-click in the margin to the left of the first source code line and choose “Add Breakpoint”.
  8. Choose Run | Debug. When “Confirm Perspective Switch” appears, check the box and click Yes.
  9. Execution will break at the first line. Select Run | Step Over, click the “Step Over” toolbar button, or press F6 to step through the source code line by line. After stepping over the line “x = ‘hello there’” the variable x should appear in the “Variables” window (you may have to scroll it down). Use Run | Debug or F11 to start the program over again during debugging.
  10. When done debugging, click the “PyDev perspective” in the upper right hand corner to return to the normal source editing view.
  11. To use PyDev with an existing Python project you’re working on, see “Creating a Project from existing sources“.

Keyboard shortcuts

Important keyboard shortcuts to know with PyDev:
  • F3: Go to definition
  • CTRL+SHIFT+G: Find all references (this one isn’t even in the menus!)
  • CTRL+SHIFT+B: Add breakpoint
  • F11: Run in debug mode
  • F6: Step over
  • F5: Step into
See Appcelerator PyDev keyboard shortcut list for more, or press CTRL+SHIFT+L.

Installing Ruby 1.9.2 and gems on Ubuntu 11.10

By default, the “ruby” package on Ubuntu 11.10 (Oneiric) refers to an older version of Ruby, 1.8.7 – probably for compatibility reasons. To use the newest version of Ruby and Gem, do:

  • sudo apt-get install ruby1.9.1
  • update-alternatives --config ruby
  • (select the option reading “/usr/bin/ruby1.9.1″)
  • update-alternatives --config gem
  • (select the option reading “/usr/bin/gem1.9.1″)

Contrary to their names, /usr/bin/ruby1.9.1 is actually a newer version (1.9.2p290 at the present time) and /usr/bin/gem1.9.1 is actually RubyGems 1.3.7 (there is no RubyGems 1.9.1). These numbers refer to the package name ruby1.9.1.

During a “bundle install”, depending on what gems are being installed, you may encounter other errors. I encountered the following three:

  • ERROR: Error installing nokogiri:
    ERROR: Failed to build gem native extension.
    
    /usr/bin/ruby1.9.1 extconf.rb
    <internal:lib/rubygems/custom_require>:29:in `require': no such file or load -- mkmf (LoadError)
    from <internal:lib/rubygems/custom_require>:29:in `require`
    from extconf.rb:5:in `<main>'

    To fix this one do: apt-get install ruby1.9.1-dev

    ERROR: Error installing nokogiri:
    ERROR: Failed to build gem native extension.
    
    /usr/bin/ruby1.9.1 extconf.rb
    checking for libxml/parser.h... no
    -----
    libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
    -----

    To fix this one do: apt-get install libxml2-dev

    ERROR: Error installing nokogiri:
    ERROR: Failed to build gem native extension.
    
    /usr/bin/ruby1.9.1 extconf.rb
    checking for libxml/parser.h... yes
    checking for libxslt/xslt.h... no
    -----
    libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
    -----

    To fix this one do: apt-get install libxslt1-dev

  • Installing sqlite3 (1.3.4) with native extensions
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    /usr/bin/ruby1.8 extconf.rb
    checking for sqlite3.h... no
    sqlite3.h is missing. Try 'port install sqlite3 + universal'
    or 'yum install sqlite3-devel' and check your shared library search path (the
    location where your sqlite3 shared library is located).

    To fix this one do: sudo apt-get install libsqlite3-dev

  • Gem::InstallError: hoe requires RubyGems version >= 1.4. Try 'gem update --system' to update RubyGems itself.

    Version 1.9.2 of the “hoe” gem requires a newer version of RubyGems than is presently available via the Ubuntu package manager. You have to force an upgrade with:

    sudo REALLY_GEM_UPDATE_SYSTEM=1 gem update --system

    After doing so, you must redo “gem install bundler” and “bundle install”. Note that this might screw up other things, since you’re upgrading gem outside the package manager interface now.

If these instructions don’t work for you, or you encounter problems with other gems and figure out how to fix them, please post in the comments below!