Debian Linux Hints and Tricks

Written by Clifford Yapp (smustudent1@yahoo.com)
Created June 16, 2001
Last updated June 24, 2001
Development stage: Alpha

Debian Linux is a Linux distribution with several distinguishing characteristics, including one of the best package management systems in the world and a reputation for stability. As a consequence, Debian Linux typically does not include the newest versions of software in stable releases, preferring to use older versions which have had more time to be tested. If you wish to use the more current software, typically it can be found in the unstable and testing branches (more on this later) rather than the stable branch. It is not a distribution typically recommended for first time Linux users, but for more experienced users the power it offers is well worth the time it takes to learn it. Here, in addition to discussing some of Debian's unique features, there are included some of the configuration tricks that may help smooth the way for a first time Debian user.

Software Installation and Tracking

Software upgrades are typically the most painful of tasks for computer users, regardless of operating system. Debian Linux, through a combination of hard work and good design, has largely solved this problem with the apt-get system.

A full discussion of the apt-get system is beyond the scope of this document - see the full documentation for a discussion of setup, syntax and specific commands to use in a given situation. (Debian users have the basic system set up in the install process, so normally installing the system isn't an issue.) What we will do is discuss the problem it solves. Say, for example, you want to get a new version of Abiword, a Linux word processor. You have an older version, but you want to upgrade. This would be fine, except the new Abiword also depends on some other software, which also needs to be updated. The problem is, you have some other programs which depend specifically on that version of the software. Ordinarily this would involve a rather labor intensive process of updating packages in the correct order and possible recompiling some of them. While recompiling is great, it sometimes means you have to edit options in the source code or possibly even update a bit of code. On Debian, however, every package installed is checked before upgrades occur, and problems are either solved by suggesting updates from the Debian package archives, or the exact problem is pinpointed and you can focus your efforts on exactly what you need to do, rather than guessing what the problem is. All you need to do is tell the system to apt-get the new version of Abiword, and if all goes well all you have to do is confirm apt-get's choice of upgrades. This is the best system upgrade tool I am aware of - there is even a global command to check the Debian servers and update all packages for which an update is available. The Debian servers host one of the most extensive collections of Linux software anywhere, so more often than not the program is available. This system is sufficiently different from other package management methods to keep new users guessing, but once mastered it's hard to give up.

Note: the default Debian system by itself does not keep track of software installed from source code or unpackaged binary (in other words, software downloaded directly from the developer's website or some other source of files which is not aware of the Debian system) so I'd advise checking out a package called instmon (also available as a deb package) in order to keep track of source file installs. instmon can output a .deb file to enable the apt system to track the files and make uninstalling easier. Another useful deb utility is debfoster, which helps locate older packages not needed by the system after updates which can be removed to save space.

The Debian Menu System

The Debian Menu System is an excellent piece of work, which allows universally uniform placement of applications in window manager menus. It is a great tool to have. The one problem is, sometimes I just gotta be me and customize the menus. Since I suspect I'm not the only one, we will go over how to customize the menus.

I'll preface this with a warning - this worked for me, but probably is not the "official" way to get this job accomplished. The menu documentation is the place to go if you want to know how to create nice, standardized menu files. So, with that off my chest, we'll proceed.

We'll start with the case of wanting to group some applications into a different menu directory than they already are. For example, let's say we want to move the gv program from Graphics to Viewers, and we want to make the adjustment globally, so we won't have to keep doing it for our other accounts. In the /etc/menu directory, we create a new text file with the same name as the file for this application in the /usr/lib/menu directory. It's contents will look something like this:

?package(gv):needs=X11 section=Viewers\
title="gv" command="/usr/bin/gv"

So now there will be an entry in the Viewers directory for gv, provided the window manager uses the Debian Menu System. The entry in /etc/menu will still be valid even through an upgrade, so having made the file once there should be no need to do it again unless the package name should change. We will show two more entries for the /etc/menu directory - an entry to remove a file entry from the menu without removing the application and an entry to create a menu entry for a non-apt based program (i.e., a program which was not installed with a deb file.) For the first case, it is simply a matter of having pattern look for nothing. Let's say we want to remove amaya from the menu - we would insert the following into a file called amaya in /etc/menu:

?package():needs=X11 section=Apps/Net/Browsers\
title="amaya" command="/usr/bin/amaya"

For the non-debian program, let's assume we installed the newest version of lyx from sources, and it's not in the menu system. We add the following to a file in /etc/menu:

?package(xfree86-common):needs=X11 section=Apps/TeX/\
title="Lyx" command="/usr/bin/lyx"

The file name in this case is unimportant. In may be unimportant in the other cases as well, but here I am sure it doesn't matter. Also, the package being searched for is unimportant, so long as it is installed. I believe if you preface a package name with the word local, i.e. "local.foobar", it is always assumed to be installed. That would be another way to achieve the purpose, but xfree86 is a pretty safe bet as long as you are working with a window manager. You can also place multiple entries in a single file, to keep track of them more efficiently. I have a file called custom in which many entries for non debian programs are kept. (I suppose there is a great irony that I need them, considering how I mentioned how large the Debian archives are, but the Debian team is devoted to the ideal of free software and as a result there are some worthwhile applications which have not found their way into the archives. Prosplitter is an example.)

Keybindings in Debian

Debian Linux often has as its default setup a keybinding layout that is not what most people would expect. A common problem is the backspace key not working as expected. The fix works like this: In your home directory, create a file called .Xmodmap, or open it if it is already present. In that file, place the following line:

keycode 22 = BackSpace

Now restart your x session. The login manager may or may not read this file, but once logged in you should be fine. If the key still fails to work, add this line to your .xsession file:

xmodmap .Xmodmap

and try again. This is unfortunately a stubborn problem, so if this fix doesn't work for you the next place to try is probably the email lists.

I have also included the following set of modifications. They serve the purpose of allowing a graphics application called Blender to use the numerical keypad. The numpad is a standard tool in Blender, and credit for the Debian fix goes to someone on the blender forums. Anyway, this series of bindings will make blender work well with Debian.

keycode 79 = 0xFF95
keycode 80 = 0xFF97
keycode 81 = 0xFF9A
keycode 83 = 0xFF96
keycode 84 = 0xFF9D
keycode 85 = 0xFF98
keycode 87 = 0xFF9C
keycode 88 = 0xFF99
keycode 89 = 0xFF9B
keycode 90 = 0xFF9E
keycode 91 = 0xFF9F

Remote X Windows Applications

The security restrictions imposed by Debian Linux are usually a good thing, but if you want to allow your computer to display applications running on another machine you must make some changes to the way Debian runs the Xserver. Apparently it has something to do with X being started with an option not to listen for TCP connections. That's only the first hurdle, however. If you need remote applications but still want reasonable security (you probably do, unless you trust your network a lot) there is some more setup you need to do. Once I've actually figured it all out I'll write it up in detail here - for now, see the Remote X Apps mini-HOWTO.

Blender:

See the section on keymaps for the Blender fix.

Emacs:

I have several emacs tips, but most are specific to some specialty mode. I'll start with the general one:

Color and Size of Main Window: The default Debian style for emacs isn't my favorite - I prefer the green look and small window of Redhat. That is configurable, and by adding the following lines to the .Xdefaults file you can get the Redhat look for emacs:

emacs, xemacs
emacs*Background: DarkSlateGray
emacs*Foreground: Wheat
emacs*pointerColor: Orchid
emacs*cursorColor: Orchid
emacs*bitmapIcon: on
emacs*font: fixed
emacs.geometry: 80x25

Syntax Highlighting: There are a wide variety of opinions on the use of syntax highlighting - some people like it, some do not. Me, I love it. So add this to your .emacs file in your home directory to enable syntax highlighting:

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)

AucTex: If you write LaTeX or TeX in emacs, you need AucTex. It is a truly excellent emacs mode, with many helpful abilities and commands. Once installed, add this line to .emacs to use it:

(require 'tex-site)

gnuplot-mode:

Gnuplot is a standard in the unix world, and there is an emacs module for it. After downloading and installing it, this is what to put in your .emacs file:

;;--------------------------------------------------------------------
;; Lines enabling gnuplot-mode
;; move the files gnuplot.el to someplace in your lisp load-path or use a line like
;; (setq load-path (append (list "/path/to/gnuplot") load-path))

;; these lines enable the use of gnuplot mode
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)

;; this line automatically causes all files with the .gp extension to be loaded into gnuplot mode
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))

