Prevent upgrade of (“lock” version) specific packages in Debian/Ubuntu Linux

In many cases, you may need to preserve the current version of a package in Debian or Ubuntu Linux. For example, your production environment may use an older version of a package and, in your development environment (perhaps on a Vagrant virtual machine), you want to make sure you use the same version. The apt package manager provides functionality to “lock” (or, as it’s called in Debian/Ubuntu, to “hold”) the version of a package. The command is simple:

sudo apt-mark hold package_name

where package_name is the name of the package, such as grub-pc. You can include multiple package names on the command line by separating each with a space.

For more information, see the Ubuntu help topic on apt “pinning”.

Make your .bash_profile aliases available anywhere

Bash aliases are one of the truly great timesavers when working in Unix/Linux. I’ve picked up quite a few aliases from others on my travels around the Internet and many have become second nature. Moreover, in quite a few cases, I’ve (almost) forgotten the original command!

Lately, I’ve done a lot of development work using Vagrant and, honestly, I’d never want to go back to trying to set up development environments on individual machines, since Vagrant makes standardization so simple. At the same time, even though my Vagrant box is pretty well standardized, everyone probably has their on bash aliases that they like to use. So, here’s how to have the best of both worlds!

What we want to do is provide a simple way to grab our bash aliases from Github and apply them from most any machine.

  1. Put your bash aliases (or any other bash settings!) into a file a file named .bash_alias and add this file to your Github account. The conventional practice is to put these in a repository named dotfiles.
  2. Determine the “raw git” URL to your new .bash_alias on Github. Essentially, this URL starts with https://raw.githubusercontent.com/ and then follows the standard pattern for Github URLs of your username, repository name, branch, and file name. For example, my .bash_aliases “raw” URL is https://raw.githubusercontent.com/TimothyDJones/dotfiles/master/.bash_aliases.
  3. Now, here’s where all of the magic happens! When you want to apply your aliases on a machine that you are logged into, such as a Vagrant box, just run this command at the shell:
    curl https://raw.githubusercontent.com/TimothyDJones/dotfiles/master/.bash_aliases -o /tmp/.bash_aliases; source /tmp/.bash_aliases
    

    Viola! All of your aliases are now available on this machine. And, of course, you can add this command to your .bash_profile on that machine, so that it will run automatically everytime you log in.

Note: When dealing with your Unix/Linux configuration files (“dotfiles”), it is very important to pay attention to the line endings of your files. Windows and Unix/Linux use different conventions. The best way to account for this is to set the autocrlf parameter in the dotfile repository on your workstation by running:

git config core.autocrlf true

Installing/running Windows 8 Developer Preview in Virtual Box

Microsoft just released Windows 8 Developer Preview (also known in some circles as “Milestone 3”).  So I thought I’d give it a spin in Virtual Box.  Unfortunately, the default settings for Virtual Box didn’t work quite right.  Initially, I was getting error code 0xc0000225 during the installation start up.  Then, after getting the OS installed, networking did not work.  Here’s what I did to get things going with the x64 versions of Windows 8 guest using Virtual Box version 4.1.2 (the latest at the time of writing).

Boot errors (error code 0xc0000225)

In the System settings section for the Virtual Box VM, enable (check) Enable IO APIC on the Motherboard tab and Enable PAE/NX on the Processor tab.

Network adapter not detected

In the Network settings section, select the appropriate adapter tab (usually Adapter 1).  Then click on Advanced arrow to expand/display the additional options.  Select Intel PRO/1000 MT Desktop (82540EM) from the Adapter drop-down list.  The Windows 8 guest OS will auto-detect this hardware and install the appropriate driver.

Install Virtual Box extensions in Windows 8 guest

With the Windows 8 guest OS running (of course!), select Devices | Install Guest Additions… from the menu on the VM window, as usual.  When prompted about whether or not to auto-run the installer, choose to open the files in Windows Explorer.  Then open a Command Prompt (I had to launch Task Manager, choose More details option, then select File | New Task (Run…) from the menu and enter CMD in the dialog prompt.) and navigate to the Guest Additions drive (probably D:\) at the Command Prompt.  At the Command Prompt, run this command:

VBoxWindowsAdditions-amd64.exe /force

This forces the installation of the Guest Additions, which would otherwise fail because of invalid version check.