Debian survival guide

First published: August 25, 2012
Last updated: August 31, 2012

Introduction

In 2012 I started using Debian GNU/Linux for my day-to-day workstation OS, after many years of using Arch Linux. I made the switch mainly to avoid the headaches of a rolling release system (I loved Arch for its simplicity and minimalism - I honestly don't care at all if 90% of my programs are not the latest version). I never made an Arch survival guide because, frankly, I didn't need it. Arch is so simple and unsurprising, and the Arch Wiki is so damn good, that it was never at all difficult for me to figure out how to do something. Not so with Debian, sadly. This document collects things that I've learned which I either thought were not obvious and hence should be documented for others' benefit, or which I was sure I'd forget and have to look up again each time I needed it.

When using this page, follow the golden rule of getting Unix help off the web: Don't run commands you've never seen before without at least taking a cursory glace and their man page and convincing yourself that they do indeed do what you want! This goes double for commands that need to be run as root.

It is entirely possible that information on this page is out of date, incomplete or flat out wrong. I'm only human. If you think something here needs to be updated, expanded or corrected, please send me an email. Credit will be given for all contributions.

Quick links

Filesystem stuff

Language support

Laptop support

Package Management

System administration

Filesystem stuff

Using FUSE

So, you've installed FUSE, you've done insmod fuse as root, and your FUSE stuff still isn't working? Add your user to the fuse group by running, e.g., adduser luke fuse and then log out and back in.

Still not working? Have a look at the permissions of /dev/fuse. Is the group set to fuse, or root? It should be set to fuse, but apparently sometimes this doesn't work. This happened to me once: I did an apt-get purge fuse and then apt-get install fuse and it worked. I don't now what determines whether this works or not. The time it broke for me, I'd installed fuse (as a dependency of encfs) using aptitude, but the time it worked I'd installed it using apt-get. This could be relevant, or it could be totally unrelated.

Language Support

Setting up Japanese input

I sometimes need to type in Japanese (on those rare occasions where my Japanese is actually up to the task of translating an entire thought I have), so I wanted to be able to switch between English and Japanese input modes with a convenient key combination. This was actually pretty easy to achieve, using this blog post as a starting point (the discussion below largely follows this post) and this Debian wiki page for some extra insight. This solution uses something called IBus, which is not the only way to solve this problem, but it works for me so far.

First of all, you'll need to install some Japanese fonts. The following list has worked fine for me so far:

ttf-kochi-mincho ttf-kochi-gothic ttf-sazanami-mincho ttf-ipafont-gothic ttf-ipafont-mincho

Now, install and setup the relevant locales and also some input mode switching stuff:

$ sudo aptitude install locales im-switch
$ sudo dpkg-reconfigure locales

Now, install IBus and also the kasumi dictionary package:

$ sudo aptitude install ibus ibus-anthy kasumi

If you are a KDE user (or otherwise prefer Qt GUIs), also install ibus-qt4. If you are a GNOME user (or otherwise prefer GTK GUIs), also install ibus-gtk.

Now run im-switch -c and select "Use IBus". Then run ibus-setup. This will ask you to start an IBus daemon and you should say Yes. Under the "Input Methods" tab, add "Japanese - Anthy" and do any other configuration you like.

After you've done that ibus-setup will tell you to put some environment settings into your .bashrc file. The Debian wiki page linked above says you should put them in .xsessionrc instead, at least if you are using KDE. It probably won't hurt to put them in both just to be safe as long as they are the same settings in both places.

Now, the IBus daemon that ibus-setup started for you? You need to make sure that runs each time you start X. Apparently KDE has its own idiosyncratic system for taking care of this, but I just run ibus-daemon -d -x -r from my .xinitrc file, like God intended. I believe this should work no matter what desktop environment or window manager you use.

Once all this is done, you should be able to use Control and Space to toggle between English and Japanese. If you'd prefer another combination, you can set that up in ibus-setup. If you have a system tray, you should see a little keyboard and mouse icon that will switch to a gold crown when you're in Japanese mode.

Laptop support

Getting your laptop to sleep when the lid is shut

I'm not exactly sure how best to advise you to achieve this, because I figured it out after a lot of trial and error and it's not clear to me which things I did were actually essential and which wouldn't have mattered. I think the following should be enough (at least, it was on my Thinkpad X60s, it may take more work on other hardware).

Make sure you have the packates acpi-support and pm-utils installed. I am pretty certain these are essential. I also have laptop-mode-tools installed, but I think you can get away without that.

Edit the file /etc/default/acpi-support and look for the bit that says:

# Uncomment this to enable ACPI sleep when the lid screen is closed.
#LID_SLEEP=true

and uncomment the LID_SLEEP line as instructed.

Doing a restart of the acpid service at this point is probably a decent idea, although maybe you could get away without it:

/etc/init.d/acpid restart

Shut the lid and see if it works!

Package Management

Listing all installed packages with versions

From this thread at Super User I learned a way to list all currently installed packages, without truncating their names, and with the current version. Just run:

dpkg-query -W -f '${status} ${package} ${version}\n' |
sed -n 's/^install ok installed //p'

This is, of course, far too complicated and ugly a command to use on a regular basis for such a trivial task, so set up a shell alias so you can invoke it with list-packages or somesuch.

Compiling testing packages on stable

Coming soon...

Fighting dependency bloat (or: I tried to install a really simple command line utility and apt-get wants to install 50 MB of unrelated crap!)

One thing about the apt packaging system that I really like is that is has an unusually fine-grained system for relating one package to another. A package can "depend" on another (meaning "this package will not work without that one"), or "recommend" another (meaning "this package will be a lot more useful or in some other way better with that one") or "suggest" another (meaning "maybe you want that other package too, or maybe not").

Some things about the apt packaging system that I really hate are that a lot of the people who make packages seem to have no idea what these three things are supposed to mean so they make everything a dependency, that there appears to be no pressure from the community to stop/fix this, and that when you apt-get install something you get the dependencies AND the recommendations unless you explicitly say otherwise.

The result of the above is that even if you're trying to set up a really lean system you can easily find yourself pulling in all kinds of completely unrelated crap.

To lessen the bloat somewhat you can use apt-get install --no-install-recommends foo instead of just apt-get install foo. This will install foo and only the dependencies, not the recommendations. Just try running both versions of the command on a few packages and look at the difference. It can often be a lot.

If you don't want to have to remember this option every time you install something, you can put the line:

APT::Install-Recommends "0";

in /etc/apt/apt.conf (don't forget the semi-colon!) and then you can just use apt-get forever after without worrying about pulling in recommendations.

Of course, this does nothing about all the bogus "dependencies" floating around. You could, I assume, crack open the relevant .deb file and tinker with its insides so it doesn't report bogus dependencies, but that remains advanced voodoo to me at this point. If you know a simple way to tell apt to ignore particular dependencies, please let me know.

System administration

Configuring which services start on boot

Like most Linux distros (Slackware, Arch and Crux being some exceptions), Debian uses the Sys V init system, which is a mess of directories and symbolic links that you probably shouldn't attempt to manage by hand. One way to configure which services you want started at boot time is to install the rcconfig package and run it as root. This will give you a fairly simple ncurses menu with which to enable/disable services.