Introduction

This is intended as an FAQ / Tips page to do with managing a Debian system. It's a work in progress, so make sure that if you find something useful, and it is not listed, that you add it. I'll get around to categorising this list, but these tips are answering a lot of questions that appear on the mailing list.

Apt-get returns the error: "E: Dynamic MMap ran out of room"

This is caused because the cache is too small to handle all of the packages in the flavour of Debian that you are using. The fix for this is trivial, just add the following line into /etc/apt/apt.conf:

APT::Cache-Limit 12582912;

If that file does not exist, create it. If you still get the same error, increase the value.

How do I list all the packages I have installed?

The easy way is to do:

dpkg -l

But this has issues since some of the package names are truncated due to the column width. A more accurate way is to do:

COLUMNS=200 dpkg -l

You can further define that command by showing only those packages which are installed:

COLUMNS=200 dpkg -l | awk '/^ii/ {print $2}'

For additional information about this, there's some excellent examples on the ManagingPackages/Apt page.

Reinstall all packages

Sometimes there is a need to reinstall all packages currently on your system. This can be achieved by:

COLUMNS=200 dpkg -l | awk '/^ii/ {print $2}' | xargs apt-get --reinstall install

Note the use of the environment variable 'COLUMNS' which ensures that the package names are not truncated on output. A value of 200 is usually sufficient for those packages that have long names.

Removing leftover files after removed packages

If you remove a package without purging it, configuration files related to that package are left behind. If you want to remove these leftover files, you can run:

COLUMNS=200 dpkg -l | awk '/^rc/ {print $2}' | xargs dpkg --purge

Removing dependencies of packages no longer required

This is often related to meta-packages which are empty packages depending on a large number of packages so that a suite of applications can be installed ('build-essential' and 'gnome-desktop-environment' are such examples). Removing these meta-packages is perfectly valid, and will leave the dependencies behind (although aptitude may well remove them). If you wanted to remove the dependencies as well; and you are using apt-get; you can use debfoster and deborphan. Deborphan was originally written to handle removing libraries and so to get it to recognise packages that are not libraries, run:

deborphan --all-packages

Installing a package and ignoring its dependencies

I'm often asked "How do I install a package and not install its dependencies". The answer is that you don't. If you do, you can be expected to sort out the mess yourself since you must have had a good enough reason to ignore it in the first place. If you're still sure you know that you want to disregard the package handling, read dpkg --force-help, although until you fix the dependencies manually, you won't be able to use apt-get. That said, there might be a valid reason whereby you need to fool the system into thinking you have a package installed. In such instances you should use equivs, but this not meant as a replacement to fix dependencies.

How do I install a .deb file?

dpkg -i ./the_file.deb

How do I extract files in a .deb file?

dpkg -x ./file.deb /some/directory

Can I clone an existing Debian install on another machine?

Sure, here's how. On the machine that has all the packages installed that you want replicated to another machine, as root, run the command:

dpkg --get-selections > ./selectionfile

After the base install has finished on the other machine, copy the "selectionfile" to this machine and run the command:

dpkg --set-selections < ./selectionfile && apt-get dselect-upgrade

This will then install all of the packages from the list specified.

How do I stop packages being upgraded when I update my system

By default when you install packages on your system, the next time you go to upgrade it those packages will be updated. There are times when this is not desirable (such as wanting to retain a copy of an installed package you had made yourself). To stop a package from being updated, you can use:

echo "packagename hold" | dpkg --set-selections

How do I upgrade packages that are on hold?

In addition to the answer above, the reverse of that is:

echo "packagename install" | dpkg --set-selections

If you want to upgrade all held packages regardless, you can tell apt-get to do so:

apt-get --ignore-hold upgrade

Although this does not affect the state of a package afterwards, it just causes apt to conveniently forget about the status of all held packages for the initial update. To make the change to a package's status permenant, you'll want to use the first example.

Note also that putting packages on hold this way means that they will be ignored by aptitude, should you be using that. This is a known bug. You have been warned.

I installed unstable by mistake. How do I downgrade?

You don't. Short answer, eh? The reason being that to do so is a pain in the arse. It's possible, but unless you like to play 'pinning' games with apt, the canonical answer is to reinstall, this time using the correct flavour of Debian. For the curious, a good reference is here: http://people.debian.org/~osamu/downgrade.html

An alternative is to amend your source.list file to use testing sources, and wait a long time before upgrading. After a few months, the packages in testing will be of a newer version that those that were in unstable when you installed it. Running the usual apt-get update && apt-get dist-upgrade combination will install the packages that have newer versions in testing. Note though that there's no guarantee that the packages in testing will be newer that those that were in unstable. I refer to this technique as "sidewaysgrading".

I want to install a newer version of a package not available in Stable

Since the packages that stable contains is set in stone, the version that you install them at will remain at that version. This can sometimes be problematic, since you may well want a newer version of a package installed. This is where backports are handy. There are two main sites for these:

http://www.backports.org<<BR>> http://apt-get.org

