Skip to content

2013

Nvidia driver mismatch after upgrading to Ubuntu 12.04.3 LTS

After upgrading to Ubuntu 12.04.3 LTS, I could not boot in GUI / X anymore. I got this when trying to start X:

startx

NVIDIA: API mismatch: the NVIDIA kernel module has version 304.88, but this NVIDIA driver component has version 304.108.
Please make sure that the kernel module and all NVIDIA driver components have the same version.

To fix that it seems you have to disable the xorg:nvidia_304_updates (304.108) driver and enable the xorg:nvidia_304 (304.88) driver:

sudo jockey-text -e xorg:nvidia_304 

After that you should have xorg:nvidia_304 listed as Proprietary, Enabled, In use:

sudo jockey-text --list
xorg:nvidia_173 - NVIDIA accelerated graphics driver (Proprietary, Disabled, Not in use)
xorg:nvidia_173_updates - NVIDIA accelerated graphics driver (post-release updates) (Proprietary, Disabled, Not in use)
xorg:nvidia_304 - NVIDIA accelerated graphics driver (Proprietary, Enabled, In use)
xorg:nvidia_304_updates - NVIDIA accelerated graphics driver (post-release updates) (Proprietary, Disabled, Not in use)
xorg:nvidia_96 - NVIDIA accelerated graphics driver (Proprietary, Disabled, Not in use)    

And finally you have to reboot:

sudo reboot

Debian "Wheezy" guest on Windows 8.1 host using VirtualBox

This post is about using Oracle VirtualBox to install a Debian 7.2 x86_64 guest virtual machine on Windows 8.1 host.

Install VirtualBox

  1. Download the latest VirtualBox installer from https://www.virtualbox.org/wiki/Downloads. Make sure you get the 64-bit version. That was VirtualBox-4.3.2-90405-Win.exe at the time of writing.
  2. Run the installer and follow the instructions on the screen. Leave the default options as they are. The installation should complete without any issues.
  3. Download the Oracle VM VirtualBox Extension Pack from https://www.virtualbox.org/wiki/Downloads.
  4. Double click the downloaded .vbox-extpack file to install the extensions.
  5. Go to File > Preferences > Extensions. You should see the Oracle VM VirtualBox Extension Pack listed under Extension Packages.

virtualbox-settings

Create virtual machine

  1. Start VirtualBox
  2. Select Machine > New from the menu - Name: Debian-7.2-x64
  3. Type: Linux
  4. Version: Debian (64 bit)
  5. Click Next

NOTE: If the Debian (64 bit) choice is not available, make sure Intel Virtualization Technology is enabled in the host UEFI / BIOS. 3. Memory size - Memory size: 4096 MB - Click Next 4. Hard drive - Choose Create a virtual hard drive now - Click Create - Choose VDI (VirtualBox Disk Image) - Click Create - File allocation and size - Select a path for the virtual disk image - Select 100 GB for size - Click Create

It takes a few minutes to create the virtual disk image, but eventually you will see the image in the VirtualBox Manager. We are ready to install Debian now.

create-virtual-machine create-virtual-machine-memory-size create-virtual-machine-hard-drive create-virtual-hard-drive-creating-fixed-medium-storage-unit oracle-vm-virtualbox-manager

Configure Display

In VirtualBox Manager:

  1. Select Debian-7.2-x64 > Settings
  2. Select Display > Video
  3. Bump up the video memory to 128 MB.
  4. Do not check Enable 3D Acceleration. We will enable 3D Acceleration later.

no images were found

Mount Debian Boot CD

  1. Download the Debian 7.2 x64 ISO image from the network install page on the Debian web site. Make sure you get the amd64 image.
  2. Open VirtualBox Manager
  3. Select Debian-7.2-x64 > Settings
  4. Select Storage > Controller IDE > Empty
  5. Click on the little CD icon
  6. Find and select the Debian ISO (debian-7.2.0-amd64-netinst.iso) that you downloaded in step 1.
  7. Click OK

oracle-vm-virtualbox-manager-machine-settings debian-7-2-x64-storage-settings

Start the virtual machine

  1. Open VirtualBox Manager
  2. Start the Debian-7.2-x64 machine
  3. Press right CTRL+R to reset the machine. You should see the Debian Installer boot menu.

oracle-vm-virtualbox-manager-start debian-7-2-x64-debian-installer-boot-menu

Install Debian

In the Debian Install boot menu:

  1. Select Graphical Install
  2. Follow the installer instructions and configure Debian just as you would do on a physical machine. You should be able to install without any problems.

Enable 3D Acceleration

Install Guest Additions for VirtualBox

  1. Start the Debian-7.2-x64 virtual machine
  2. Login into Debian
  3. Select Insert Guest Additions CD image… from the VirtualBox Devices menu. Do not run it!
  4. Open Root Terminal

Install Module Assistant, so you can build kernel modules.

apt-get install module-assistant

Let Module Assistant prepare the system.

