Linux Notes from setting up Laptop 2011

I recently purchased a new laptop (Lenovo X220) and made some upgrades (160 GB SSD, 8 GB RAM) making it a great little development machine. I like it so much, that I want to use it even for my Linux needs.

I like to do a post or series of posts whenever I do a notable Linux install, often because there are so many nuances you need to deal with that are easy to forget.

Here is the last one I did:

/2010/11/12/ubuntu-on-the-zotac/

This time though, rather than the creating a partition for Linux, I decided to try out WUBI, a utility that comes with Ubuntu. Simply place any Ubuntu LiveCD in your CD/DVD-ROM while you’re still in Windows, and it will offer to Install Ubuntu for you.

What’s nice about WUBI is it lets you Install Ubuntu to your Windows File System inside a large file. If I ever decide I need my hard drive space back, I can simply uninstall WUBI/Ubuntu as I would any other Windows program. Easy!

WUBI has another bonus. Whatever drive it is installed on, that drive is automatically mounted as “/host/”. I always install/do my coding stuff on a 2nd partition “D:\”, so I installed my ubuntu there too. So awesomely, I can access all other files on my “D:” work drive.

Currently I am running 64bit Ubuntu 11.4 on my laptop. The install procedure was rather routine. I’ve been using the now stock “Unity” window manager on the last few Ubuntu’s, and actually like the latest incarnation (at least, as a laptop and netbook window manager).

I start off by undocking many programs from the sidebar. I then run and dock the Calculator, Terminal, and System Monitor.

To make Ubuntu boot smoothly, without prompts, I needed to change a few settings (just as I did on the install linked above).

Applications->Installed->System Settings->System (section)->Login Screen. Unlock by pressing the button, and set myself as the auto-login user. This fixes the need for me to login every time Ubuntu starts.

Applications->Installed->System Settings->Personal (section)->Screensaver. Uncheck “Lock screen when screensaver is active”.

Applications->Installed->System Settings->Other (section)->Passwords and Encryption Keys. Right click on the “Passwords: login” group, and pick “Change Password“. Type in your password, and leave the new password fields both blank. Yes this is unsafe, but MAAAN… it’s super annoying to have it set. This fixes the prompt for a password to connect to any wireless networks.

I fire up a terminal and install a few programs.

sudo apt-get install geany
sudo apt-get install subversion
sudo apt-get install mercurial
sudo apt-get install automake
sudo apt-get install freeglut3-dev (for opengl/mesa)

The next two I do for simplicities sake. I build SDL from the Mercurial repository now, but getting all the dependencies right can be a pain. I did the manual way of guessing all the packages at first, and it was nothing but annoying. In the future, I hope I just don’t bother and do the following: Simply install old SDL just to get the right dependencies.

sudo apt-get install libSDL-dev
sudo apt-get install libSDL-mixer1.2-dev

On every Linux system I set up, I work out of a “Code” folder inside my home folder. Inside “Code” I make a “Build” folder for any 3rd party libraries i want to build (i.e. SDL).

mkdir Code
cd Code
mkdir Build
cd Build
hg clone http://hg.libsdl.org/SDL
hg clone http://hg.libsdl.org/SDL_mixer

SDL comes pre-configured, but SDL_mixer does not. Be sure you have automake installed, then run:

cd SDL_mixer
./autogen.sh
cd ..

Now SDL Mixer can be built.

cd SDL
./configure
make -j 4
sudo make -j 4 install
cd ..
cd SDL_mixer
./configure
make -j 4
sudo make -j 4 install
cd ..

This installs both in /usr/local/. Done.

Additional System Specific Tweaks

My laptop is a Lenovo (IBM). It has one of those nub mice in the middle of the keyboard. I like nub mice. My old Toshiba laptop from College had one, and I got rather good/comfortable using it.

The nub has an auto-scroll button. Under Windows this lets me press it, and whichever direction the nub points, is the way the window will scroll.

To get this behavior on Linux, I had to install a program.

sudo apt-get install gpointing-device-settings
gpointing-device-settings

This is an easy-to-use GUI for configuring this. Click the 2nd sidebar item “TPPS/2 IBM TrackPoint”. Click the “Use Wheel Emulation” checkbox. Click the Horizontal and Vertical checkboxes. Finally make sure the drop-down-box and change the button to “BUTTON 2”. Done! Scrolly goodness.

Update: The above does work, but the settings do not save. The above relies on something called “HAL” which is no longer used.

The correct “New” solution is to create a config file as suggested in the xorg.conf.d section of this document:

http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint#xorg.conf.d

Open a shell and go here:

cd /usr/share/X11/xorg.conf.d
sudo gedit 20-thinkpad.conf

Now paste this file:

Save the file, then reboot, and your settings will be correct (i.e. the nub scroller will work as expected under Windows).

* * *

Also, the laptop has a pair of “Web Back” and “Web Forward” keys. In Windows I changed these to extra page-up and page-down keys (with SharpKeys). I did that in Linux as follows:

First, I created the following Shell script (startup.sh) and placed it in my home folder.

#!/usr/bin/bash

xmodmap -e "keycode 166=Page_Up"
xmodmap -e "keycode 167=Page_Down"

exit 0

http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown

I opened a shell and gave the script execute permissions.

chmod +x startup.sh

Then under System Settings->Personal (section)->Startup Applications, I added my shell script.

Windows Notes

WUBI enables the Windows bootloader. By default, the Windows Bootloader sets a 10 second timeout. Thanks to the SSD, my Windows 7 boot times are insanely fast, but having to wait 10 seconds for a bootloader is crazy talk.

Solution, a free program EasyBCD can be used to configure settings of the bootloader.

http://neosmart.net/dl.php?id=1

Note: I suspect the Windows Bootloader uses “whole time”, as in, it counts seconds rounded up to the nearest whole second of the current system clock. For this reason, 1 second wasn’t enough. It worked sometimes, but not always. So I’ve made the bootloader last for 2 seconds, guaranteeing at least 1 whole second.

Also, setting the web keys in Windows, I used a program SharpKeys:

http://www.randyrants.com/sharpkeys/

Great! All done!