Whole document tree

Whole document tree

How To Do This or Find Out That...

7. How To Do This or Find Out That...

7.1. How To Find Out If a 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 Is the 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 email 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.

7.2. Installing Linux Using FTP.

Most distributions are too large and complex to make FTP installation practical. Installing a basic Linux system that doesn't have a GUI or 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 a basic Debian system, to which you can add other Linux applications and commercial software as necessary.

This answer describes installation on IBM-compatible machines with an Intel x86 or Pentium processor. You will need a machine 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.

For other hardware, substitute ``-arm,'' ``-ppc,'' ``-m68k,'' or other abbreviation in directory names for ``-i386.''

For detailed and hardware-specific information refer to: http://www.debian.org/releases/stable/.

  • Connect using anonymous FTP to ftp.debian.org and cd to the pub/debian/dists/stable/main/disks-i386/current/ subdirectory.

  • Retrieve the binary image files for the rescue disk, and the drivers disk. Depending on the floppy drive installed on your machine, retrieve either the diskette images with "1200" in the names if you have a 1.2 Mb, 5.25-in. floppy, or the disks with "1440" in the name if the computer has a 3.25-in., 1.44 Mb floppy. Then retrieve the base system diskettes. Note that there are 7 base system images in the 1.44-Mb set (which have a ``14'' in their names) , and 9 in the 1.2-Mb set of images (which have a ``12'' in their names). You will use these to create the basic installation diskettes. If you have a Linux machine, you can use dd to write the images to the diskettes. If you are creating the installation diskettes on a MS-DOS machine, also download the RAWRITE.EXE MS-DOS utility, which will copy the raw binary images to floppy disks. Also download the install.en.txt document, which contains the detailed installation instructions.

  • Create the installation disk set on floppies using either dd under Linux (e.g.: ``dd if=resc1440.bin of=/dev/fd0''), or the RAWRITE.EXE utility under MS-DOS. Be sure to label each installation diskette.

  • Insert the rescue diskette into the floppy drive and reboot the computer. If all goes well, the Linux kernel will boot, and you will be able start the installation program by pressing Enter at the boot: prompt.

  • Follow the on-screen instructions for partitioning the hard disk, installing device drivers, the basic system software, and the Linux kernel. If the machine is connected to a local network, enter the network information when the system asks for it.

  • To install additional software over the Internet, be sure that you have installed the ppp module during the installation process, and run (as root) the /usr/sbin/pppconfig utility. You will need to provide your user name with your ISP, your password, the ISP's dial-up phone number, the address(es) of the ISP's Domain Name Service, and the serial port that your modem is connected to, /dev/ttyS0/dev/ttyS3. Be sure also to specify the defaultroute option to the PPP system, so the computer knows to use the PPP connection for remote Internet addresses.

  • You may have to perform additional configuration on the PPP scripts in the /etc/ppp subdirectory, and in particular, the ISP-specific script in the /etc/ppp/peers subdirectory. There are basic instructions in each script. For detailed information, refer to the Debian/GNU Linux installation instructions that you downloaded, the pppd manual page (type man pppd), and the PPP HOWTO from the Linux Documentation project, http://www.linuxdoc.org/.

  • Once you have a PPP connection established with your ISP (it will be displayed in the output of ifconfig), use the dselect program to specify which additional software you want to install. Use the apt [A]ccess option to retrieve packages via anonymous FTP, and make sure to use the [U]pdate option to retrieve a current list of packages from the FTP archive.

7.3. Resuming an Interrupted Download.

You can use the ``reget'' command of the standard ftp client program after reconnecting to pick up where you left off.

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

7.4. Boot-Time Configuration.

You can configure Linux at the lilo: prompt 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 Is the Documentation?''), and the documentation in /usr/doc/lilo.

7.5. Formatting Man 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, /usr/local/man, and elsewhere.

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 you know where to find a good implementation of the man macros without installing groff, please let the FAQ maintainer know.

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 

7.6. How To Scroll Backwards 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.

Recent kernels that have the VGA Console driver can use dramatically more memory for scrollback, provided that the video card can actually handle 64 kb of video memory. Add the line:

#define VGA_CAN_DO_64B

to the start of the file drivers/video/vgacon.c. This feature may become a standard setting in future kernels. If the video frame buffer is also enabled in the kernel, this setting may not affect buffering.

In older kernels, the amount of scrollback is fixed, 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.

[Chris Karakas]

7.7. How To Get Email 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, qmail, 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/.

7.8. Sendmail Pauses 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:''	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. This is due to changes in the envelope address masquerade options. Consult the sendmail documents.

If you have a domain name server for only a local subnet, make sure that ``.'' refers to a SOA record on the server machine, and that reverse lookups (check by using nslookup) work for all machines on the subnet.

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

The document, Sendmail: Installation and Operation Guide, included in the doc/ subdirectory of Sendmail source code distributions, discusses briefly how Sendmail resolves Internet addresses. Sendmail source code archives are listed at: http://www.sendmail.org/

[Chris Karakas]

7.9. How To Enable and Select Virtual Consoles.

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]

7.10. How To 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.'')

