2015-05-18

Debian on a Dell XPS13: Part 3 - X

With console mode behaving nicely it's time to get X on the XPS13.

I started by installing a minimal X installation with my favourite window manager i3.  As with the console the huge resolution of the laptop rendered the whole screen really rather small!  The first step is to find out if X knows much about the display.  The following command when executed from an x-terminal will determine whether the display resolution has been detected properly:

$ xdpyinfo | grep -B 2 resolution
screen #0:
    dimensions:    3200x1800 pixels (846x476 millimeters)
    resolution:    96x96 dots per inch

Hmmm... good try X, but my screen definitely isn't almost 1 metre x 0.5 metres...  Time to teach X about the actual size of this display.  Modern XOrg installations don't often come with an xorg.conf file to make changes to - most of the configuration is done on the fly.  If you want to customise the configuration I believe the accepted method is with override files in /etc/X11/xorg.conf.d/.  To teach XOrg about the display I put the following into a new file called /etc/X11/xorg.conf.d/10-monitor.conf:

Section "Monitor"
    Identifier "<default monitor>"
    DisplaySize 423 238
EndSection

The DisplaySize option sets the physical size of the display in millimetres.  I just chose values that would give me a final resolution with a multiple of 96dpi.  Restarting X and repeating our previous command gives:

$ xdpyinfo | grep -B 2 resolution
screen #0:
    dimensions:    3200x1800 pixels (423x238 millimeters)
    resolution:    192x192 dots per inch

Looks pretty good!

The next step is to start configuring our apps to respect the resolution:

i3

Edit ~/.i3/config:
...
font pango: Inconsolata 12
...

rxvt

Edit ~/.Xresources:
...
URxvt.font:    xft:Inconsolata-12
...

Other resources

After these tweaks the system is mostly ready to use.  I'll continue to post anything I find useful about this laptop.  Other useful resources are:

2015-05-12

Debian on a Dell XPS13: Part 2 - Console Tweaks

Screen config

Having jumped through some hoops in part 1 to get a working base system the laptop was now in a good, usable state.  On rebooting however it's clear that the standard linux console is a little strained when faced with a 13" 3200x1800 display.  To say the text is a bit on the small side is an understatement.

Initially I thought that this could be fixed by selecting a lower resolution using KMS (Kernel Mode Setting) parameters.  Grub2, the default Debian bootloader, allows these parameters to be set quite easily in the config file.  I changed /etc/default/grub by adding the following lines:

GRUB_GFXMODE=1024x768
GRUB_GFXPAYLOAD_LINUX=keep

Running 'sudo update-grub' will refresh the bootloader configuration with the new parameters.  After rebooting I was presented with a nice, clear (and much larger) grub boot screen.  Success!

This was short-lived however.  By the time the machine had reached a login prompt the framebuffer driver had kicked in and had overridden my attempts at reducing the resolution.  FOILED!

Getting nowhere with the framebuffer documentation meant that I needed an alternative approach... BIGGER FONTS!  In Debian the console font is set by default using the console-setup package.  To get a feel for which font to chose I had a look in /usr/share/consolefonts and used the 'setfont' command to try a few out for size.  In the end I found that TerminusBold16x32 worked very well.  To make this change permanent I reconfigured the console-setup package:

sudo dpkg-reconfigure -plow console-setup

Keyboard config

Now that the screen was usable I decided to fix the keyboard.  I had two niggles.  The first was that the keyboard repeat rate was very slow.  On Linux this can be controlled using the kbdrate command.  I experimented a bit until I found settings that I liked, then transferred the parameters to /etc/kbd/config:

...
KEYBOARD_RATE="30"
KEYBOARD_DELAY="250"
...

The next annoyance was the behaviour of the function keys.  By default these are mapped to various multimedia functions.  I prefer them to be in their standard F1..12 mappings.  To change this a simple option in the BIOS can be used.  Mash F2 on boot and navigate on the settings menu to POST Behaviour->Fn Lock Options.  On this screen just change the setting to "Lock Mode Enable/Secondary" to regain easy access to the function keys.  Apply and reboot.

Debian on a Dell XPS13: Part 1 - Installation

The Hardware

When I needed a new developer laptop I decided that portability and a good display were high priorities.  After some research I decided to opt for Dell's 4th generation XPS13 Developer's Edition.  Cramming a 13" screen into a machine barely bigger than a standard 11" laptop was an appealing concept.  The fact that Dell are actively supporting Linux is also very attractive.

Machine duly ordered.  Obligatory wait as the hardware ships from the other side of the world.  The laptop arrived with Ubuntu 14.04.  Time to clean it up and install my preferred Linux distribution.

The Software

My goal was to install Debian 8.0.  I've been a Debian user for many years - probably going back to the late 90's.  It's a solid and reliable distribution which finds a good compromise between features and stability.  As it was just released I chose to try out the latest version - Jessie 8.0.

Initial installation

My first attempt involved the usual process of downloading a small-ish net install image and writing it out to a bootable USB stick.  Mashing the F2 key and selecting the UEFI USB boot option soon brought up the familiar Debian installation screen.  All went well until it was time to bring up the networking...

... oh dear.  Broadcom BCM4352 isn't supported in the stock installer...

No problem.  I completed the base installation without networking then jumped back to my other machine and downloaded the broadcom-sta-dkms package from the Debian repository.  Installing the package yielded another problem...

... oops broadcom-sta-dkms depends on DKMS which depends on a whole pile of GCC build tools...


At this point I realised I was about to head down a dependency chain I couldn't keep up with by simply downloading packages.  Instead I grabbed a copy of the larger Debian DVD disc 1 ISO and copied the file to a USB stick.  Having mounted up the USB stick on the XPS13 I told apt about the new source as follows:

# sudo mount -o loop /media/rightusb/debian-8.0.0-amd64-DVD-1.iso /media/cdrom
# sudo apt-cdrom add --cdrom=/media/cdrom -m


Once this was done a simple 'sudo aptitude update' followed by an 'sudo aptitude install dkms' allowed me to finally install the broadcom-sta-dkms driver.

Post installation network config

As soon as the driver was installed and working it was a simple process to get the wireless network up and running.  I used the info from https://wiki.debian.org/WiFi/HowToUse#wpa_supplicant as a guide to getting my WPA connection configured.

Tidying up

With the network running I edited the system sources.list to my usual config:
deb http://ftp.uk.debian.org/debian jessie main contrib non-free
deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
deb http://security.debian.org/debian jessie/updates main contrib non-free
deb http://http.debian.net/debian jessie-backports main

A quick round trip to aptitude brought the base installation up to date with the latest security fixes.  I now had a usable (but basic) system.  Part 2 will describe some of the initial tweaks I made to make the system more usable.