From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1103af,b96404ece5c07ebd,start X-Google-Attributes: gid1103af,public X-Google-Thread: f7ded,b96404ece5c07ebd,start X-Google-Attributes: gidf7ded,public X-Google-Thread: 10d4db,b96404ece5c07ebd,start X-Google-Attributes: gid10d4db,public X-Google-Thread: 100062,b96404ece5c07ebd,start X-Google-Attributes: gid100062,public From: kiesling@terracom.net Subject: Linux Frequently Asked Questions with Answers (Part 4 of 6) Date: 1998/09/13 Message-ID: X-Deja-AN: 390751075 Followup-To: poster X-Trace: news3.ispnews.com 905711907 209.69.148.254 (Sun, 13 Sep 1998 14:38:27 EDT) Organization: ISPNews http://ispnews.com NNTP-Posting-Date: Sun, 13 Sep 1998 14:38:27 EDT Newsgroups: comp.os.linux.announce,comp.os.linux.misc,news.answers,comp.answers Originator: kiesling@terracom.net Archive-Name: linux/faq/part4 Posting-Frequency: weekly processes, which is of course part of the standard Linux kernel, there are several implementations of lightweight processes or threads. Recent kernels implement a thread model, kthreads. In addition, there are the following packages available for Linux. * GNU glibc2 for Linux has optional support for threads. The archive is available from the same place as glibc2, ftp://ftp.gnu.org/pub/gnu * In sipb.mit.edu:/pub/pthread or ftp.ibp.fr:/pub/unix/threads/pthreads. Documentation isn't in the package, but is available on the World Wide Web at http://www.mit.edu:8001/people/proven/home_page.html. Newer Linux libc's contain the pthreads source. The GNU Ada compiler on sunsite.unc.edu in /pub/Linux/devel/lang/ada/gnat-3.01-linux+elf.tar.gz contains binaries made from that source code. * In ftp.cs.washington.edu:/pub/qt-001.tar.Z is QuickThreads. More information can be found in the technical report, available on the same site as /tr/1993/05/UW-CSE-93-05-06.PS.Z. * In gummo.doc.ic.ac.uk/rex/ is lwp, a very minimal implementation. * In ftp.cs.fsu.edu:/pub/PART/, an Ada implementation. This is useful mainly because it has a lot of Postscript papers that you'll find useful in learning more about threads. This is not directly usable under Linux. Please contact the authors of the packages in question for details. 5.11 Where can I get `lint' for Linux? Roughly equivalent functionality is built into GCC. Use the -Wall option to turn on most of the useful extra warnings. See the GCC manual for more details (type control-h followed by i in Emacs and select the entry for GCC). There is a freely available program called `lclint' that does much the same thing as traditional lint. The announcement and source code are available at on larch.lcs.mit.edu in /pub/Larch/lclint/; on the World Wide Web, look at http://larch-www.lcs.mit.edu:8001/larch/lclint.html. 5.12 Where can I find kermit for Linux? Kermit is distributed under a non-GPL copyright that makes its terms of distribution somewhat different. The sources and some binaries are available on kermit.columbia.edu. The WWW Home Page of the Columbia University Kermit project is http://www.columbia.edu/kermit/. 6. Solutions to common miscellaneous problems. 6.1 free dumps core. In Linux 1.3.57 and later, the format of /proc/meminfo was changed in a way that the implementation of free doesn't understand. Get the latest version, from sunsite.unc.edu, in /pub/Linux/system/Status/ps/procps-0.99.tgz. 6.2 My clock is very wrong. There are two clocks in your computer. The hardware (CMOS) clock runs even when the computer is turned off, and is used when the system starts up and by DOS (if you use DOS). The ordinary system time, shown and set by "date," is maintained by the kernel while Linux is running. You can display the CMOS clock time, or set either clock from the other, with /sbin/clock program--see "man 8 clock." There are various other programs that can correct either or both clocks for system drift or transfer time across the network. Some of them may already be installed on your system. Try looking for adjtimex (corrects for drift), netdate, and getdate (get the time from the network), or xntp (accurate, full-featured network time daemon). 6.3 Setuid scripts don't seem to work. That's right. This feature has been disabled in the Linux kernel on purpose, because setuid scripts are almost always a security hole. Sudo and SuidPerl can provide more security that setuid scripts or binaries, especially if execute permissions are limited to a certain user ID or group ID. If you want to know why setuid scripts are a security hole, read the FAQ for comp.unix.questions. 6.4 Free memory as reported by free keeps shrinking. The "free" figure printed by free doesn't include memory used as a disk buffer cache--shown in the "buffers" column. If you want to know how much memory is really free add the "buffers" amount to "free"--newer versions of free print an extra line with this info. The disk buffer cache tends to grow soon after starting Linux up. As you load more programs and use more files, the contents get cached. It will stabilize after a while. 6.5 When I add more memory, the system slows to a crawl. This is a common symptom of a failure to cache the additional memory. The exact problem depends on your motherboard. Sometimes you have to enable caching of certain regions in your BIOS setup. Look in the CMOS setup and see if there is an option to cache the new memory area which is currently switched off. This is apparently most common on a '486. Sometimes the RAM has to be in certain sockets to be cached. Sometimes you have to set jumpers to enable caching. Some motherboards don't cache all of the RAM if you have more RAM per amount of cache than the hardware expects. Usually a full 256K cache will solve this problem. If in doubt, check the manual. If you still can't fix it because the documentation is inadequate, you might like to post a message to comp.os.linux.hardware giving all of the details--make, model number, date code, etc., so other Linux users can avoid it. 6.6 Some programs (e.g. xdm) won't let me log in. You are probably using non-shadow password programs and are using shadow passwords. If so, you have to get or compile a shadow password version of the programs in question. The shadow password suite can be found at tsx-11.mit.edu:/pub/linux/sources/usr.bin/shadow/. This is the source code. The binaries are probably in linux/binaries/usr.bin/. 6.7 Some programs let me log in with no password. You probably have the same problem as in "Some programs (e.g. xdm) won't let me log in.", with an added wrinkle. If you are using shadow passwords, you should put a letter `x' or an asterisk in the password field of /etc/passwd for each account, so that if a program doesn't know about the shadow passwords it won't think it's a passwordless account and let anyone in. 6.8 My machine runs very slowly when I run GCC / X / ... You may have too little real memory. If you have less RAM than all the programs you're running at once, Linux will swap to your hard disk instead and thrash horribly. The solution in this case is to not run so many things at once or buy more memory. You can also reclaim some memory by compiling and using a kernel with less options configured. See "How do I upgrade/recompile my kernel?". You can tell how much memory and swap you're using with the free command, or by typing: cat /proc/meminfo If your kernel is configured with a RAM disk, this is probably wasted space and will cause things to go slowly. Use LILO or rdev to tell the kernel not to allocate a RAM disk (see the LILO documentation or type man rdev). 6.9 I can only log in as root. You probably have some permission problems, or you have a file /etc/nologin. In the latter case, put rm -f /etc/nologin in your /etc/rc.local or /etc/rc.d/* scripts. Otherwise, check the permissions on your shell, and any file names that appear in error messages, and also the directories that contain these files, up to and including the root directory. 6.10 My screen is all full of weird characters instead of letters. You probably sent some binary data to your screen by mistake. Type echo '\033c' to fix it. Many Linux distributions have a command, "reset," that does this. If that doesn't help, try a direct screen escape command. echo This resets the default font of a Linux console. Remember to hold down the Control key and type the letter, instead of, for example, `Ctrl-V'. The sequence echo c causes a full screen reset. If there's data left on the shell command line after typing a binary file, press Ctrl-C a few times to restore the shell command line. [Bernhard Gabler] 6.11 I have screwed up my system and can't log in to fix it. Reboot from an emergency floppy or floppy pair. For example, the Slackware boot and root disk pair in the install subdirectory of the Slackware distribution. There are also two, do-it-yourself rescue disk creation packages in sunsite.unc.edu/pub/Linux/system/Recovery. These are better because they have your own kernel on them, so you don't run the risk of missing devices and file systems. Get to a shell prompt and mount your hard disk with something like mount -t ext2 /dev/hda1 /mnt Then your file system is available under the directory /mnt and you can fix the problem. Remember to unmount your hard disk before rebooting (cd somewhere else first, or it will say it's busy). 6.12 I've discovered a huge security hole in rm! No you haven't. You are obviously new to Unix and need to read a good book to find out how things work. Clue: the ability to delete files under Unix depends on permission to write in that directory. 6.13 lpr(1) and/or lpd(8) don't work. First make sure that your /dev/lp* port is correctly configured. Its IRQ (if any) and port address need to match the settings on the printer card. You should be able to dump a file directly to the printer. cat the_file >/dev/lp1 If lpr gives you a message like "myname@host: host not found," it may mean that the TCP/IP loopback interface, lo, isn't working properly. Loopback support is compiled into most distribution kernels. Check that the interface is configured with the ifconfig command. By Internet convention, the network number is 127.0.0.0, and the local host address is 127.0.0.1. If everything is configured correctly, you should be able to telnet to your own machine and get a login prompt. Make sure that /etc/hosts.lpd contains the machine's host name. If your machine has a network-aware lpd, like the one that comes with LPRng, make sure that /etc/lpd.perms is configured correctly. Also look at the Printing-HOWTO "Where can I get the HOWTO's and other documentation?". 6.14 Timestamps on files on MS-DOS partitions are set incorrectly. There is a bug in the program "clock" (often found in /sbin). It miscounts a time zone offset, confusing seconds with minutes or something like that. Get a recent version. 6.15 How do I get LILO to boot the vmlinux file? >From kernel versions 1.1.80 on, the compressed kernel image, which is what LILO needs to find, is in arch/i386/boot/zImage. The vmlinux file in the root directory is the uncompressed kernel, and you shouldn't try to boot it. This was changed to make it easier to build kernel versions for several different processors from one source tree. 7. How do I do this or find out that ... ? 7.1 How can I get scrollback in text mode? With the default US keymap, you can use Shift with the PageUp and PageDown 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. For example, to remap them to the keys on an 84-key, AT keyboard. 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. 7.2 How do I switch virtual consoles? How do I enable them? In text mode, press 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 Windows you must press Ctrl-Alt-F1, etc; Alt-F5 or whatever will switch back. 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. 7.3 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 as sunsite.unc.edu/pub/Linux/system/admin/time/timesrc-1.2.tar.gz. 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(1). The manual page for tzset describes 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. ("My clock is very wrong.") 7.4 What version of Linux and what machine name am I using? Type: uname -a 7.5 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--see the definition of INIT_TASK, and look also in linux/resource.h. 7.6 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, in /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 Remember that to make the new kernel boot you must run LILO after copying the kernel into your root partition--the Makefile in recent kernels has a special zlilo target for this; try: make zlilo 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. (See " What mailing lists are there?.") 7.7 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. 7.8 How do I make a bootable 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.9 How do I remap my keyboard to UK, French, etc.? For recent kernels, get /pub/Linux/system/Keyboards/kbd-0.90.tar.gz from sunsite.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 sunsite.unc.edu/pub/Linux/docs/HOWTO. 7.10 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. 7.11 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] 7.12 How can I have more than 128Mb of swap? Use several swap partitions or swap files--Linux supports up to 16 swap areas, each of up to 128Mb. 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 512KB. He says that the 128KB limitation comes from PAGE_SIZE*BITSPERBYTE on machines with 4KB paging, but is 512MB 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.13 Miscellaneous information and questions answered. -- Robert Kiesling kiesling@terracom.net