7.11. Dial-up PPP Configuration.

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:

  • The port that your modem is connected to: /dev/ttyS0/dev/ttyS3, which correspond to COM1-COM4 under MS-DOS.

  • The phone number of your ISP's data connection.

  • The user name and password that your ISP gave you.

  • The IP addresses of the primary and possibly secondary Domain Name Service that you will use when dialing in to the ISP. This assumes that you will not be using a DNS that you installed on your system.

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.

  • Make sure that the serial port and modem are operating correctly. Using a program like minicomm or kermit, you should be able to send AT commands to the modem and receive the OK string in response from the modem.

  • Enter the primary and possibly secondary Domain Name Server IP addresses in the /etc/resolv.conf file, using dotted quad notation, with the nameserver label. For example:

       order hosts,bind

    The nameserver addresses in the example above are examples only. They don't correspond to actual network hosts.

    The first line, order hosts,bind, tells your networking software, when it resolves network domain addresses, to first look in the /etc/hosts file, and then use the bind service; i.e., the DNS servers, which are specified on the lines that begin with nameserver.

  • Locate the chat script that PPP will use to dial the modem and connect to your ISP. In many systems, this is either in the /etc/chatscripts or /etc/ppp directory, and will be called provider or something similar. You can store a chat script anywhere, provided that you tell pppd to use it rather than the default script. Refer to the chat and pppd manual pages, and the information below, for details. Here is a sample chat script:

       ABORT        BUSY
       ABORT        "NO CARRIER"
       ABORT        VOICE
       ABORT        "NO DIALTONE"
       ""           ATDT<your_isp's_phone_number>
       ogin         <your_user_name>
       word         <your_password>

    This is a chat program for a simple, script based login. The chat program uses the pair of strings on each line as a match/response pair. When it starts, it sends the string ``ATDTyour_isp's_phone_number,'' where you have substituted the actual phone number of course. It then waits for the string ogin (a substring of the word login) and sends your user name. It then waits for word (a substring of password) and sends your password. If your ISP uses a different login and password prompts, and any additional prompts, you will need to edit the script accordingly. Again, refer to the chat manual page for details.

    If your ISP uses PAP or CHAP authentication, you will need to edit the pap-secrets or chap-secrets files in /etc/ppp directory as well. Refer to the manual pages for these files, as well as the instruction in the files themselves.

  • The configuration of pppd, the program that maintains the actual connection, is usually contained in two or three separate files. The first is usually /etc/ppp/options, which contains options that all of your system's PPP connections will use. (Yes, you can have more than one; as many as your computer has serial ports, generally.)

    Here is a sample /etc/ppp/options file:

       # /etc/ppp/options
       asyncmap 0
       # ---<End of File>---

    The options may be given on one line or each on a separate line. Many options files are much longer, and come with a description of each option. Here, the options mean, in order, don't remap any characters between the PPP client and server; always use password, PAP, or CHAP authentication when making a connection; use the modem's hardware handshake lines for flow control; lock the serial port when in use so no other programs can access it; and do not use the IPX network protocol.

  • For connection set-up on each individual serial port or PPP host, there will either be an /etc/ppp/options.ttyS1, for example, options file for /etc/ttyS1, or a file for your ISP in the /etc/ppp/peers directory. The default is often called /etc/ppp/peers/provider. Here is a sample of the default provider file:

       connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"

    There might be an explanation of these and other options in the /etc/ppp/peers/provider file itself. You can also refer to the pppd manual page for details. Briefly, they mean: do not use PAP authentication for this connection; use the chat program and the /etc/chatscripts/provider script, which is described above, to dial the phone and log in; set the network default route to the PPP connection (so when your network software needs to resolve an network address that is not on your local machine(s), it will use the PPP connection to the Internet); use /dev/ttyS1 as the serial port for the connection; set the modem speed to 38400; and keep the pppd daemon running even if the connection fails.

  • That is all of the configuration you need. To actually start and stop PPP, there are often /usr/bin/pon and /usr/bin/poff scripts (in Debian), or something similar, and they are usually very simple, and only contain the command:

       $ /usr/sbin/pppd call ${1:-provider}

    This will start pppd and use the call option to call the server that you type on the command line, or the provider given in the /etc/ppp/peers/provider file if you do not specify a remote server. After making the call and logging in (about 30 seconds), you should be able to use the /sbin/ifconfig program to determine that the connection really did establish a PPP interface (the first will be ppp0, the second will be ppp1, etc., depending on how many simultaneous PPP connections you have. If something goes wrong, you can look at the /var/log/ppp.log file to determine what happened. You can also view the log as the connection is being made, by ``tailing'' it in another window; that is, viewing it as pppd logs the connection's status information. To do this, use the command (again, as root):

       $ tail -f /var/log/ppp.log

    On some systems the PPP output is directed to /var/log/messages, in which case your system may not have a dedicated PPP log file.

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 Are the Linux FTP Archives?'') (``Where Is the Documentation?'')

7.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]

7.14. How To 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 Is the Documentation?'')

7.15. How To Upgrade/Recompile a 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 Are the Linux FTP Archives?'') 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, ``The PCMCIA Card Doesn't Work after Upgrading the Kernel.'' and ``How To Get LILO to Boot the Kernel Image.''

7.16. Can Linux Use 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.

7.17. Configuring Emacs's 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? ).

7.18. How To 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.

7.19. How To Remap a 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/.

7.20. How To 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
 setleds +num < /dev/tty$t > /dev/null

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.

7.21. How To Set (Or Reset) 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

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.

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

[Jim Dennis]

7.22. How To 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]

7.23. How To Prevent Errors when Linking Programs with Math Functions.

Older run-time libraries included the math library in the C run-time library. It was not necessary to specify the math library separately when compiling. If the compiler generates a message like this when linking a program that uses math functions:

   /tmp/ccDUQM4J.o: In function `main':
   /tmp/ccDUQM4J.o(.text+0x19): undefined reference to `sqrt'
   collect2: ld returned 1 exit status

You need use the -lm option with GCC to link with the math libraries:

   # gcc -o program program.c -lm

Make sure also to use the statement #include <math.h> in the source file.

[Florian Schmidt]