From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1103af,938c1b9a6cd1f0a3,start X-Google-Attributes: gid1103af,public X-Google-Thread: f7ded,938c1b9a6cd1f0a3,start X-Google-Attributes: gidf7ded,public X-Google-Thread: 100062,938c1b9a6cd1f0a3,start X-Google-Attributes: gid100062,public X-Google-Thread: 10d4db,938c1b9a6cd1f0a3,start X-Google-Attributes: gid10d4db,public From: kiesling@terracom.net Subject: Linux Frequently Asked Questions with Answers (Part 4 of 6) Date: 1998/09/06 Message-ID: <6surv7$gtr$1@news13.ispnews.com> X-Deja-AN: 388489430 Followup-To: poster X-Trace: news13.ispnews.com 905114407 17339 209.69.148.254 (6 Sep 1998 20:40:07 GMT) Organization: ISPNews http://ispnews.com NNTP-Posting-Date: 6 Sep 1998 20:40:07 GMT 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 With an a.out compiler (see, "What's all this about ELF?") the most common cause of large executables is the -g linker (compiler) flag. This produces (as well as debugging information in the output file) a program which is statically linked, i.e. one which includes a copy of the C library instead of using a dynamically linked copy. Other things worth investigating are -O and -O2 which enable optimization (check the GCC documentation) and -s (or the strip command) which strip the symbol information from the resulting binary (making debugging totally impossible). You may wish to use -N on very small executables (less than 8K with the -N), but you shouldn't do this unless you understand its performance implications, and definitely never with daemons. 5.10 Does Linux support threads or lightweight processes? As well as the Unix multiprocessing model involving heavyweight processes, which is of course part of the standard Linux kernel, there are several implementations of lightweight processes or threads, most of which are generic packages for any Unix: * 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 contains 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 the GNU C compiler (gcc) which is used by Linux systems. Use the -Wall option to turn on most of the useful extra warnings. Check 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 off and is used to when the system starts up and by DOS (if you use it). 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." To set the time zone, some programs recognize the TZ environment variable. The manual page for tzset describes setting the time zone. Recent, POSIX-correct systems have the time zone info in /usr/lib/zoneinfo/. The soft link localtime points to the zone information file for your time zone. The soft link posixrules points to localtime. There are various other programs that can correct either or both clocks for systematic drift or transfer time across the network. Some of them may already be installed on your system. Try looking at or for adjtimex (corrects for drift), netdate and getdate (simply get the time from the network) or xntp (accurate fully-featured network time daemon). 6.3 Setuid scripts don't seem to work. That's right. This feature has been deliberately disabled in the Linux kernel 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 and 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 quite 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 the caching. Some motherboards don't cache all the RAM if you have more RAM per amount of cache than they expect. Usually a full 256K cache will solve this problem. If in doubt, check your motherboard 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* the details - make, model number, date code, etc. so that 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 but are using shadow passwords. If so, you have to get or compile a shadow password version of the program(s) in question. The shadow password suite can be found in (amongst other places): tsx-11.mit.edu:/pub/linux/sources/usr.bin/shadow-* This is the source code; you will probably find the binaries 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 to 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/or swap you're using by using 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. If the latter, 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 containing these files all the way up the tree, 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. 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 distributions. There are also two do-it-yourself rescue disk creation packages in sunsite.unc.edu/pub/Linux/system/Recovery. These are better because as they have your own kernel on them, so that you don't run the risk of missing devices, file systems, and so forth. 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 back down to / 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 on it to find out how things work. Clue: ability to delete files under Unix depends on permission to write the directory they are in. 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 board. You should be able to dump a file directly to the printer; e.g.: $ 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. If your machine has a network-aware lpd, like the one that comes with LPRng, make sure that the lpd.perms file 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 msdos partitions are set incorrectly. There is a bug in the program clock(8) (often found in /sbin)--it miscounts a time zone offset, confusing seconds with minutes or some such. Get a new version of it. 6.15 How do I get LILO to boot the vmlinux file? In kernel versions 1.1.80 and later, the compressed kernel image, which is what LILO needs to find, has been moved to arch/i386/boot/zImage. The vmlinux file in the root directory is the uncompressed kernel, and you shouldn't try to boot it. This change has been made to make it easier to build the versions for several different processors from the same 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 (NB: these must be the grey ones, not the ones on the numeric keypad!). With other keymaps check the maps in /usr/lib/keytables; you can remap the ScrollUp and ScrollDown keys to be whatever you like--for example, in order to remap them to keys that exist 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 of the way it is implemented using the video memory to store the scrollback text, though 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 you need to list it in /etc/inittab, which controls which terminals and virtual consoles have login prompts. NB: X needs at least one free VC in order to start. Kernels earlier than around 1.1.59 have a compiled-in limit on the number of consoles, for which the default is 8. See NR_CONSOLES in linux/include/linux/tty.h. Newer kernels allocate them dynamically, up to a maximum of 63. 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). Don't try to use the TZ variable--leave it unset. 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 universal time is displayed. 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(1) command in bash(1), the limit command in tcsh(1), or the rlimit command in ksh(1). See the appropriate manual page for details. This setting affects all programs run from that 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 comes 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 you got it as 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 to 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 to go with your kernel version. 0.90 should work with kernel versions from 1.0. 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 keystroke 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 (see Q7.9 `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 tty in 1 2 4 5 6 7 8; do setterm -fore yellow -bold on -back blue -store > /dev/tty$ done Substitute your favorite colors, and use /dev/ttyS$ 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 -- Robert Kiesling kiesling@terracom.net ..No writing gig too small...