m-a prepare

Install Guest Additions

sh /media/cdrom/VBoxLinuxAdditions.run

Enable 3D Acceleration

  1. Shutdown the Debian-7.2-x64 virtual machine
  2. Open VirtualBox Manager - Select Debian-7.2-x64 > Settings
  3. Select Display > Video
  4. Check Enable 3D Acceleration
  5. Start the Debian-7.2-x64 virtual machine

Troubleshooting

If the installation does not start or hangs, try booting using Advanced Options > Expert Install. That will give you more information about what is wrong with the installation.

Errors

This kernel requires an x86_64 CPU, but only detected an i686 CPU …

debian-7-2-x64-running-oracle-vm-virtualbox

How to fix
  • Make sure Intel Virtualization Technology is ON in the host UEFI / BIOS.
  • Make sure the VirtualBox machine version is Debian (64 bit).
  • Make sure Windows Hyper-V services are not running.

How to save XDocument to xml and use single quotes for attribute values

I had to do this for AVBlocks xml licenses recently. It is not straightforward, but here is the C# code.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;

namespace Primo.LicenseBuilder.Xml
{
    public static class XmlExtensions
    {
        public static string ToSingleQuoteString(this XDocument xDocument, 
                                                    System.Xml.Formatting formatting = Formatting.Indented)
        {
            using (StringWriter sw = new StringWriter())
            {
                using (XmlTextWriter writer = new XmlTextWriter(sw))
                {
                    writer.Formatting = formatting;
                    writer.QuoteChar = '\'';
                    writer.WriteNode(xDocument.CreateNavigator(), false);
                    writer.Flush();
                }

                return sw.ToString();
            }
        }
    }
}

How to install and configure TortoiseHg on Mac

I finally got fed up with SourceTree and installed TortoiseHg on my Mac development machine. Read on:

Xcode Configuration

For best results make sure you have the latest XCode and Command Line Tools installed (XCode 5 and Command Line Tools September 2013 at the time of this writing). You can get them from the Apple Developer Downloads site.

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

1. Install / Update Ruby

ruby -v
should return something like:

ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]

You can skip the rest of this section if you have Ruby already installed.

Install the Ruby Version Manager and Ruby

curl -L https://get.rvm.io | bash -s stable --ruby
source /Users/yourname/.rvm/scripts/rvm

2. Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Follow the instructions in the script. The installation will take a few minutes.

Verify your brew installation

brew doctor

This returned a few problems for me, but the output will vary depending on the existing system configuration.

Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git

Warning: /Library/Frameworks/Mono.framework detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake.

Warning: You have MacPorts or Fink installed:
    /Users/yourname/.rvm/bin/port, /opt/local/bin/port

This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.

    sudo mv /opt/local ~/macports

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. 

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile

Warning: Your Xcode (x.y.z) is outdated
Please install Xcode a.b.c

The issues will depend on your specific installation. Use your best judgement about what to fix and what to ignore. Fixing one by one:

Warning: You have MacPorts or Fink installed
sudo mv /opt/local ~/macports
Warning: /usr/bin occurs before /usr/local/bin
export PATH=/usr/local/bin:$PATH
echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile
Warning: An outdated version of Git was detected in your PATH.
brew upgrade git

or if you do not have Git at all:

brew install git
Warning: Your Xcode (x.y.z) is outdated

You can ignore this one.

Warning: /Library/Frameworks/Mono.framework detected

You can ignore this one.

3. Install Python packages

I had Python already installed before Homebrew, so I had to amend PYTHONPATH like so:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH  
echo export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH" >> ~/.bash_profile

Then install PyQt (this also installs qt and sip):

brew install pyqt

Install QScintilla

brew install qscintilla2

Install Python Package Mananger (pip)

sudo easy_install pip

Install Pygments, iniparse and Mercurial Python packages. If you have Mercurial already, this will update it to the latest version.

sudo pip install -U Pygments iniparse Mercurial

4. Install TortoiseHg

Clone TortoiseHg repository using Mercurial:

hg clone http://bitbucket.org/tortoisehg/thg/ ~/Tools/TortoiseHg
cd ~/Tools/TortoiseHg/
hg update stable

Quick test. You should see TortoiseHg Workbench running:

./thg log

5. Install TortoiseHg Mac App

Clone thg-mac-app repository
hg clone https://bitbucket.org/skrysmanski/thg-mac-app ~/Tools/thg-mac-app
Set the TORTOISEHG_PATH variable
cp -p ~/Tools/thg-mac-app/tortoisehg-path.sh ~/

Edit ~/tortoisehg-path.sh so it points to ~/Tools/TortoiseHg. This is what ~/tortoisehg-path.sh looks like after the change:

``` bash

!/bin/sh

export TORTOISEHG_PATH=~/Tools/TortoiseHg ```

Install TortoiseHg.app

Option + Drag the TortoiseHg.app from ~/Tools/thg-mac-app to your Applications folder.