Ubuntu with its Unity desktop environment is unusable but the base linux system, all the available software packages and the community around ubuntu are very good. It is probably the best linux distribution if you don't take the Unity desktop into account. I recommend therefore to start with lubuntu (https://lubuntu.net/, a lightweight version of ubuntu). It gives you an installation with a small foot print and it is always easier to add components than to take things away.
Xfce (package xubuntu-desktop) is the desktop environment that you would want to have and it's easy to add. This is what I do right after completing the lubuntu installation:
Installing ubuntu linux on a thinkpad x220
apt install vim
dpkg --add-architecture i386
apt-get install libc6:i386 libncurses5:i386
apt install libstdc++6:i386
apt install openssh-server
apt install gnome-terminal
apt install xubuntu-desktop
This gives you a nice base system and a very usable desktop environment. You can now install any other packages that you would like to have on top of this (gimp, vlc, pavucontrol, audacity, mrxvt, galculator, geeqie, calligra, ispell, .... you choose).
In addition to selecting the right software packages there are a few essential actions that I do right after installation.
- Install all updates and then don't install any updates any more. Disable all automatic updates and set update notifications to "never". I am a control freak and I hate to see that my computer just decided to download updates before an important presentation or things that used to work start to break and change behavior. If you find any problems going forward then you can always check if there are updates in that area. The fear about security updates is unfounded. If there is something important then you will hear about it anyway and you can take care of it manually.
- Disable blind boot: The grub boot loader has a nice menu that allows you to perform hardware tests and select the kernel. All the ubuntu flavors disable that and present you with a meaningless logo at startup. If there is a problem or the machine is hanging during startup and shutdown then you have no idea whats going on. To get this menu back and see what your computer is doing you edit /etc/default/grub and change it to the settings seen below:
root@x220:~# vim /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
Save the file and run update-grub (as root or sudo):
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.13.0-19-generic
Found initrd image: /boot/initrd.img-4.13.0-19-generic
Found linux image: /boot/vmlinuz-4.13.0-16-generic
Found initrd image: /boot/initrd.img-4.13.0-16-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
IPv6 is a useless protocol for a desktop machine and disabling it reduces the footprint and the attack target size from a security point of view. Reboot and run "ifconfig". There should be no more IPv6 addresses on the interfaces.
- Set up the key combination to ctrl-alt-backspace to kill x11. Linux is pretty stable but it is good to have a way to get out of the graphical environment and back to the login screen in case things go really wrong.
look for the line
and change it to:
or alternatively change it to:
# if you want to disable caps-lock and use it for
# entering international non ascii characters then use:
# capslock compose key means that:
# ä = capslock -> a -> "
# è = capslock -> e -> '
It will take effect after the next restart of the computer. Alternatively you can run this command:
sudo udevadm trigger --subsystem-match=input --action=change
(see "man keyboard" for details)
You can print the settings that are actually in effect with the command setxkbmap (run it as the user that is logged into the graphical desktop). It is a good idea to print those with setxkbmap because there are many different places where keyboard settings can be configured. setxkbmap will show you the end result of all those different settings.
guido@x220 : ~ $ setxkbmap -query
You can as well run the following command to set this directly with setxkbmap:
setxkbmap -rules evdev -layout us -model pc105 -option terminate:ctrl_alt_bksp,compose:caps
Some desktop environments like unity and xfce allow you to configure the keyboard in a "keyboard preferences" GUI and that may unfortunately overwrite those system wide settings. In xfce (xfce4-keyboard-settings) you can tick "use system defaults" or overwrite but the unity keyboard config GUI will always overwrite the system settings. You can see what your keyboard looks like with the command:
gkbd-keyboard-display -l us
- Check that you have swap space on your machine but dimension the amount of RAM such
that it will not be used:
guido@x220 : ~ $ free
total used free shared buff/cache available
Mem: 8052984 735400 6786956 65060 530628 6990012
Swap: 499708 0 499708
It is possible to reduce the tendency of Linux to swap but it makes much more sense to just
buy more RAM. It's not a problem if Linux swaps some dead code out to swap space once in a while but you don't want a situation where data is transferred between swap and RAM multiple times.
- I use SSD disks and it's good to have a temporary work space that does not wear down
the disk. I use a 800Mbyte tmpfs RAM only filesystem for /tmp and noatime on the main filesystems:
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=8a50bbff-51d0-4eb6-be14-cf0c98b9b6d6 / ext4 errors=remount-ro,noatime 0 1
# /boot was on /dev/sda1 during installation
UUID=96a1cfac-77de-4a03-99d3-fc145a8c5ffc /boot ext4 noatime 0 2
# swap was on /dev/sda2 during installation
UUID=e66de9f4-2704-4e44-899c-e5b78ec7f79d none swap sw 0 0
# to avoid the SSD from beeing worn out by temporary files:
# test manually: mount -t tmpfs -o size=800m,mode=1777 tmpfs /var/tmp
tmpfs /tmp tmpfs size=800M,mode=1777 0 0
# no tmpfs for /var/tmp/, we leave that on the normal disk filesystem
- Don't use a firewall (ufw). A firewall makes sense as a network protection but if you have to use it on a laptop then it's in many cases just band-aid for a problem that does not need to exist. In other words don't block with a firewall network services that you don't need. Just don't start them in the first place. It's easy to see what you are running:
# netstat -lnp -tuw | more
To figure out which port is which service you can look at /etc/services
Lubuntu does not really start any network services but when you add packages you might
unintentionally start services like the postfix mail server that can get into the system via
some package dependency rules.
Shut those services that you don't need down. Example:
# systemctl stop postfix
# systemctl mask postfix
# systemctl stop avahi-daemon
# systemctl mask avahi-daemon
Mask means to permanently prevent a service from starting.
- Add rc files and aliases.
# guido adds this to .bashrc
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF --color=tty'
alias la='ls -A'
alias l='ls -F --color=tty'
alias ls='ls -F --color=tty'
alias vi='vim -n'
alias cp='cp -ipv'
alias rm='rm -i'
alias mv='mv -iv'
alias h='history 50'
set bell-style visible
# end guido additions
I use the vim text editor and I would recommend anybody to learn it (in the mean time you could use leafpad or gedit). I keep this .vimrc file in all my home-directories:
" Startup file for vim editor
" search case insensitive:
"incremental search is really cool! You terminate it with return
" some keyboards have the F1 key where the Esc key is expected:
map! <F1> <ESC>
" when jumping back to a label I always confuse ` and ':
map ' `
" Have Vim jump to the last position when reopening a file, creates .viminfo file in your home-dir
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
" end of .vimrc file
- Enable dns caching (if you are using network manager and dnsmasq):
DNS name resolution is often what causes "the internet" to appear "slow" and a good cache
can go a long way in speeding things up.
For more information on this subject see http://tuxgraphics.org/npa/ubuntu-dns-caching/.
and put inside:
After that run "systemctl restart network-manager"
or just restart the computer.
- Most modern laptops have unfortunately this wide screen. The x220 is no exception. It has a 16:9 screen ratio and to have a useful work space you should put the panel (the bar with the menu and icons) on the side rather than keeping it on the top or bottom. Click on XFCE setting and select "panel". In there choose "Display", "General": "Deskbar".
- Fix the ubuntu slow suspend to ram problem: This is a bug in the wpasupplicant package and it will probably be fixed at some point in future. However for now there is no official bug fix available for ubuntu 16.04 or 17.04. The problem is this: Press Fn-F4 or close the lid (make sure you have proper power manager settings). The laptop should almost instantly sleep (suspend to ram). Instead of suspending it waits for about 15-20 sec and then it goes to sleep. I use suspend to ram a lot and 15-20 sec delay feels like ages. If you run prior to susped the command "systemctl stop NetworkManager" then it will go to sleep instantly at Fn-F4. The cause is a race condition triggered by the script /lib/systemd/system-sleep/wpasupplicant. Since it is a script we can edit it and fix it.
root@x220:~# vim /lib/systemd/system-sleep/wpasupplicant
# original code:
if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ]; then
case "$1" in
pre) /sbin/wpa_cli suspend ;;
post) /sbin/wpa_cli resume ;;
# fixed code:
if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ]; then
case "$1" in
post) /sbin/wpa_cli resume ;;
"wpa_cli suspend" is a useless action and it causes only problems.
- I love the xfce desktop but the xfce4-terminal has the problem that is provides help text if you press F1. Keyboards have the F1 key very close to the ESC key and when you use vi or vim then you will need that ESC key all the time. Once in a while you will accidentally hit F1 and that is a real problem if you use xfce. How do we get rid of the xfce function key? Here is how to disable the F1 key in XFCE:
- Start the appearance settings either from the command line (xfce4-appearance-settings) or form the settings menu.
- Go to the settings tab and check "Enable editable accelerators". Close the settings window.
- Go to the xfce4-terminal, click on help and hover with the mouse over "Contents", press the del key and the F1 will disappear.
The Lenovo Thinkpad X220 hardware
Lenovo Thinkpad X220
Year of production: 2012
Serial Number: R9R7MA7
Machine Type Model: 429144U
Function key to enter Bios: F1
Function key to select boot device: F12
The screen is small but otherwise it is an amazing machine: great keyboard, a large number of ports and the famous IBM trackpoint. The laptop case looks sturdy but it flexes a bit near the power on button. My thinkpad x301 with it's carbon fiber case feels a bit stronger than the x220 but the x220 does not feel weak or under dimensioned.
The available ports are:
The screen is 12.5" (317.5mm) HD (1366x768 pixel) TFT color display. Graphics card: Intel HD Graphics 3000 in processor.
- 3 in 1 SD card reader. SDXC Support
- 1x Express Card 54mm (you can e.g put a USB 3.0 card in there)
- Docking (at the bottom)
- VGA out
- Display Port
- Ethernet (RJ45)
- Audio Combo - Headphone/Mic
- 3x USB 2.0 (one powered)
The harddisk is a normal 2.5 inch Sata drive but it can only be 7mm high. A lot
modern SSD drives are however slim 7mm drives and therefore you have a lot of choice.
The laptop has a replaceable Lithium Ion battery and you can change it without
opening the laptop. Available battery options are:
I would always try to get the smallest possible battery. It's much better to take a small power supply with you on the road then to have such a huge bulky battery.
- 4-cell (difficult to get, this is the flat type that does not make the machine bigger), FRU number 42T4899 or 42T4901, aka Thinkpad battery 29.
- 6-cell (most batteries that you can buy as of 2017 are 6 cell and they lift the laptop up on the back, battery has rubber feet), FRU number 42T4861 or 42T4865 or 42T4873 or 42T4875, aka Thinkpad battery 29+
- 9-cell (too big, extends to the bottom and towards the back)
- external battery (attaches to the bottom of the machine)
Power consumption while laptop is off: This laptop consumes a non negligible amount of power even when it is off. That is: after sitting for about 4 month on the shelf I notice that the battery went from 100% to 85%. This is much more than the battery loosing charge by itself. It is not too bad and I have seen laptops worse than that but my favorite thinkpad x301 can be on the shelf for a year to get down to the same levels. Why does the laptops consume power when it is off? The power-on button is not an on/off switch: There is a little controller that checks all the time the state of that push button. There migh as well be other electronics related to the bios that consumes power.
Here are a number of text files with linux command printouts documenting the hardware:
This page was written by Guido Socher