If you cannot find the package you want in either of these you can always grab the source package and build it yourself. The following achieves that:

Add a deb-src line for unstable in /etc/apt/sources.list, something like:

deb-src http://mirror.ox.ac.uk/debian/ unstable main
apt-get update
apt-get build-dep packagename
apt-get -b source packagename

This will then pull the dependencies of the package you're after and build it against them for inclusion on your stable box. Note that this is not always a good idea, and you can break your system if the dependencies have changed significantly.

Debian doesn't use an /etc/rc.{boot,local} file?

/etc/rc.local or /etc/rc.boot are the boot scripts used by BSD / Redhat / SuSE. It's lazy, and you should use other means under Debian. If you simply try and create an /etc/rc.boot file under Debian, it won't get read. The proper way of doing it is to use the sysvinit method via the command update-rc.d (see /RunLevels for more information). Although this can sometimes be daunting. If you simply wanted to have a script run at startup, you can create an /etc/rc.boot directory, and place your script(s) inside that directory. You should ensure that the file permissions are set to 0755; both on the directory, and the scripts contained therein.

I can't compile anything, what do I need to install?

apt-get install build-essential

What's the difference between an upgrade and a dist-upgrade?

Upgrading software on your machine involves installing newer version of packages that are available. Like many people this will involve the use of the internet, whereby packages are downloaded from mirror sites. If you're using Debian Stable, then the only new releases you'll get are security ones. If you're not, then these packages will be downloaded as needed.

An upgrade (via apt-get upgrade for example) will only install those packages which do not depend on packages not yet installed on your system. So for example, let's say that there was an upgraded package "cowsay" that you had installed on your system. If that package's depenencies are already installed on your system then it will be installed without fuss. If the "cowsay" package dependencies however, showed that there were some packages not installed on your system it would be "held back". This is why when you upgrade you sometimes see many packages held back.

A dist-upgrade however will upgrade all packages regardless of whether the dependencies are installed already or not. Generally this is the option that most people use when upgrading their system.

When I do an update, I get lots of packages held back, why?

See the answer above. What you want to do is:

apt-get -u dist-upgrade

Do I have to do anything special when a new stable release is made?

That depends on what you have in your sources.list file. Depending on how you installed your system you may find that you have a line that looks like:

deb http://mirror.ox.ac.uk/debian/ stable main

If you're using the word "stable" as opposed to the nickname of the distribution (e.g. "Woody" or "Sarge") then a dist-upgrade when the stable release is made will upgrade you to the new release. If, however, you are using the nickname, liek "Woody" or "Sarge" on your deb lines, then you will have to ensure that you change that to the nickname of the new stable release as and when you want to upgrade to it.

So, using the nicknames gives you more control over when and whether you upgrade to a Debian release, but requires a little more work when you do want to upgrade. Using the release type (e.g. stable) means that you have less to do to upgrade, but you will upgrade to the new version when it is released.

Note that when a new stable release is made, the security releases for the old version it will remain usually for up to six months post Sarge's release. But by that time, you'd have upgraded... For more information see the /DebianReleaseProcess page.

Debian no longer asks me configuration questions when I install new packages

First of all, this could simply be because the package in question doesn't have any questions to ask you. However if you know that it does, and you're not seeing any, run the following:

dpkg-reconfigure debconf

and select "dialog".

How do I re-run the configure screen for a specific package?

Debian's "configuration" program is handled by "debconf". This is what certain packages use when asking questions. To run it for packages you can do:

dpkg-reconfigure &lt;packagename&gt;

If you are unsure of the package name, you can install and use the package configure_debian. In this way, you can then run the command: configure_debian and use the menu-based navigation screen to select the package(s) that you want to reconfigure.

My keymap is messed up at the console. How do I fix this?

dpkg-reconfigure console-data

Sound works for user 'root' but not for others

This is to do with the fact that the audio device (/dev/dsp) is group owned by 'audio', but none of the users are part of that group. To correct this, run:

adduser &lt;username&gt; audio

Ensuring that if the users you are adding; are logged in at the time you ran the above command, that they logout and log back in again for it to work.

How do I install mplayer?

Due to licensing issues, mplayer cannot be shipped with Debian officially. However, debs are available. Add the following line to /etc/apt/sources.list:

deb ftp://ftp.nerim.net/debian-marillat/ etch main

Replacing etch with whatever flavour of Debian you're using. Then run apt-get update. You'll have to run apt-cache search mplayer to choose an appropriate package as it is built for different architectures and whether X support is wanted, etc.

How do I install X11?

The canonical answer for Stableis:

apt-get install x-window-system xserver-xfree86 mdetect read-edid

Which will pull down all of the standard X11 programs as well as the main Xserver. Note that Sid and Etch, Xorg is used instead, hence the command:

apt-get install x-window-system xserver-org mdetect read-edid

If you want to install Gnome or KDE, then you should install gnome-desktop-environment or kde respectively.

How do I stop {x,g,k,s,w}dm from loading at bootup?

