Installing VirtualBox on Linux Mint (Ubuntu 13.04)

I always have problems with this. I found a very nice blogpost that was very easy to follow and in my case very complete (http://aahank.com/2013/install-virtualbox-on-ubuntu/). All credit goes to http://aahank.com/.

I’ll summarise this for my own future installations of VirtualBox πŸ™‚


sudo apt-get update && sudo apt-get upgrade

sudo apt-get install linux-headers-$(uname -r)

sudo apt-get install dkms

Now we are ready to install VirtualBox. So go ahead and download the latest stable package for your Linux distribution here. Double click the downloaded .deb file and install as usual.

sudo usermod -aG vboxusers username

(Don’t forget to replace ‘username’ in the above command with yours.)

One last thing. You might also want to install the VirtualBox Extension Pack as it enables support for USB 2.0 devices, among a few others. You can download it here, and install then install it in two ways:

  • Double-click on the package file, and let the VirtualBox Manager guide you through the process.
  • Start Oracle VirtualBox from Ubuntu Dash, then go to File β†’ Preferences, select Extensions tab in the settings window, and click Add package button.

Before you create a virtual machine, be sure to restart your PC.

Create a VM. Then start the VM, and installation of the operating system should begin. Once done, restart the VM, and when the guest OS is fully up, install VirtualBox Guest Additions by going to Devices β†’ Install Guest Additions….

If the gui of the OS installed on a virtual machine is laggy, try disabling Hardware Virtualization.

Garmin Forerunner 410 on linux

Sports watches are poorly supported by their manufacturers regarding linux. After I started running I decided on a Garmin FR 410, since it was quite cheap and has all the functionality I wanted. I neglected to look up how it works under linux and for the first couple of months after I got it I had to boot up my XP in VM to transfer data to and from the watch.

Then I came across a nice python tool that made it possible to get data off the watch and upload it to Connect Garmin. The tool is called python_ant_downloader and you can find supported watch models on their github page. It is simple to install through pip (use sudo if needed):

user@host $ sudo pip install python_ant_downloader

Edit 3rd July 2014: If you use Anaconda for virtual python environments as I do, then you might be having issues with python module dbm not being installed when running the ant-downloader:

user@host $ ant-downloader
Traceback (most recent call last):
...
import dbm
ImportError: No module named dbm

If so, you can install it straight from github:

user@host $ sudo pip install git+git://github.com/braiden/python-ant-downloader.git

This gives you a terminal program called ant-downloader that can retrieve data from a connected garmin watch and upload it to garmin. First, I had a problem where my ant+ stick was not getting permissions to mount. In Ubuntu (and derived systems, and probably other distros as well) non-standard usb sticks are not allowed to mount automatically. Those devices follow permission rules that are present in /etc/udev/rules.d/. To generate a rule for our USB Ant+ stick we need to figure out the sticks ID:

user@host $ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 002: ID 0fcf:1008 Dynastream Innovations, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In my case I identified my USB stick by running the command with it unplugged and then again plugged in. Here the Dynastream Innovation, Inc. is the stick and note the ID : 0fcf:1008. Now we generate a rule for that device:

user@host $ sudo echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0fcf", ATTR{idProduct}=="1008", MODE="666"' > /etc/udev/rules.d/99-garmin.rules

user@host $ sudo bash -c "echo 'SUBSYSTEM==\"usb\", ATTR{idVendor}==\"0fcf\", ATTR{idProduct}==\"1008\", MODE=\"666\"' > /etc/udev/rules.d/99-garmin.rules"

Edit 3rd July 2014: On Arch based system (I’m using Manjaro at the moment) the command is a bit different:

user@host $ sudo bash -c "echo 'SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0fcf\", ATTRS{idProduct}==\"1008\", MODE=\"666\"' > /etc/udev/rules.d/99-garmin.rules"

Note that the vendor and product attributes use their respective parts of the ID above. Saving this and plugin the USB again should allow you to run

user@host $ ant-downloader

The first time it runs, it generates configs and tries to pair with your watch. After that, you can edit the file ~/.antd/antd.cfg and add your connect.garmin details under the configΒ [antd.connect] (and set enabled = True) for automatic upload to their server. Your workouts are also stored as .tcx files that you can upload to other servers than garmin, you find them in the folder ~/.antd/0xDEVICENR/tcx/ .

Hope this will be of use to someone πŸ™‚ Please let me know of any issues you find with this method.

Binni out.

Essential installs on Linux Mint 15

I have been installing a lot of linux distros on my laptop over the last year. Some basic packages that I like to install are as follows:
sudo apt-get install apt-file git vim htop screen
sudo apt-file update
apt-file search WHAT_TO_FIND

apt-file is quite good if you are not sure in what package a program or a file you need is located.

git, vim, htop and screen are regular suspects πŸ™‚

The simplest way to get a scientific python environment up and running is the following:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose python-biopython python-sklearn python-joblib python-spyderlib

For latex, I do:

sudo apt-get install texlive texlive-latex-extra texlive-fonts-extra texlive-fonts-recommended latex-xcolor

My laptop has an AMD ATI Radeon HD 6600M discrete graphics card, which I have decided to turn off while running linux and depend on the integrated Intel gen2 graphics processor. I use the ATI open source drivers and the last I checked, they do not play to well with switchable graphics.

In /etc/rc.local I put the following script which uses vgaswitcheroo to turn off the discrete card on boot:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
exit 0

This method does not play too well with suspend and hibernate options which forces us to generate a script /etc/pm/sleep.d/90vgaswitcheroo with the following:

#!/bin/sh
case "$1" in
hibernate|suspend)
echo "ON" > /sys/kernel/debug/vgaswitcheroo/switch
;;
thaw|resume)
echo "OFF" > /sys/kernel/debug/vgaswitcheroo/switch
;;
*) exit $NA
;;
esac

This turns the discrete on before the system goes to hibernate or suspend and then turns it back off after the system wakes up. We need to make it executable and owned by root:

sudo chown root:root /etc/pm/sleep.d/90vgaswitcheroo
sudo chmod 0775 /etc/pm/sleep.d/90vgaswitcheroo

Another thing I had problem with on Mint 15 was that when I put the laptop in hibernate or suspend, it did not lock the screen on wake up. This is unsecure and annoying. The simplest fix I found for this is by creating the following script /etc/pm/sleep.d/00LockScreen (found at the amazing Arch wiki):

#!/bin/sh
#
# 00LockScreen-lock: lock workstation on hibernate or suspend

username=USERNAME # add username here; i.e.: username=foobar
userhome=/home/$username
export XAUTHORITY=”$userhome/.Xauthority”
export DISPLAY=”:0″

case “$1” in
hibernate|suspend)
su $username -c “cinnamon-screensaver-command –lock -m ‘Sleep message'” &
;;
thaw|resume)
;;
*) exit $NA
;;
esac

And as before:


sudo chown root:root /etc/pm/sleep.d/00LockScreen
sudo chmod 0775 /etc/pm/sleep.d/00LockScreen

There is a lot of other software that I install:
Dropbox
FileZilla
Firefox
Keepass2
Mendeley
Skype (I am searching for an open secure alternative, leave a comment if you know any!)
Spotify

Well, That is quite enough for now πŸ™‚

Binni out!