8. How Do I Do This or Find Out That...

8.1. How Do I Know If My Notebook Runs Linux?

There's no fixed answer to this question, because notebook hardware is constantly updated, and getting the X display, sound, PCMCIA, modem, and so forth, working, can take a good deal of effort.

Most notebooks currently on the market, for example, use ``Winmodems,'' which often do not work with Linux because of their proprietary hardware interfaces. Even notebooks which are certified as ``Linux compatible,'' may not be completely compatible.

Information about installing Winmodems in general is contained in the Winmodems-and-Linux HOWTO. (Refer to ``Where Can I Get the HOWTO's and Other Documentation?'')

You can find the most current information, or ask other users about their notebook experiences, on the linux-laptop mailing list, which is hosted by the vger.redhat.com server. (Refer to ``What Mailing Lists Are There?'')

A mailing list for Linux on IBM Thinkpads has its home page at http://www.topica.com/lists/linux-thinkpad/.

Another Thinkpad mailing list is hosted by http://www.bm-soft.com/. Send E-mail with the word ``help'' in the body of the message to majordomo@www.bm-soft.com.

There is a Web page about Linux on IBM Thinkpads at http://peipa.essex.ac.uk/tp-linux/.

The Linux Laptop home page is at http://www.cs.utexas.edu/users/kharker/linux-laptop/.

For information about interfacing peripherals like Zip and CD-ROM drives through parallel ports, refer to the Linux Parallel Port Home Page, at http://www.torque.net/linux-pp.html.

If you need the latest version of the PCMCIA Card Services package, it is (or was) located at ftp://cb-iris.stanford.edu/pub/pcmcia/, but that host no longer seems to be available. Recent distributions are on ftp://metalab.unc.edu/pub/Linux/kernel/pcmcia/. You will also need to have the kernel source code installed as well. Be sure to read the PCMCIA-HOWTO, which is included in the distribution.

8.2. How Do I Install Linux Using FTP?

Installing a major distribution can be impractical because of the size of the distribution and interdependence of many of the software packages. Installing a basic Linux system that doesn't have a GUI or the major applications, is possible with FTP, however. The main non-commercial distribution in use is Debian GNU/Linux, and this answer describes an installation of the basic Debian system, to which you can add other Linux applications and commercial software as necessary.

You will need a system with at least a 80386 processor, 8 Mb of memory, and about 100 Mb of disk space. More memory and a larger disk is necessary however, for practical everyday use.

8.3. How Do I Resume an Interrupted Download?

Use the ``reget'' command of the standard ftp client program.

Clients like ncftp support resumed FTP downloads, and wget supports resumed FTP and HTML downloads.

8.4. How Do I Configure Linux at Boot Time?

Either by typing the kernel arguments at the BOOT lilo: prompt, or by adding an ``append='' directive to the /etc/lilo.conf file; for example:

# At the LILO prompt (example only):
BOOT lilo: parport=0x3bc,7 parport=0x3bc,none serial=0x3f8,4 serial=0x2f8,3

# Example statement for /etc/lilo.conf:
append="parport=0x3bc,none serial=0x3f8,4 serial=0x2f8,3"

If you modify the /etc/lilo.conf file, be sure to run the lilo command to install the new configuration.

Configuration notes for specific hardware devices are in the documentation of the kernel source distribution, /usr/src/linux/Documentation in most distributions.

Refer to the lilo and /etc/lilo.conf manual pages, as well as the LDP BootPrompt-HowTo (``Where Can I Get the HOWTO's and Other Documentation?''), and the documentation in /usr/doc/lilo.

8.5. How Do I View Manual Pages without man or groff?

The man2html program translates groff text to HTML, which you can view with a Web browser. The man2html program, and many like it, are availble on the Web. Look for them with your favorite search engine.

The unformatted manual pages are stored in subdirectories of /usr/man and /usr/local/man.

If you want to view text, use nroff and less. Both of these programs have MSDOS versions with an implementation of the man macro package available as well. An example would be:

$ nroff -man /usr/man/man1/ls.1 | less

If the manual page filename ends in ``.gz,'' then you'll need to uncompress it before formatting it, using gzip -d or gunzip. A one-line example would be:

$ gzip -dc /usr/man/man1/ls.1.gz | nroff -man | less

8.6. How Can I Get Scrollback in Text Mode?

With the default US keymap, you can use Shift with the PgUp and PgDn keys. (The gray ones, not the ones on the numeric keypad.) With other keymaps, look in /usr/lib/keytables. You can remap the ScrollUp and ScrollDown keys to be whatever you like.

The screen program, http://vector.co.jp/vpack/browse/person/an010455.html provides a searchable scrollback buffer and the ability to take ``snapshots'' of text-mode screens.

You can't increase the amount of scrollback, because it is implemented using the video memory to store the scrollback text. You may be able to get more scrollback in each virtual console by reducing the total number of VC's. See linux/tty.h.

8.7. How Do I Get E-mail to Work?

For sending mail via SMTP (Simple Mail Transfer Protocol) and receiving mail from an ISP's POP (Post Office Protocol) server, you can use a desktop client like Netscape Communicator or KDE kmail. You will need to enter the names of the SMTP and POP servers in the preferences of the respective application, as well as your E-mail address (username@isp's-domain-name), and your dial-up password. The same applies to Usenet News. Enter the name of the NNTP (Network News Transfer Protocol) server in your News client's preferences section. You may also have to provide the IP addresses of the ISP's primary and secondary name servers.

If you have a traditional MTA (Mail Transport Agent) like Sendmail, Smail, or Exim, you'll need to follow the instructions in each package. Basically, configuration entails determining which host machine, either on your local LAN or via dial-up Internet, is the ``Smart Host,'' if you're using SMTP. If you're using the older UUCP protocol, then you'll need to consult the directions for configuring UUCP, and also make sure that your ISP's system is configured to relay mail to you.

Information about Internet hosting, and News and E-mail in general, is available on the Usenet News group news.announce.newusers, and those FAQ's are also archived at ftp://rtfm.mit.edu/pub/usenet/.

8.8. How Do I Prevent sendmail from Pausing for Up to a Minute at Each Command?

Make sure that sendmail can resolve your hostname to a valid (i.e., parsable) domain address. If you are not connected to the Internet, or have a dial-up connection with dynamic IP addressing, add the fully qualified domain name to the /etc/hosts file, in addition to the base host name; e.g., if the host name is ``bilbo'' and the domain is ``bag-end.com:''

   192.168.0.1	bilbo.bag-end.com bilbo

And make sure that either the /etc/host.conf or /etc/resolv.conf file contains the line:

   order hosts,bind

Caution: Do not change the ``localhost'' entry in /etc/hosts, because many programs depend on it for internal message-passing.

Sendmail takes many factors into account when resolving domain addresses. These factors, collectively, are known as, ``rulesets,'' in sendmail jargon. The program does not require that a domain address be canonical, or even appear to be canonical. In the example above, ``bilbo.'' (note the period) would work just as well as ``bilbo.bag-end.com.'' This and other modifications apply mainly to recent versions.

Prior to version 8.7, sendmail required that the FQDN appear first in the /etc/hosts entry.

Finally, FEATURE configuration macro options like nodns, always_add_domain, and nocanonify, control how sendmail interprets host names.

[Chris Karakas]

8.9. How Do I Switch Virtual Consoles? How Do I Enable Them?

In text mode, press the left Alt-F1 to Alt-F12 to select the consoles tty1 to tty12; Right Alt-F1 gives tty13 and so on. To switch out of X you must press Ctrl-Alt-F1, etc; Alt-F5 or whatever will switch back.

However, If you have a non-PC compatible system, please see the note below.

If you want to use a VC for ordinary login, it must be listed in /etc/inittab, which controls which terminals and virtual consoles have login prompts. The X Window System needs at least one free VC in order to start.

[Note: The key sequence is actually CtrlMetaFN. On PC compatible systems, the right and left Alt keys are really synonymous with the keysymbols Meta_L and Meta_R. If the binding is different, you can determine what keys produce Meta_L and Meta_R with xkeycaps or a similar application.]

[David Charlap]

8.10. How Do I Set the Time Zone?

Change directory to /usr/lib/zoneinfo/. Get the time zone package if you don't have this directory. The source is available in ftp://metalab.unc.edu/pub/Linux/system/admin/time/.

Then make a symbolic link named localtime pointing to one of the files in this directory (or a subdirectory), and one called posixrules pointing to localtime. For example:

   $ ln -sf US/Mountain localtime
   $ ln -sf localtime posixrules

This change will take effect immediately—try date.

If the system uses Red Hat-style configuration files, the respective time zone info files are /usr/share/zoneinfo and /etc/localtime.

The manual pages for tzset or tzselect describe setting the time zone. Some programs recognize the ``TZ'' environment variable, but this is not POSIX-correct.

You should also make sure that your Linux kernel clock is set to the correct GMT time. Type date -u and check that the correct UTC time is displayed. (``The Computer Has the Wrong Time.'')

8.11. How Do I Get Dial-up PPP to Work?

This information is mainly for people who do not have a wrapper utility like kppp or pppconfig, or are not able to get those utilities to work correctly. If you need to manually configure PPP to dial in to your ISP, you will need the following information:

When you have all of this information, make sure that the programs pppd and chat, at the very minimum, are installed correctly. In most current distributions, they are installed in the /usr/sbin/ directory, and you will need to be logged in as root to use them. In addition, the following programs are also useful for configuring network connections, determining network status, and diagnosing problems: /sbin/ifconfig, /sbin/route, /bin/ping, /usr/sbin/traceroute.

These are the basic steps that you need to follow to configure PPP. You must be logged in as root.

You should be also able to ping one of your ISP's domain names (e.g., mail.isp.com) and receive a response.

These are the most basic steps for configuring a PPP connection. You will also need to take into account what other network connections may be present (for example, if there's an Ethernet connection that has already been assigned the default route), as well as various security measures at your ISP's end. If you're having trouble making the dial-up connection, usually the best way to determine what may be going wrong is to use Seyon, minicomm, kermit, or some other program to dial and log in manually to the ISP, and determine just exactly what you have to do to log in, then duplicate that in the PPP scripts.

Most Linux documentation also has additional instructions for configuring PPP connections. Refer to (``Where Can I Get Linux Material by FTP?'') (``Where Can I Get the HOWTO's and Other Documentation?'')

8.12. What Version of Linux and What Machine Name Am I Using?

Type:

   $ uname -a

8.13. What Is a ``core'' File?

A core file is created when a program terminates unexpectedly, due to a bug, or a violation of the operating system's or hardware's protection mechanisms. The operating system kills the program and creates a core file that programmers can use to figure out what went wrong. It contains a detailed description of the state that the program was in when it died.

If would like to determine what program a core file came from, use the file command, like this:

   $ file core

That will tell you the name of the program that produced the core dump. You may want to write the maintainer(s) of the program, telling them that their program dumped core.

[Eric Hanchrow]

8.14. How Can I Enable or Disable Core Dumps?

By using the ulimit command in bash, the limit command in tcsh, or the rlimit command in ksh. See the appropriate manual page for details.

This setting affects all programs run from the shell (directly or indirectly), not the whole system.

If you wish to enable or disable core dumping for all processes by default, you can change the default setting in linux/sched.h. Refer to definition of INIT_TASK, and look also in linux/resource.h.

PAM support optimizes the system's environment, including the amount of memory a user is allowed. In some distributions this parameter is configurable in the /etc/security/limits.conf file. For more information, refer to the Linux Administrator's Security Guide. (``Where Can I Get the HOWTO's and Other Documentation?'')

8.15. How Do I Upgrade/Recompile My Kernel?

See the Kernel HOWTO or the README files which come with the kernel release on ftp.cs.helsinki.fi/pub/Software/Linux/Kernel/ and mirrors. (See ``Where Can I Get Linux Material by FTP?'') You may already have a version of the kernel source code installed on your system, but if it is part of a standard distribution it is likely to be somewhat out of date (this is not a problem if you only want a custom configured kernel, but it probably is if you need to upgrade.)

With newer kernels you can (and should) make all of the following targets. Don't forget that you can specify multiple targets with one command.

   $ make clean dep install modules modules_install

Also remember to update the module dependencies.

   $ depmod -a

This command can be run automatically at boot time. On Debian/GNU Linux systems, the command is part of the /etc/init.d/modutils script, and can be linked appropriately in the /etc/rcx.d/ directories. For more information on depmod, see the manual page.

Make sure you are using the most recent version of the modutils utilities, as well as all other supporting packages. Refer to the file Documentation/Changes in the kernel source tree for specifics, and be sure to consult the README file in the modutils package.

Remember that to make the new kernel boot you must run lilo after copying the kernel into your root partition. The Makefile in some kernels have a special zlilo target for this; try:

   $ make zlilo

On current systems, however, you can simply copy the zImage or bzImage file (in arch/i386/boot/ to the /boot/ directory on the root file system, or to a floppy using the dd command. Refer also to the question, How do I get LILO to boot the kernel image?

Kernel version numbers with an odd minor version (ie, 1.1.x, 1.3.x) are the testing releases; stable production kernels have even minor versions (1.0.x, 1.2.x). If you want to try the testing kernels you should probably subscribe to the linux-kernel mailing list. (``What Mailing Lists Are There?'')

The Web site http://www.kernelnotes.org/ has lots of information and links to other sites that provide information about Linux kernel updates.

Also refer to the questions, ``I Upgraded the Kernel and Now My PCMCIA Card Doesn't Work.'' and ``How Do I Get LILO to Boot the Kernel Image?''

8.16. Can I Have More than 3 Serial Ports by Sharing Interrupts?

Yes, but you won't be able to use simultaneously two ordinary ports which share an interrupt (without some trickery). This is a limitation of the ISA Bus architecture. See the Serial HOWTO for information about possible solutions and workarounds for this problem.

8.17. How Do I Configure Emacs to Start with My Default Settings?

Create a file in your home directory named .emacs with the Emacs Lisp commands that you want to run every time Emacs starts up. You won't see the file in the directory listing. (The leading '.' tells ls not to display it, unless you use the -a command line switch with ls.)

Any kind of Emacs Lisp statement will work in the .emacs file, including entire defuns. Emacs uses lisp variables and statements extensively, and many of the editing functions are written in Emacs Lisp. For example, to enable word wrapping whenever you edit a file that ends with .txt, add the following statement. This is from the Emacs Texinfo help document ( F1-i, then m Emacs Return):

(add-hook text-mode-hook
	'(lambda () (auto-fill-mode 1)))

This adds a statement that calls a hook function whenever a text editing mode is entered for that buffer. The value of text-mode-hook, which is a variable, to auto-fill-mode, which is a function.

If you want to turn off the menu bar at the top of each Emacs frame, add this statement:

(menu-bar-mode -1)

And if you want to include an Emacs Lisp program that someone has written, like msb.el (an enhanced, pop-up buffer menu), make sure the lisp file is in a directory where Emacs can find it (usually it will be named Site-lisp), and add these statements in the .emacs file:

(require 'msb)
(msb-mode 1)

Most tasks have several possible solutions in Emacs Lisp. Any task that can be programmed in Emacs Lisp is valid in the .emacs file. For more information, consult the Texinfo documentation. There is also a FAQ list for Emacs (refer to: What other FAQ's are there for Linux? ).

8.18. How Do I Make a Rescue Floppy?

Make a file system on it with bin, etc, lib and dev directories—everything you need. Install a kernel on it and arrange to have LILO boot it from the floppy (see the LILO documentation, in lilo.u.*.ps).

If you build the kernel (or tell LILO to tell the kernel) to have a RAM disk the same size as the floppy the RAM disk will be loaded at boot time and mounted as root in place of the floppy.

See the Bootdisk HOWTO.

8.19. How Do I Remap My Keyboard to UK, French, Etc.?

For recent kernels, get /pub/Linux/system/Keyboards/kbd-0.90.tar.gz from ftp://metalab.unc.edu/. Make sure you get the appropriate version; you have to use the right keyboard mapping package for your kernel version. For older kernels you have to edit the top-level kernel Makefile, in /usr/src/linux/. You may find more helpful information in The Linux Keyboard and Console HOWTO, by Andries Brouwer, at ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/.

8.20. How Do I Get NUM LOCK to Default to On?

Use the setleds program, for example (in /etc/rc.local or one of the /etc/rc.d/* files):

for t in 1 2 3 4 5 6 7 8
do
 setleds +num < /dev/tty$t > /dev/null
done

setleds is part of the kbd package ("How do I remap my keyboard to UK, French, etc.? "). Alternatively, patch your kernel. You need to arrange for KBD_DEFLEDS to be defined to (1 << VC_NUMLOCK) when compiling drivers/char/keyboard.c.

8.21. How Do I Set (Or Reset) My Initial Terminal Colors?

The following shell script should work for VGA consoles:

for n in 1 2 4 5 6 7 8; do
     setterm -fore yellow -bold on -back blue -store > /dev/tty$n
     done

Substitute your favorite colors, and use /dev/ttyS$n for serial terminals.

To make sure they are reset when people log out (if they've been changed):

Replace the references to getty (or mingetty or uugetty or whatever) in /etc/inittab with references to /sbin/mygetty.

#!/bin/sh
setterm -fore yellow -bold on -back blue -store > $1
exec /sbin/mingetty $@

[Jim Dennis]

8.22. How Can I Have More Than 128Mb of Swap?

Use several swap partitions or swap files. Linux kernels before version 2.2 supported up to 16 swap areas, each of up to 128Mb. Recent versions do not have this limitation.

Very old kernels only supported swap partition sizes up to 16Mb.

Linux on machines with 8KB paging, like Alpha and Sparc64, support a swap partition up to 512MB. The 128MB limitation comes from PAGE_SIZE*BITSPERBYTE on machines with 4KB paging, but is 512KB on machines with 8KB paging. The limit is due to the use of a single page allocation map.

The file mm/swapfile.c has all of the gory details.

[Peter Moulder, Gordon Weast]