Unlike other distributions, Debian will launch your DM (display manager) throughout run-levels 2->5 inclusive. To stop the DM from loading you can do:

echo false >> /etc/X11/default-display-manager

Which will simply load nothing, and return you to the login(1) prompt at the VT. To restore your display manager, remove the word "false" from the file. You might also want to read about /RunLevels.

Why can't non-root users mount a data CD?

The answer to this is all to do with permissions. The following shows what my cdrom looks like:

[[n6tadam@station|~]]$ ls -l $(readlink -f /dev/cdrom)
brw-rw----  1 root disk 22, 64 Apr 30 01:27 /dev/hdd

I use $(readlink -f /dev/cdrom) here, because I want to see what the /dev/cdrom symlink points to. In this case it is /dev/hdd -- it may well be different, depending on which channel your cdrom drive sits.

But, non-root users are (and should never be) not a member of group 'disk' since this would effectively give them root-like powers on that device (and other devices that are a member of that group). Therefore, what needs to be done is for the group ownership on the device to change to something a little more "safe", *and* for the non-root members to be a member of it. Conveniently, the 'cdrom' group is used for this. Hence the following command.

chgrp cdrom /dev/hdd && adduser <username> cdrom

So that now we see:

[[n6tadam@station|~]]$ ls -l $(readlink -f /dev/cdrom)
brw-rw----  1 root cdrom 22, 64 Apr 30 01:27 /dev/hdd

You should ensure that the user logs out and logs in again so that the group ownership is assigned correctly.

Help... my Sid machine stopped working half-way through an upgrade. Now what?

Well, that's your own fault for not checking the status of packages beforehand. Given that Sid is Unstable, you should be fully expecting such breakages. But that is not to say that there is not any way around it. If you realise that there is a problem with a package, check the BTS (Bug Tracking System). Anyone running Unstable should have apt-listbugs, apt-listchanges and reportbug installed. reportbug is useful since it allows one to use querybts to check the status of bug numbers and packages. Apt-listbugs will tell you that a package has a grave bug and will give you the option of rejecting it.

See also the answers above about putting packages on hold.

How can I see a list of available window managers / desktop environments?

apt-cache showpkg x-window-manager

While that command will show debian-packaged window managers (and desktop environments), a great resource for all known WM/DEs under Linux can be found here:

http://www.xwinman.org/

How can I manage which services are started at init?

This isn't really Debian specific, although there are a number of tools that Debian uses. The main one that every flavour of Debian has is update-rc.d which is used to enable and disable symnlinks in /etc/rc?.d (see /RunLevels for more information). From Sarge onwards there is the rcconf program which works similar to services under RH; providing a dialog interface to enable/disable services. If you're using Woody, then you will need to get a backport of this program

It's worth pointing out that update-rc.d is more geared towards install scripts. Using it by hand from the command line is awkward at best. If you simply create or delete the symlinks in /etc/rcX.d, you will not break anything, and it's much easier to use than update-rc.d.

While viewing mc (or some other command-line based application) in an Xterm, I get odd characters. Why is this?

This is most likely to do with your locale settings. You've either setup locales incorrectly, or not chosen the right one. See the /ForeignCharacters page for instructions on fixing this.

Is it possible to log the output from init as services are starting?

Yes, see this page: /BootLog

Why does X11 retain its config settings, even after I reconfigured it?

If you hand-edit your X configuration file, dpkg-reconfigure xserver-xfree86 will no longer work. To see if this is the case, you can use md5sum to compute the difference between that file, and the file debconf uses:

md5sum /etc/X11/XF86Config-4 | diff -sq /var/lib/xfree86/XF86Config-4.md5sum -

If the files differ, then it won't work. To fix this, you'll have to do:

md5sum /etc/X11/XF86Config-4 >/var/lib/xfree86/XF86Config-4.md5sum

as root, then re-run: dpkg-reconfigure xserver-xfree86, losing any manual changes you might have made.

Note that in Sid, Xorg is making its way into the repository -- in which case, the dpkg-reconfigure xserver-xorg command, handles the fact that a change has been made to the /etc/X11/xorg.conf file -- so there's no need to do the above.

When I boot into Windows on my dual boot computer, why is the system clock always an hour behind?

This is because Debian thinks that the system clock is set to UTC but Windows thinks the system clock is set to local time. Change the setting UTC=yes to UTC=no in /etc/default/rcS.

Xsane does not find my scanner

A window appears with the message "no devices available" and a help button gives additional information

   Possible reasons:
   1) There really is no device that is supported by SANE
   2) Supported devices are busy
   3) The permissions for the device file do not allow you to use it - try as root
   4) The backend is not loaded by SANE (man sane-dll)
   5) The backend is not configured correct (man sane-"backendname")
   6) Possibly there is more than one SANE version installed

Maybe the problem is with one of the above, but the place to look first is at the command

  groups

to make sure you're a member of the scanner group.

LinuxHints/DebianTips (last edited 2010-11-01 21:00:03 by AdamTrickett)