;; This line binds the function-9 key so that it opens a buffer into gnuplot mode
(global-set-key [(f9)] 'gnuplot-make-buffer)

;; end of line for gnuplot-mode
;;--------------------------------------------------------------------

Netscape:

In order to remove unnecessary GUI buttons from Netscape 4.*, add these or similar lines to your .Xdefaults file:

Netscape*toolBar.search.isEnabled: false
Netscape*toolBar.destinations.isEnabled: false
Netscape*toolBar.myshopping.isEnabled: false
Netscape*toolBar.print.isEnabled: false

Xterm:

I usually prefer a lot of scrolling text memory in xterms, especially when working with source files or big archives. Here is what I use in my .Xdefaults file for xterms:

! xterm (and friends)
XTerm*scrollBar: true
XTerm.VT100.titeInhibit: true
XTerm.VT100*dynamicColors: on
! Number of lines of scrollback to save
XTerm*saveLines: 1500
xterm*reverseWrap: true
*visualBell: true
*scrollTtyOutput: False
*scrollKey: True
Scrollbar.JumpCursor: True

Links


Comments, questions, suggestions, corrections? They're all welcome, so send them to smustudent1@yahoo.com.


Copyright © 2001 Clifford Yapp (smustudent1@yahoo.com). This document is released under the OpenContent license.