|
||
| < index > | ||
Hands-on Guide to the Debian GNU Operating System | ||
Hands-on Guide to the Debian GNU Operating SystemDavor Ocelic
2. IntroductionThe Guide is available under the terms of the GNU GPL license, and you should probably read it after you successfully install the Debian GNU system on your computer (with or without the help of the Debian installation guide). This is a step-by-step document with many examples, which should relatively quickly answer most of your questions and help you build the correct mindset to solve further problems on your own; I am known for repeating that the idea and logic count, not the exact implementation or usage details (I am all for the "give man a fish and he can eat today, teach a man to fish and can eat forever" principle here). I tried to make it a balanced mix bewteen the administrator's and the user's guide; it is probably too broad for those who belong to either of the two extreme categories. The approach I used should fit home users best - people who do have a Debian installation and a root access at hand, and want to learn and experiment. We will properly define basic terms, explain the system design goals, cover the most important end-user issues and show many command line examples. Since this is a Debian guide, we will not hesitate to use Debian-specific features and commands, but note that most of it (ideologically, at least) applies to other Linux or Unix systems as well. Finally, by saying this is a beginner's guide, we definitely don't restrict ourselves to system basics, I believe the guide is hiding many beautiful details that even experienced users might find useful or amusing. Please note that all the fine information presented here can also be found in respective packages' documentation and is more detailed and comprehensive there. Therefore, it is implicitly suggested to read official software and system documentation in combination with this guide (the dpkg(8) and apt(8) manual pages are perfect to show there's much more of it than we mention here). Generally, www.tldp.org (former linuxdoc), www.debian.org and www.debian.org/doc, /usr/{doc, share/doc, local/share/doc} directories, and the man and info pages on your system are the right information sources. After you finish reading this guide, you'll probably want to read other on-topic manuals available from the Debian documentation directory. 2.1. Official "Hands-on Guide" download siteshttp://debguide.sarovar.org/ or http://sarovar.org/projects/debguide/ http://www.debian.org/doc/manuals/hands-on/ 2.2. Acknowledgements
3. Conventions
4. Basic theoryLet's use this chapter to identify some common misinterpretations and properly define the terms we will use everywhere in this document. We'll start with general terms, such as Unix, GNU or Free Software, and then say something about the Debian Project itself. A little glossary of the various terms that you'll be encountering is provided in the appendix. Let's start. 4.1. UnixIn earlier versions of this document, I used to say that Unix was a common name for a group of superior operating systems which shared most of the key design ideas. While there was nothing wrong with that statement, I went to search the Internet for some more formal explanations: Short introduction on the UGU site says:
Similar and more detailed description from searchSolaris:
4.2. Free Software, GNU and LinuxSome time later, Richard Stallman, a MIT hacker, started an initiative to create a completely free operating system (free as in freedom). Among other things, his decision was based on frustrations and problems he saw in non-disclosure agreements. They once prevented his colleague from giving him the source code for a laser printer driver (Stallman wanted to include automatic paper-jam notification features). Highly motivated to do The Right Thing (tm), he later quit the job at MIT (so they couldn't possibly claim copyright on his work) and, in 1984, started the GNU ("Gnu's Not Unix") project, whose goal was to protect freedom and supply users with full-featured free software packages for their computers. GNU is a wonderful philosophy that could surely affect non computer-related areas as well. You can see the original Stallman's announcement from Sep 27, 1983 / 10:35:59 PST in the excellent Google Groups archive! GNU developers have re-written all the necessary Unix system tools and utilities, released them as Free Software (under the GNU GPL licence), and they only needed a kernel to accomplish the initial goal. Independently, in 1991, Linus Torvalds (from the Helsinki University) announced his first public release of the kernel he was working on - Linux. He was a student back then, and wanted to create a cheap alternative to high-priced Unix systems, which would run on PC (i386) compatible machines. Combining the Linux kernel and the GNU tools, the free GNU/Linux system became a reality. Linus wrote the kernel from scratch ("from zero") and it was one of the first free Unix-like variants which, supported by the great GNU community and their software, got the Free Software movement really going (from the general-public perspective, not technically, of course). All the way back in 1994, Peter van der Linden wrote the following in his excellent book, titled “Expert C Programming; Deep C Secrets” (ISBN 0-13-177429-8):
However, there were other efforts, such as those by the BSD people who still had problems with the licensing issues and copyrights, but they have rewritten all the parts in question and released free BSD variants: FreeBSD, NetBSD and OpenBSD.
4.2.1. Open SourceOpen Source is a somewhat newer term which was generally accepted to help promote Free Software in commercial environments. It relies only on practical benefits of open source code (quality, reliability, cost of maintenance) and has no greater philosophy behind it. More information can be found at the Open Source Initiative (OSI) website. It is therefore important to know the disctinction between the two.
4.3. GNU kernel - The HurdIt is interesting to mention that Linux is a monolithic kernel and shares many ideas with its Unix counterparts. However, the GNU people have a different vision of how kernels should look like and they are working on The Hurd microkernel. Debian GNU/Hurd port is in progress, and you can see the current status or download the software from the Debian GNU/Hurd port page. Monolithic and microkernels are fundamentally different, and there's been much of debate if microkernels would ever prove useful in real-life application. Linus Torvalds, for example, is constantly bashing microkernel operating systems ("just say NO to drugs, and maybe you won't end up like The Hurd people"). Alan Cox, the maintainer of the production tree of the Linux kernel, who has more sympathies for The Hurd, once said that The Hurd was more about Richard Stallman's idea about how a system should work to promote community than about high perfomance OS design. Technically, The Hurd and microkernels in general do offer many advantages over the traditional Unix kernels; those interested in getting more information should see hurd-paper.html and hurd-talk.html (for The Hurd), or the QNX website (for the proprietary, mature, microkernel-based Unix). 4.4. The Debian GNU system, its design goals and basic ingredientsLet's quote something from the official About Debian page:
5. Basic system managementAs we've just covered a bit of the theory, we'll now move on to the basic system administration issues. We will start with basic topics (with software installation, for example), then cover the hardware configuration principles (including the graphical X Window System), suggest generally good things to do with fresh Debian installations and provide help and examples for common software packages. 5.1. Package managementThe first thing we will take a closer look at is the Debian package management system. We'll take a tour of dpkg(8), apt(8) and other package management related tools. What we're referring to when we say package management is the set of tools we use for browsing, installation, configuration and removal of software packages.
If you're not specifically interested in all the details and command line switches at the moment (that is, if this is just your easy late night reading ;-), then just briefly remember the command names and their purpose, and skip down to the Getting familiar with system messages subchapter. 5.1.1. dpkgdpkg is a medium-level package manager for Debian. Unless you run into problems with apt-get, you will generally not have to use it directly. Most notably, dpkg does not have the automatic package retrieval methods, and does not resolve dependencies on its own.
5.1.2. dpkg-reconfiguredpkg-reconfigure is a tool you use to reconfigure debconf-enabled packages (those which use debconf to ask questions and get answers about the local configuration).
5.1.3. aptThe apt package provides a few command-line tools you will need to successfully use apt-get(8), the tool for high-level package management. 5.1.3.1. apt-setupapt-setup (beware, from the base-config package) opens up a ncurses-based apt configuration tool. Basically, it asks a series of questions and then updates the package files (you can do the same manually by editing /etc/apt/sources.list and running apt-get update). Also check the netselect package, which should select the fastest mirror servers for you automatically. It can sometimes come handy to do telnet linuks.mine.nu | tail -n 5 > /etc/apt/sources.list to retrieve the apt sources for the Debian unstable branch. For more exotic apt sources, check www.apt-get.org. 5.1.3.2. apt-cdromIf you have the packages on your cdroms, you will use the apt-cdrom utility to index them.
5.1.3.3. apt-getapt-get is an apt package handling utility. It is probably the most convenient way to install or remove packages, as it automatically calculates dependencies and adjusts package lists. While dpkg allows you to install any .deb file (provided you have the appropriate .deb file saved locally), apt-get does not. It uses the /etc/apt/sources.list file as its list of 'package sources'; it parses them and creates a big list of all available packages. So whatever you do, you're restricted to packages known to apt. This is both powerful and elegant way to deal with package management, and some of the complicated tasks (such as the package or whole distribution release upgrades) become so easy with Debian GNU that you will hardly believe it! Other, rpm-based distributions are trying to catch up with apt, either by reimplementing the logic in their own programs or porting apt to their systems, but of course, Debian always knows better so stay with the winning team.
5.1.3.4. apt-cacheapt-cache can be used to query the dpkg package database.
5.1.3.5. apt-rdependsapt-rdepends performs recursive dependency listings similar to apt-cache. It searches through the APT cache to find package dependencies, and it knows how to emulate the result of calling apt-cache with both depends and dotty options. By default, it shows a complete dependencies listing. 5.1.3.6. Graphically representing package dependenciesapt-cache dotty takes a list of packages on the command line and generates output suitable for use by dotty from the GraphVis package. The result will be a set of nodes and edges representing the relationships between the packages. By default the given packages will trace out all dependent packages which can produce a very large graph. This can be turned off by setting the APT::Cache::GivenOnly option (man apt_preferences). The resulting nodes will have several shapes, normal packages are boxes, pure provides are triangles, mixed provides are diamonds, hexagons are missing packages. Orange boxes mean recursion was stopped [leaf packages], blue lines are pre-depends, green lines are conflicts.
5.1.4. grep-dctrlThe grep-dctrl utility greps Debian control files. The grep-dctrl program can answer such questions as
It is a specialised grep program that is meant for processing any file which has the general format of a Debian package control file, as described in the Debian Packaging Manual. These include the dpkg available file, the dpkg status file, and the Packages files on a distribution medium (such as a Debian CD-ROM or an FTP site carrying Debian). For instance, too see all the packages for a maintainer, do:
For a lot more usage examples, see the grep-dctrl(1) man page. 5.1.5. debfoster and deborphanTools to weed out unnecessary Debian packages. Their use is trivial. For example, to remove all unnecessary packages, you could do:
5.1.6. dpkg-repackdpkg-repack package provides us with a tool to bundle installed packages back into the .deb format. If any changes have been made to the package while it was unpacked (ie, files in /etc modified), the new package would inherit the changes. This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system, but no longer available elsewhere.
5.1.7. dpkg-divertdpkg-divert overrides a package's version of a file. File diversions are a way of forcing dpkg not to install a file into its location, but to a different location. Diversions can be used through the Debian package scripts to move a file away when it causes a conflict. System administrators can also use it to override some package's configuration file, or whenever some files (which aren't marked as 'conffiles') need to be preserved by dpkg, when installing a newer version of a package which contains those files. I used it in our ttysnoop+ssh setup (see below):
5.1.8. dpkg-statoverridestat overrides are the way to tell dpkg to use a different owner or mode for a file when a package is installed. This can be used to force programs that are normaly setuid to be installed without a setuid flag, or only executable by a certain group. See the dpkg-statoverride(8) man page for details. 5.2. Getting familiar with system messagesIt is very important to learn how does the system communicate with its users (or administrators). One can always find the exact source of the problem and take appropriate actions (simple, proven-to-be-useful tasks help in almost any situation), so this is why the chapter had priority in the final document layout. 5.2.1. Boot messagesDuring the boot, the system kernel prints out a lot of interesting information (unless the quiet option was passed to it). The copy of the messages is saved in the /var/log/dmesg file (which does not grow with time). The dmesg command, however, will show you the last 4 KB of recent kernel messages. 5.2.2. System logging daemonUnix machines have a standardized way for programs, applications and daemons to send messages to the global system logger (syslog). There are many syslog implementations available; with Debian, you can choose betweeen the default traditional BSD sysklogd, syslog-ng and metalog. Each message has an indication of the facility (message source) and severity (importance level). The date, time, host and process information is automatically generated by syslog, and should not be a part of the message itself. The syslog daemon distributes messages to files, pipes, remote destinations or users, using the schema specified in the /etc/syslog.conf file (for the traditional BSD sysklogd). All the logs from a vanilla ("out of the box") Debian system are written to files in the /var/log/ directory.
To collect all system messages (for strictly educational purposes :) in a single file, add a line like this in /etc/syslog.conf:
[TAB is there to warn you that you really have to press the TAB key, spaces don't do it right]. Then create an empty /var/log/allmessages file (choose your favorite, both variants here do the same):
And just reload the sysklogd daemon configuration:
Now go to some idle virtual console, and type (see the tail(1) man page):
Do something to your system (for example, logout, login or use 'su' on another console, and watch messages appear!). This is an excellent way to learn more about the system and how it works. Also, you can detect any anomalies and error reports that would otherwise go unnoticed. If you are writing shell scripts, or modifying your ~/.bash_profile, you can use the 'logger' command to log your messages via syslog.
5.2.3. Logging ppp messagesIt is nice to have all ppp logs go to /var/log/ppp.log; the 'plog' command will then work as expected. The following will add a line to /etc/syslog.conf and restart the syslog daemon (we used the traditional BSD sysklogd in the example):
5.3. The X Window System, basic principles and Debian setup5.3.1. The XFree86 Project, an open-source X Window System implementationFrom www.XFree86.org:
5.3.2. The X Strike Force: XFree86/X Window System support for DebianVisit the X Strike Force homepage. 5.3.3. XFree86 InstallationDebian potato (2.2) is shipped with XFree86 version 3.6.6, while Debian woody (3.0) has XFree86 version 4. See current status at the X Strike Force homepage. X4 brings a lot of improvements and is now standard in Debian. There's not much difference from administration perspective, but notes will be put where appropriate. You can install basic X support, the icewm window manager and the wdm display manager with:
5.3.4. XFree86 Server ConfigurationWhen you install the packages, the configuration process will start automatically. If you don't get it right the first time, you can always re-run configuration with:
The interface is very clean and should help you create working XFree configs in no time. In case of problems, inspect the config file (/etc/X11/XF86Config-4 or /etc/X11/XF86Config) manually to make sure you have the right Driver option, and that UseFBDev option is set to false (these are the most common errors).
5.3.5. Tuning the resolution in XWhen you start X, it picks the default color depth, loads in the list of available resolutions for the given depth, and displays the highest one. You can then cycle over other pre-defined resolutions with Ctrl+Alt+'+' and '-'. All this is set up in /etc/X11/XF86Config-4. Here's an excerpt from the configuration for 16bit colors with default resolution 1024x768:
To explicitly start X with 16bit colors (if there's no DefaultDepth option or it is different), use:
If you want to further experiment with refresh rates and resolutions, either manually tune VertRefresh, HorizSync and Modeline (in X3 only) definitions in X config file, or see OpenBSD's X tuning guidelines. 5.3.6. Device autodetectionTo take advantage of some kind of device autodetection, see the following three programs:
5.3.7. The client-server modelSince X is a client-server based model (as are most other things in Unix), it means you have a whole new domain of features at your disposal. We'll discuss them now.
5.3.8. The Direct Rendering Infrastructure (DRI)Here's a little introduction from the Documentation/Configure.help file (the kernel-doc-* packages):
5.3.9. XFree86 NotesX3 has fewer drivers and you must install specific drivers for specific groups of graphic cards (for example, xserver-rage128, mach32, mach64, i128, 3dlabs, agx, 8514, s3v etc...). In X4, we solve this by only installing xserver-xfree86, which is modular and loads the appropriate modules at runtime. Also, the config file is /etc/X11/XF86Config-4 for X4, and just /etc/X11/XF86Config for old X3. Generally, only use X3 on old machines where you want to save some memory. 5.3.10. Troubleshooting
5.3.11. Window managersNow you have X window system running. Let's make this clear: You need the X server because it knows how to communicate with your hardware and actually display graphics. But that's all it does. How your interface really looks like depends purely on the 'window manager'. If you listened to me, you are probably running icewm now, but there are others (when you install them, they become the default or show up in wdm's login menu). Try wmaker, blackbox, afterstep, xfce or enlightenment. Also try twm and fvwm at least for historical reasons, to understand the Unix folklore ;) If you install GUI environments like Gnome or KDE, you won't have to worry about window managers as they will aready be taken care of. Don't be disappointed by the look of wdm or icewm (tastes difer), you have plenty of other variants to choose; Definitely check out the Window Managers for X website. To get a program which shows you graphical login (so you don't have to log in the console and type startx every time), install package wdm (or any of its relatives; xdm, kdm or gdm). Also, you will be able to select which window manager to use from the wdm's menu. You can also run X without the window manager (usually for testing purposes). Try starting xinit. 5.3.12. Fonts for XFonts you might want are found in xfonts-* packages. Type this command to search for them:
If you are interested in using the Microsoft ttf fonts, there are font servers which can handle them, and I'd recommend you try xfstt. No fonts come with it since they all have non-free licenses. That means you have to get the ttf fonts yourself, copy them to /usr/share/fonts/truetype/, add FontPath “unix/:7101” to /etc/X11/XF86Config, execute /etc/init.d/xfstt restart and then restart X. To browse installed fonts, see the xfontsel and gfontview programs. Also, check out the http://www.linuks.mine.nu/fonts/readme file. Actually, X4 can deal with TrueType fonts directly, you don't need the ttf-enable font server; simply add the ttf FontPath in the X config file. TODO: find the fontpaths for all xfonts- packages and list them here 5.3.13. Gpm (the console mouse driver) and the XFree86You will most probably have problems with gpm and XFree86 running at the same time. The solution would be to set repeat type to 'raw' in gpm's config and mouse device to /dev/gpmdata in X config file, but that doesn't always give usable results. I prefer to shut down gpm. 5.4. Virtual consoles5.4.1. Virtual consoles setup in /etc/inittabAlmost all GNU/Linux distributions ship with predefined 'virtual terminals' - completely separate text screens or consoles which are available with left Alt + F1-F6 keystrokes (only 6 consoles are enabled by default). You can also use the command-line method to switch between them (see the chvt command), and you can open them automatically with the open command. To add more virtual consoles, edit the file/etc/inittab (as the superuser, of course) and add more lines like those:
[You can see which fields have to be incremented]. For changes in that file to take effect, exit the text editor and type init q. If you create more than 12 consoles, you won't be able to access them with left Alt (since the last F key you have is 12), so use right Alt key to reach consoles 13 - 24. You can also use Alt + left_arrow or right_arrow to cycle through open consoles. Alt+print_screen key switches between two last used virtual consoles. If you are switching from X to the console, you need to use Ctrl+Alt, instead of just Alt. The deallocvt command frees memory still associated with virtual terminals which are no longer in use [by applications, not you of course]. This is not so important anymore, since you probably have plenty of ram and few kilobytes mean nothing to you. 5.4.2. VGA fonts sizes in the consoleIf you don't like such big letters in the console, execute this:
This would set up LILO parameters on the next boot (linux vga=ask), and reboot the machine (since vga mode can only be set at boot, unless you mess with 'svgatextmode' package - but don't do that). When you find a nice vga mode, you should edit /etc/lilo.conf and make it permanent there:
[X is replaced with the actual value you like, try '6' for example]. Then, run 'lilo' to apply changes. If you see the penguin in the upper left corner of your screen, you are using a framebuffer (VESA mode). In that case, there are more screen modes available to you, see the table on the Framebuffer HOWTO page. 5.4.3. Font types for the consoleInstall the fonter package and you will be able to edit/create your own fonts, or use some of the standard ones you get:
5.4.4. The console keymapsTo see current keyboard mappings, you would simply do:
After you tune the 'keymap' file to your needs, load it back with the loadkeys command. To see just how advanced the idea of the Linux console is, run the loadkeys program, and type the following in its prompt:
Then just press the F1 key to see the consequences. 5.5. Shutting down the systemSome of the commands you can use:
To reboot:
Sometimes the shutdown -c (shutdown cancelation command) comes handy. You can also use Ctrl+Alt+Del (in the console) to reboot, and this behavior is controlled from /etc/inittab. 5.6. General notes for hardware supportGetting a piece of hardware to work is a fairly easy task (although it wasn't so in the past, so always show the due respect for the developer community). Basically, you have to be able to categorize the hardware and know how the specific devices are usually configured under Debian GNU or Linux.
Debian GNU sports a nice tool for kernel module configuration - the modconf utility. However, the whole story with kernel modules is trivial. You have three basic commands (modprobe, rmmod, lsmod) and a bunch of modules in the /lib/modules/`uname -r` directory to choose from. For instance, to load the driver for a 3Com network card and an onboard AMD VIA audio chip, you would do (so, without modconf):
And to make the modules load at each boot, you'd add them to the /etc/modules file. If you want to use it this way, you must know the module names. Until you get some experience, use modconf.
5.7. Enabling the mouse in text consolesIt is nice to have a mouse working in text consoles; you can copy just by selecting the text, and you can paste with buttons 2 or 3. Install the gpm package and it will automatically ask you for configuration. If you want to delay it, or you don't get it right the first time, you can always re-run the config tool later (it's called gpmconfig). Here's an example for you: for my wheel mouse, I answered this to gpmconfig questions:
Test the config and enjoy. 5.8. Hard disk throughputTo see how good can it be, use the hdparm utility, switch to 'single' mode and test it:
On ~1 Ghz PC machines, you should see cache reads of about 180 MB/sec (although this number has virtually no limit, on newer machines you get 500 MB/sec in a blink), and unbuffered disk I/O of about 30MB/sec on IDE disks (unless you're lucky enough to have those new and shiny 70MB/s IBMs). Things vary, though. If you see poor performance (it can get as low as 2MB/sec), recompile the kernel and test it after that; you'll most probably see enormous improvements. Another great speed improvement comes from enabling DMA, say:
You can add the above command near the end of the /etc/init.d/bootmisc.sh and it will be re-activated on every machine boot (which is what you want). To sum up, unbuffered transfers of 25 MB/sec or more are okay for the traditional PC IDE disks. If you feel lucky, use hdparm and try to fine-tune the hard disk parameters even further; see if it does any good for you. Once you're fine with the performance, remember to adjust the line in /etc/init.d/bootmisc.sh. 5.10. Firewalls5.10.1. What is a firewallThat question would wave made little sense a few years ago (before 1997) but it seems to be a must today, when most computer-related things are just dumbed down and hidden behind graphical interfaces, and children waste their time practicing skills they have no or little use for in the real world. Anyway, on to the subject. Running an Unix machine involves a great deal of responsibility, especially today when people have high-speed Internet connections at their homes; Unix systems don't basically make a difference between physically local and remote users. Anyone who gains access to your machine (especially to privileged accounts) can use it to compromise you and other hosts on your network or attack other Internet sites and cover his tracks. Depending on the type and success of the attack, sometimes the only solace you have is the physical access to the machine and the ability to reinstall it (let alone the backups you didn't make). Therefore, we will now introduce you to firewall software:
This means we will use a firewall to control access to our machine, keeping in mind that we distinguish connections initiated by us, and those initiated by the remote ends.
5.10.2. Firewall setup in Debian GNU/LinuxFree software firewalls have evolved. The old Linux 2.0 kernel series used ipfwadm, 2.2 had ipchains and the current stable 2.4 branch sports the shiny netfilter, sympathized even by those who always preferred BSD systems for that part of the job. The user-space part (for netfilter) is covered by the iptables package, which is a rather low-level interface to the firewall functions so some people (yes, we too) tend to use frontends; I found ferm to be The Frontend. ferm is a 'firewall rule parser for linux designed to maintain and setup complicated firewall rules'. Fair enough.
We will now see what a generic home-firewall setup looks like. The policy we will follow is: drop everything, permit only port 113, manually specified IPs and traffic initiated by our side. You should read ferm man page and the examples in /usr/share/doc/ferm/examples/, but here's my suggestion to get us going:
To make the rules active:
You could also add this command to the /etc/ppp/ip-up script, to have it start automatically, whenever the dialup link goes up. 5.10.3. More protectionUnless you are playing games under Wine or WineX, you could be interested in applying the grsecurity patches to your kernel (see apt-cache search grsec). You could also install the Prelude Hybrid IDS (Intrusion Detection System) on your machines. 5.11. Setting up IP Masquerading/NATMultiple computers can all share the single connection (to the Internet usually) installed on the gateway machine. The procedure to set it up is trivial:
To make client side changes permanent, add 'gateway' option to the /etc/network/interfaces file. Also, make sure the /etc/resolv.conf files on client machines are valid (copy from the main machine would do if you substitute references to 127.0.0.1 with the server's IP as it is seen from the local network).
5.12. System login procedure, the shell startup and config files5.12.1. The system gettyWe've mentioned the /etc/inittab file before. During the system boot, the init process (it always has the PID 1, it's the first process the kernel runs) reads that file and (among other things) initializes the virtual consoles, usually by starting the getty program on them. The system getty opens up a login prompt on the specified consoles and waits for users. When you enter an username and password, your authentication request reaches the PAM layer (Pluggable Authentication Modules), where it gets checked for validity (using the /etc/pam.d/login rules); the check usually includes reading the /etc/passwd, /etc/group and /etc/shadow files and verifying the user's password and expiration dates. Please note that we are talking about the defaults here, the PAM system has endless configuration options, and it wouldn't be hard to make it use the retina scan instead of passwords to authenticate users. The PAM was originally developed at Sun Microsystems, but the Linux people maintain a fairly compatible Linux-PAM tree. For the complete Linux-PAM user, administration and developer manuals, see the PAM documentation at kernel.org FTP site (the documentation is not on www.tldp.org).
5.12.2. The login shellIf the PAM layer gives you a green light, the login program spawns a shell for you (exactly which shell is specified in the last field of your /etc/passwd record). The shell then:
5.13. Regular user accountsIf you are logged in as root, create a new regular user account with the 'adduser' command and reopen this guide in it. To illustrate why using root account for user tasks is strongly discouraged, I will quote a good summary by Debian users on IRC channel #debian@OPN:
If you visit #debian on irc.openprojects.net, and people see you are logged in as root, they will most definitely harass you about it. You should always be logged in as a regular user, and change current user ID (to root) only when necessary, using the 'su' command (or install advanced control mechanisms, such as 'sudo'). 5.14. Switching to root account without a passwordHowever, the problem is that you always have to type in the root password when you want to 'su' to root. To avoid this (that is, to enable 'su'ing to root without a password), edit the /etc/group file, and insert this line (anywhere):
and in /etc/pam.d/su, uncomment this line (remove the # char at the beginning, or copy this line there if you don't have it):
That will allow users named 'username1' and 'username2' to type 'su' and become root without a password. Also, it will allow them to start processes as root on command-by-command basis with su -c '/command/to/execute with arguments'.
5.15. Account login regulationSince most of the accounts on your machine will be used locally by you, you don't want people logging in remotely, do you? (they first need an account password for that, but they might get it easier than you think). Edit file /etc/security/access.conf, read short info there and add something like this to the file:
This denies login to username1 and username2 accounts from all locations except your own machine.
5.16. Tcp wrappersTcp wrappers are a standard part of Debian, and allow you to simply control access to system services (mostly to those started from the inetd meta daemon). If you want to deny all services to remote addresses, make sure the file /etc/hosts.allow is empty, and put this in /etc/hosts.deny:
For more information (including on how to trigger system commands upon incomming requests) read hosts_access(5) and hosts_options(5) man pages.
5.17. Manually unpacking .deb filesFrom time to time you wish to unpack a .deb file to see its contents (or to recover some system files). Fortunately, Debian's .deb files need no special tools to be unpacked, they are simple 'ar' archives containing two files: data.tar.gz and control.tar.gz. Here are some examples:
5.18. Checking the MD5 sums of installed Debian packagesIt is often useful to verify the files on your system, either to detect unauthorized modifications or just to find out which files you once modifed and then forgot about them.
5.19. Shared sessionsTerminal sessions shared by more than one concurrent user can be very useful. On a few occasions, I was asked to remotely tune machines (such as sound card drivers or XFree86 support), and the other party wanted to keep a complete track of my actions (for educational and controlling purposes). It is possible to achieve that effect by using either screen or ttysnoop. 5.19.1. screenUsing screen to make shared sessions is very easy, but it requires both parties to cooperate (so you must trust the other end) and involves shared account passwords (which is a bad thing if it becomes your habbit). All one must do is to login as say, 'username1' (ssh -l username1 localhost) and run 'screen', then wait for the other party to log on to the system (under the same username, of course) and run 'screen -x'. (This tip was provided by electr0n@OPN). 5.19.2. ttysnoopttysnoop is a trivial but very convenient tool that can be used to share, monitor or control user terminals. Enabling ttysnoop on your machine is dangerous; it could violate your security policy or leave the system in an unusable state if not done properly. The ttysnoop itself doesn't need any special setup (except the /etc/snooptab file maybe) if both parties cooperate (one starts the ttysnoops server, and the other starts the ttysnoop client). However, installing it so that the ttysnoops gets started during the login does require a few changes in the system configuration files. We will show here how to replace the system's login binary with ttysnoops and how to enable it for ssh connections. The procedure is delicate, as we said already, so we will comment each line you are about to execute in your shell.
You can test the setup locally (but the same idea applies to remote logins, of course):
When letting people log in remotely to your machine, ssh is strongly-preferred way to connect. Do not even bother with telnet (which is an unencrypted and insecure service). If you have special needs or demand telnet anyway, check out working configurations from the sample /etc/snooptab files. 5.20. Runlevels and system services5.20.1. System boot and the init processThis is a very interesting and important part of every Unix system. In most common scenarios, you have LILO installed as the bootloader. LILO (the LInux LOader) accepts parameters on the command line, but Debian has been configured (in default configuration) not to show the LILO boot prompt. To make it appear, hold the Alt key at the 'LILO' message (during boot, just before you see the 'Loading linux ....' message) and you'll be able to pass arbitrary parameters to kernel. You can type anything there, and it will later be visible in the /proc/cmdline file. After the kernel gets loaded, it starts 'init' as the first system process. Init executes the tasks defined in the /etc/rcS.d directory. Init then enters default runlevel 2 (other Linux distributions mostly use runlevel 3 as the default) and executes the tasks defined in the /etc/rc2.d/ directory. Init directories consist of symbolic links to files in /etc/init.d/; here's an example:
The 'S' prefix starts a service, while 'K' stops it (for the given runlevel). The numbers determine the order in which the scripts are run (0 being the first). init then excutes local scripts from /etc/rc.boot/ and performs the rest of init tasks specified in /etc/inittab. 5.20.2. Manipulating /etc/rcX.d/ linksDebian provides a convenient tool to manage runlevels (to control when services are started and shut down); it's called update-rc.d and there are two commonly used invocation methods:
The first line shows you how to remove the xdm service from startup; the second sets it back. xdm is a basic implementation of the graphical login screen. You could disable it if you prefer console logins (although nothing is stopping you from using both at the same time), or you could try xdm alternatives, such as kdm, gdm or wdm. 5.20.3. Manual service start/stopAll files in /etc/init.d/ share a common invocation syntax, which is defined by Debian Policy. All system services have their init script there (usually named as the service itself) which accepts generic arguments. Let's see an example:
5.21. The Debian 'alternatives' systemThe Debian distribution comes with a lot of software packages and chances are you can choose between a few different applications that basically perform the same task; you can even have them all installed and peacefully coexisting on the system. Since we speak of Debian, there intuitively has to be an elegant way to set system defaults; and yes, there is one: the 'alternatives' system. Here's a similar introduction and an example from the update-alternatives(8) man page:
To actually configure the mentioned 'editor' alternative, simply type:
For a list of possible alternatives, check out the /etc/alternatives/ directory. You will most likely want to tune the 'x-window-manager' and 'x-session-manager' choices. 5.22. Periodically checking for the available disk spaceIt is very important to monitor disk usage. If the disk becomes full (especially on your /home partition), you will probably damage your config files or even lose data. XFree86 won't even start if there's no free disk space available. A simple crontab script which would just send you a daily disk usage reminder could be created this way:
Make sure to then edit the /etc/crontab file to adjust the time at which the cron.daily/ parts are run (it defaults to 06:25 AM). 5.23. Creating and extracting file archivesIn Unix, you traditionally group ('tar') many files into a single one, and then compress it using a compression alghoritm (gzip for example). We will show here how to create and extract tar, tar.gz and tar.bz2 archives.
For zip, rar, arj or cab files support, use the apt-cache search command to find the packages you need to install. 5.24. Copying, mirroring and re-downloading Debian packages5.24.1. Re-downloading all installed .deb packagesYou might want to do that for mirroring or backup purposes, or to burn a CD set with satisifed dependencies. The trick can be achieved with:
After the download finishes, you should see all the .deb files in /var/cache/apt/archives/. Also, see the apt-move sync method below, maybe that's what you really need. 5.24.2. Setting up a Debian mirror or an apt source on the local hard diskThis subsection could be of interest to you if you want to copy Debian CDs to your disk (so you don't have to change cdroms in the drive all the time) or export the Debian mirror to the machines on your local LAN. The easiest way to copy Debian CDs to your hard disk would be to use the dd tool and directly create CD images:
You would then mount the image like this (of course, you add it to /etc/fstab if you want it permanent):
An example sources.list entry would look like this:
5.24.3. Using apt-move to move packages into the local hard disk repositoryIf you have enough disk space, you'll find apt-move very convenient. You can use it to copy the cdroms to the disk, sort the downloaded files from /var/cache/apt/archives, or stay in sync with your local Debian mirror.
5.25. Package recompilationDebian software packages come precompiled for many architectures. In the case of Intel-compatibles, those packages are optimized to work with all variants from i386 up. However, it means that all the system binaries you have use nothing from the advanced features found in modern processors (Pentiums for example). There's been much of a debate if local recompilation of packages would give any advantage, but the general (and sane) conclusion seems to be this:
5.25.1. Building .deb packages from sourceTODO: source_builder.pl, apt-get --build, cast fakeroot dpkg-buildpackage -uc -us Installing software from generic .tar.gz packages - the checkinstall project (apt-get install checkinstall) 5.25.2. dpsyco - Debian Packages of System ConfigurationsDpsyco is an acronym for Debian Packages of System Configurations and you can create and maintain "configuration packages" with it. A configuration package is a package that resides "on top" of the normal debian packages. You can overwrite normal files, patch the system, add users and groups and much more.
5.25.3. equivs - inform dpkg about localy installed packages
5.26. Linking to your local Internet Service Provider5.26.1. Dial-upsYou don't have load any drivers to support your modem. It's done automatically, the generic 'serial.o' driver takes care for serial port communication, and all normal modems understand the AT command set. If you have a winmodem (braindamaged modem which lacks one $5 chip and its work is loaded onto machine's CPU), then just forget it (however, there is a LinModems website, if you don't want to listen the voice of sanity). 5.26.1.1. pppconfigType pppconfig (as root) to create a new connection and define configuration parameters. You'll probably get it right just following the menus, but let me give you some some guidelines:
5.26.1.3. Connection statisticsThere are plog and pppstats from the ppp package. You could also install the 'pppstatus' package for a really nice real-time monitor.
5.26.1.4. Troubleshooting
5.26.1.5. Alternatives to pppconfig/pon/poffpppconfig, pon and poff are superior tools. However, you could try another program, wvdial. The advantage of wvdial is that it can automatically detect what type of authentication your ISP accepts (and if it doesn't succeed, try setting "Stupid Mode = 1" in /etc/wvdial.conf). 5.26.2. ADSL with pppoeSurprisingly, the adsl+pppoe setup is trivial with Debian. Install the pppoe package, find out the exact name of your provider (by sending the PADI packet) and read last notes in README.Debian:
5.26.3. I'm connected to the Internet, now what?Make sure you have the ircii package installed (or some other variant of irc client, such as console irssi or graphical xchat and kvirc). Then connect to the IRC server (irc.debian.org, which is a part of the FreeNode network [former "OpenProjects"]) and join channel #debian:
You can ask for help and advice there, or just hang around and collect useful tips.
5.27. The package popularity contestLet's just quote the popularity-contest manpage which says it all:
5.28. Accessing data on MS Windows partitionsType 'fdisk -l' and you will see the list of partitions on all disks you have in the machine. Ignore everything (including warnings) except partitions which are of type FAT16 (for older Windows) or NTFS (for that Neandertal Technology (tm) stuff or newer). See this example output:
We have two physical disks, which are called /dev/hda and /dev/hdc. Windows partitions we are searching for are named /dev/hda2 and /dev/hda5 (see? it says FAT16 and NTFS there). Now create /mnt/hda2 and /mnt/hda5 directories (using the 'mkdir' command) and edit /etc/fstab to make your changes permanent:
As root, type 'mount /mnt/hda2' and windows data will be there, under /mnt/hda2/. The same procedure applies to the hda5 partition. By adding the above to /etc/fstab we ensured it gets mounted on every boot. If you don't want that, add the 'noauto' option to the Options field ('defaults,ro'). Also, replace 'ro' with 'rw' if you want full read-write access. Also, to mount MS windows partitions, you need appropriate kernel module support, but Linux loads it automatically. See 'lsmod' output, you should see 'vfat' or 'nfts' there after you mount some windows partition.
6. Linux processesIn this chapter we will explain the processes and the way they run under the Linux kernel. Furthermore, you will learn common methods to start, stop and control them. 6.1. IntroductionIn order to get us clear on what the word "process" really means, I searched for a formal, fluent explanation from the WhatIs database:
Processes in Linux work in isolated memory areas (called 'segments') and if a process starts behaving badly, it surely won't affect the rest of the system. 6.2. Basic process-related commands6.2.1. Process listsTo see the full list of current processes on the system, type:
And the sample output would be:
Column names are in the first row. A few explanations are in order:
6.2.2. System, processor and memory information6.2.2.1. uptimeThe uptime command reports current time, machine uptime, the number of login shells and the machine load:
6.2.2.2. freefree displays the amount of free and used memory in the system:
6.2.2.3. topThe top command is an interactive process monitor which shows system, processor and memory status, and the periodically updated list of most intensive system processes. 6.2.2.4. Other commandsOther interesting commands include sar, iostat and mpstat (from the sysstat package), vmstat (from the procps package), the graphical lavaps and native Gnome or KDE frontends. 6.2.3. Misc commandsThree commands we definitely can't miss are strace, lsof and fuser. Maybe you won't use them right now, but consider this as an investment for the future. The strace tool traces system calls and signals; its output could be overwhelming for you, but that's where the manpages and practice come into play.
lsof is an extremely useful tool that will give you a list of all open files (on a system or process basis).
Finally, the fuser command will tell you which processes keep the specified file in use.
6.3. Two distinct types of executable filesA process is, as we said already, an instance of a program. A program can either be a compiled (binary) file, or a script which needs an interpreter to run. Install the file package now, so that we can use the file command in our demonstration. The /bin/ls program is an example of a binary file:
Let's see what file says for some other system executables:
Now we know that dpkg and apt-cache are compiled, binary executables as well. We also know that the pon command is actually a Bourne shell script and the 822-date is a Perl script. Try viewing them in a text editor. From the Unix system perspective, there's no real difference between the compiled and script executables. All the files need to have the exec bit set to be considered executable. File modes and permissions won't be explained here, see the Debian User Reference Manual, section 4.4 for an explanation. In addition to the exec bit, script files need to contain a "shebang" line, the special directive which specifies the intepreter to invoke if none was specified on the command line (in case you just type /usr/bin/822-date instead of perl /usr/bin/822-date, or /usr/bin/pon instead of sh /usr/bin/pon). Let's check out the first few lines from the 822-date script and verify our predictions (don't get confused here, we are interested in the first line only):
Very well. This section actually has the purpose to teach you the following three things:
6.4. How to start a process
6.5. How to terminate a process
6.6. How to put a process to sleep?By sending a signal to it:
When you start a process in foreground, and it takes your prompt away, you can press 'Ctrl+z' to put it in background and stop it. Later you can issue bg or fg (to resume it in the background or foreground). You can even put it in the background, and then at some later point use fg to get back to it (but not after you close the controlling terminal, because logout disassociates the tty from the process). You can also press CTRL+s and CTRL+q on a process STDIN channel (usually your terminal) to pause/resume it. 6.7. Process prioritiesLinux (and other Unix) systems have a way to specify the priority of a process, which is (on Linux) in the range from -20 (absolute priority) to 19 (which runs when there's nothing else to run). The kernel process scheduler is a serious piece of software and it works as expected (unlike schedulers found in some non-Unix systems). Regular users can only use values from 0 to 19 (and 0 is the default). To run a program with altered priority (for example, 'top'), do:
6.8. Processes and their input/output functionsGenerally, each process will open 3 communication channels:
In a typical user session (just typing 'ls', for example), all three are open to your terminal - it's the place where you input information, and the place where the application outputs any info for you (including errors). However, those communication channels (or more formally 'file descriptors') may be opened to a socket, pipe or any other place you can think of (including as input to another program or remote computer). Let's look at an example: (grep will search all files and print file lines which contain the string '/var/log/messages' in them):
Obviously, one part of output is valid data (reports from syslog.conf and syslog.conf,old), and the other part are error messages ('Is a directory' and 'Permission denied'). Now examine the following slightly modified commands and their descriptions:
6.9. Leaving processes running while you're awayYou might want your processes to run while you are not logged in. The first trick is to use nohup or '&' at program startup time (as we mentioned before). If you already have it running, you might protect it with 'disown -h' (but you won't find the disown's man page, it's one of bash shell's built-ins, and is described in bash(1) manpage).
The superior way is to use the screen utility which allows you to resume complete sessions. Use Ctrl+a,d to detach and screen -r [ID] to resume a session. Familiarity with screen comes handy on remote Unix shells or systems which don't have virtual consoles yet (such as The Hurd). 7. Using Debian GNU7.1. Common keystrokes
7.2. Terminal settingsFor more on terminal settings, see the: setterm(1), reset(1), tput(1), tset(1), stty(1), termcap(3) and terminfo(3X) man pages. We'll cover them only briefly here:
Also, check out the console_codes(4) man page. 7.3. Learning and using the vim editorThe Unix core is text based and your primary input device should be a keyboard. I can understand that you most probably won't be attracted to an open source OS until you see the Gnome or KDE graphical desktop environments, but when you decide to get deeper in the system, you'll value your keyboard. Having a text editor (not the word processor, note the difference!) of preference is a must with Unix; almost everything you do will somehow be related to a plain text format. Most people would tell you to start with joe, nano, pico or some graphical editor ("just until you get the grip"), but I consider this approach to be wrong. Text editing is too important a task to be learned the wrong way from the beginning. After all, there's nothing to be learned about those editors - they are simple, functionality-limited, and their common keystrokes are listed at the bottom of the screen so you should understand the whole story the first time you start them. The category of professional text editors is reserved for the two old rivals - Richard Stallman's GNU Emacs and Bram Moolenaar's Visual IMproved (or the old traditional vi). As you should have guessed from the title, I prefer vim, but there's no doubt both editors are professional, and one's personal preference should be respected. I don't want to harass verified Emacs users, they have my permission to skip the rest of this subsection. VIM is the professional programmers' text editor. Apart from having ultra fast keystrokes, macros, abbreviations, editing modes, syntax highlighting and keyword completion, it can literally solve it's way out of a maze (see /usr/share/doc/vim/macros/maze/). To install vim and the related tools, you would typically do:
Maybe the biggest advantage of vim (or plain old vi in this context) is that it is probably installed on every Unix system you can think of. If you ever get to using some of the traditional Unix operating systems, you'll thank me for it :) Additionally, you can use vim as the default text editor inside your Gnome apps, using the Bonobo system (and there is a standalone, graphical interface to vim - gvim). KDE users should see kvim. A very important thing to note is that vim supports a few different editing modes. When you run it, it automatically enters the command mode, meaning that you can't just start typing; letters would be interpreted as commands, not the characters you'd like to appear in the text document. The most trivial thing you could do is to type "a" or "i" (Append or Insert) when you want to enter the insert mode (so that you can actually type something in your document). To save and quit, you'd press ESC (which switches back to command mode) and type ":wq" (to Write and Quit). The subject is, of course, too complex to cover here; I'll point you to "vimtutor" and few external resources:
7.4. The readline key and function bindingsFire up the bash(1) man page, press /^SHELL BUILTIN COMMANDS (to search for that phrase at the beginning of a line), and then search for 'bind' (type /bind). More information can be found in the /usr/share/doc/bash/ directory. 7.5. User configuration filesAs you probably know by now, standard Unix system users do not have write permissions everywhere, the list is often limited to various temporary locations and their home directory. While most system services keep their configuration files in the /etc/ directory, it's obvious the users can't do the same, they need private and isolated areas to save their preferences (and finally, they don't have permissions to put anything in /etc/). Therefore, their configuration information is saved in dotfiles in their home directory. The dotfile is simply a file whose name starts with a dot (say, ".vimrc"); such files are considered hidden, and are not shown in the directory listing output, unless you use the -a (--all) switch. Applications generally use fallbacks to load the configuration information. It means they first check the [runtime] command line options which have the highest priority. Next are the environment varibles, followed by dotfiles and finally the generic configs (could be from /etc/). Typically, an application will create its dotfiles when you run it for the first time. 7.6. Command aliasesLet's say you like the structured output of 'ls -al', but you would like to type 'll' instead of the complete 'ls -al'. The solution to this problem is called 'an alias' and is implemented on the shell level. Edit your ~/.bash_profile and add something like this:
Re-read that config file:
Type ll and enjoy :)
7.7. Advanced command line featuresMost probably, you are using the bash shell (echo $SHELL) with the 'readline' support included. Readline is "the library that handles reading input when using an interactive shell". While traditional Unix users despise bash (a waste of memory, they say), bash and readline form a deadly efficient user environment. Let's take a look at just few of their features:
7.8. Customizing the X sessionJust as the name suggests, the file to look for is ~/.xsession. You can find a proper example in /usr/share/doc/xfree86-common/examples/. The ~/.Xdefaults file would be a place to tune Xresources information (invoke xrdb -load ~/.Xdefaults command from the ~/.xsession file to load it up). 7.8.1. Choosing X backgroundsTastes vary; some prefer single-color backgrounds, some like gradients, some set pictures as backgrounds. I've found it's possible to create very nice-looking backgrounds using the xplanet package (install xplanet and xplanet-images):
Good background pictures can be found in the debian-propaganda package. Manually, you can set backgrounds with the xsetbg, xsetroot or Esetroot (from the eterm package) commands. 7.8.2. Taking screenshots
7.9. Reporting bugs
8. Debian GNU kernels8.1. Basic kernel informationA kernel is the essential part of a computer operating system, the core that provides functionality for all other software. It basically consists of low-level services (interrupt handler, process scheduler ...), hardware and pseudo drivers, and a set of system calls which make kernel features available to the operating system and other, higher-level applications. Every operating system has a kernel, but some of them are distributed under proprietary licenses and don't have the source publicly available so we'll leave them out of the scope. Probably the most popular free kernel today is Linux, and many so-called distributions have evolved around it. It is very important to note that Debian GNU is not a typical Linux distribution because it is not tied to the Linux kernel exclusively; other Debian ports include GNU/Hurd, GNU/NetBSD and GNU/FreeBSD. 8.2. Kernel recompilationIf you need to recompile your kernel (be it for your personal amusement or a real purpose) - read on; otherwise skip this chapter and just scroll below to see how to install precompiled kernels. Whether kernel recompilation gives you any real-world benefits is always open for discussion, especially if we're judging between recompilation and the use of a precompiled package which has the optimizations for your processor type (AMD K7 for example), but it can't hurt and from my experience, it is always a good idea. Apart from resulting in a more optimized kernel image and usually much better disk I/O performance, it serves as a kind of a small stress-test for your machine.
Additionally, you get the kernel tree with the .config, all the *.o files and configured modversions, which helps you later build additional modules and kernel components that directly fit in the running kernel, without the need for a complete recompilation or reboot. 8.2.1. LinuxFirst, make sure you have all the necessary ingredients:
The bin86 package is only needed on the ia32 (Intel and compatibles) architecture, and libc6-dev is not critical here, but you'll almost surely need it later. Then search apt's database for available kernel source versions and install the appropriate one (the highest usually, unless you have some specific needs). The kernel source will be placed in a compressed archive (/usr/src/kernel-source-<version>.tar.bz2), so after the installation we need to additionaly extract the archive, and create /usr/src/linux (by convention, a symbolic link pointing to the kernel source):
If you want to include additional kernel modules in the build (provided their source is available as a Debian package, as it is for 'i2c' and 'lm-sensors' in our example), simply install their packages, uncompress them (they will properly extract into /usr/src/modules/) and move on:
To quickly discover all additional module sources that are available, you'd do something like this (gives you pretty exact results):
Non-standard modules which do not have the source available in an existing Debian package are not handled during this stage, and I cover them in the next section. At this step, you need to pre-configure the new kernel. To do so, run make menuconfig and select your options through a very user-friendly ncurses interface (that's why you installed libncurses5-dev). New users find this step somewhat problematic because they're presented with literally hundreds of options, and not all of them have an obvious purpose or good documentation available. It should suffice to say that the precompiled package from your repository (kernel-image-2.4.18 in our case) contains the file /boot/config-2.4.18, which is practically a copy of the options the default Debian kernel was built with. So, getting that file and copying it to /usr/src/linux/.config should help you move forward:
Optionally, you could still run make menuconfig and exclude the options and drivers you know you won't be needing, just to reduce the overall compile time (however, it usually takes less than 15 minutes on ~1 GHz PCs). Actually, you will want to run it to change the processor type; that option is found somewhere at the top and it is very worth setting to the type that most closely describes your hardware. Excellent. We now only need to specify an EXTRAVERSION field for our kernel (a string added to the kernel name and file paths, we'll use doc1.0 in this example), and we can start the compilation:
If everything goes smoothly (and it should!), you should see some new .deb files generated in the /usr/src/ directory. The Kernel Has Been Compiled :) Should you recompile the kernel again (after changing options or something), make sure to raise the revision number (doc1.0); you can't create two packages having the same revision (this has to do with the GNU ChangeLog file).
8.3. Kernel image installationAfter the kernel installation and a reboot, use uname -a just to make sure you really are using the new kernel, and optionally configure kernel modules using the modconf tool. 8.3.1. Manually generated packages8.3.1.1. LinuxIf you recompiled your kernel, you should see one or more (depending on any additional modules you compiled in) .deb files in the /usr/src/ directory. You can either copy them to the appropriate place in your local apt package repository (and install with apt-get, just like everything else), or install them all directly with the dpkg command.
In case you want to add a non-standard module (or nVidia proprietary drivers for example, which I prefer to build manually although the nvidia-kernel-source package exists), you should do that later, after you compile, install and boot into your new kernel. Usually, non-standard modules you build from source only require you to have the appropriate kernel running and its corresponding source in /usr/src/linux/, and they will build cleanly. You can then copy the resulting module file(s) somewhere under /lib/modules/`uname -r`, and run depmod -a. Needless to say, you should never run make clean or make distclean inside your kernel tree (unless you plan to build everything again), because the former would cause problems with modversions, and the latter would delete your /usr/src/linux/.config file so new modules wouldn't be able to match up with the existing kernel. 8.3.2. Precompiled Debian packages8.3.2.1. LinuxIn case you did not recompile the kernel yourself, and just want to use some of the existing Debian kernel packages, you can do this: As usual, first find out the available kernel versions (optimized for AMD's k7 processor series):
Then notice how every kernel version is split into multiple .deb files:
(You of course only need kernel-image-2.4.18-k7 for the start). Simply install it:
8.4. System bootloaderBy default, Debian uses the lilo bootloader, which surely does its job, but switching to GRUB (the GRand Unified Bootloader) is always a good idea; GRUB is technically superior and gives so much more freedom. I suppose it didn't catch on so successfully (yet) because it lacked the straightforward installation documentation. Fortunately, you now have very useful and precise notes in /usr/share/doc/grub/README.Debian, and examples are available in the same directory. For even more advanced bootloader setups (including boot schedules etc...), see the excellent Smart BootManager or Gag. 9. Try to do it yourself firstWe will summarize the key points I tried to promote throughout the document:
9.1. A generic tasklistHere's the theoretical list of tasks you should perform for each problem to get in business:
9.2. getting help on IRCIRC, the Internet Relay Chat service, is a very convenient way to get help directly from the community, from the people who use or develop the same software you're using. 9.2.1. IRC servers and channels
You can use /msg chanserv info #[channel] to get more information about a specific channel. 9.3. How not to ask questions on IRCIRC itself is just a protocol. Many written and spoken conventions have been established on top of it (especially since the Free Software networks started appearing). The rules are very 'natural' and do not impose restrictions, they just define a few things you could do to avoid annoying other people on the channel, and to raise the probability of getting an answer to your question. Many newcomers start discussing completely off-topic issues (including, but not limited to, their private lives) on channels like #debian (which is a very much Debian-related (who would guess?) place). When someone warns them, they feel insulted and not welcome. Please note that #debian is a big channel (500+ people) and we all have to follow some rules, if we want the whole thing to function. I've tried to compile a summary (mostly taken from the apt's database [apt is an IRC robot (bot) on #debian]) of things you should[n't] do:
The spectre of possible problems is very broad and the effort needed to describe the problem varies. Generally:
9.4. Frequently used terms9.4.1. Dpkg, apt, dselect, tasksel
9.4.2. Manual and info pages
9.4.3. System administrator, superuser, rootTerms all referring to the administrative account or an official person which has the privileges to do anything he likes (yes, that includes deleting all your files, locking you out of the system and reporting your real earnings to the IRS :). Don't confuse with 'root directory' below. 9.4.4. Home directoryWhen you successfully authenticate with the system, you get logged-in, and you enter your 'home directory' under which you have full control to read, write and delete files (you don't have such permissions on the rest of the system). To see which directory it is, type 'pwd' (it could look something like /home/your_name). Wherever you are, type just 'cd' to get back to your home dir. The 'tilde' (~) is a special character that expands to your home directory (try 'echo ~' or 'vim ~/.bashrc'). 9.4.5. Root directoryIn Unix, disk partitions are visible (we say they are "mounted") in normal directories, and the base directory is always "/", called the "root directory". So for example, in Windows you would have disks like C: and D: but in Unix (and Linux), you connect them to directories, so your D: disk might be mounted to /mnt/windisk-D directory under Linux (the location is arbitrary, of course). 9.4.6. /etcThe /etc directory contains the configuration files for your system. If someone tells you to edit the syslog's config, it means you should go to the /etc/ directory and edit the syslog.conf file. As a general rule, most packages have a config file which is named <package>.conf, or store their config files in /etc/<package>/ directory.
9.4.7. /procThis is a virtual directory which looks like all the others on your system, but its dynamic content is generated directly by the kernel, and not from files on your disk. It is provided as a convenience in kernel-user communication (in both directions, although it was designed read-only in its early stages), and holds kernel and process-related data. Writable files are used to tune system behavior. 9.4.8. BinaryBinary is a common name for any file or data in a binary (two-digit) format. It is often a synonym for an executable file. I could say something like "where's the ttysnoop binary?" and the answer would be "the binary is located in /usr/sbin/ directory". 9.4.9. ImageThis term mostly does not refer to a picture or drawing, but to a raw, low-level data. For example, the data cdrom contains the ISO9660 filesystem and some files on it. You could use the traditional Unix dd utility to create an image of that cdrom on the hard disk (the output would, of course, be a single raw file, a direct copy of bits from the original media); it also means that the file would look like a valid device and you could even mount it locally (using the 'loop' option). 9.4.10. DaemonA system process which runs in background, normally for a long period of time, and is dedicated to servicing user requests. Examples of daemons are httpd (Apache), telnetd, ftpd (ProFtpd) or sshd (Openssh). 9.4.11. X11R6, XFree86X11R6 (the "XWindow System") is an industry standard for windowing applications. XFree86 is an open-source implementation of the X11 protocol used by most free operating systems today (see XFree86 website). 9.4.12. RMSRichard Matthew Stallman (see picture), ace MIT hacker, founder of the Free Software Foundation. 9.4.13. cursesThe curses (or the new, ncurses) library is a set of routines which gives the user a terminal-independent method of updating character screens with reasonable optimization. Linux uses the ``new curses'' (ncurses) implementation and it is the approved replacement for 4.4BSD classic curses, which has been discontinued. So, when we say apt-setup is a ncurses application, we mean it has a nice textual user interface with windows, menus and buttons. Ncurses applications are generally very convenient and nice to use. I've found a link to the ncurses programming tutorial. 9.4.14. The Unix EpochThe time and date corresponding to 0 in an operating system's clock and timestamp values. Under most Unix versions the epoch is 00:00:00 GMT, January 1, 1970; under VMS, it's 00:00:00 of November 17, 1858 (base date of the U.S. Naval Observatory's ephemerides); on a Macintosh, it's the midnight beginning January 1 1904. System time is measured in seconds or ticks past The Epoch. Weird problems may ensue when the clock wraps around, which is not necessarily a rare event; on systems counting 10 ticks per second, a signed 32-bit count of ticks is good only for 6.8 years. The 1-tick-per-second clock of Unix is good only until January 18, 2038, assuming at least some software continues to consider it signed and that word lengths don't increase by then. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||