Linux-Misc Digest #307, Volume #19                Thu, 4 Mar 99 22:13:13 EST

Contents:
  Linux Frequently Asked Questions with Answers (Part 4 of 6) ([EMAIL PROTECTED])
  Re: Kernel 2.2.1 make zImage error with RedHat-5.2 (Paul Kimoto)
  Re: Best Free Unix? (why FreeBSD?) (Leslie Mikesell)
  Re: Public license question (Philip Armstrong)
  Newbie - Xfree86Config question (Greg)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED]
Crossposted-To: news.answers,comp.answers
Subject: Linux Frequently Asked Questions with Answers (Part 4 of 6)
Date: 4 Mar 1999 23:06:09 GMT


For example, when upgrading libc5 libraries, the files in /lib/ might
look something like:

libc.so.5
libc.so.5.4.33
libm.so.5
libm.so.5.0.9

These are the C libraries and the math libraries. Copy them to another
directory that is listed in /etc/ld.so.conf, like /usr/lib/.

cp -df /lib/libc.so.5* /usr/lib/
cp -df /lib/libm.so.5* /usr/lib/
ldconfig

Be sure to run ldconfig to upgrade the library configuration.

The files libc.so.5 and libm.so.5 are symbolic links to the actual
library files. When you upgrade, the new links will not be created if
the old links are still there, unless you use the -f flag with cp. The
-d flag to cp will copy the symbolic link itself, and not the file it
points to.

If you need to overwrite the link to the library directly, use the -f
flag with ln.

For example, to copy new libraries over the old ones, try this. Make a
symbolic link to the new libraries first, then copy both the libraries
and the links to /lib/, with the following commands.
ln -sf ./libm.so.5.0.48 libm.so.5
ln -sf ./libc.so.5.0.48 libc.so.5
cp -df libm.so.5* /lib
cp -df libc.so.5* /lib

Again, remember to run ldconfig after you copy the libraries.

If you are satisfied that everything is working correctly, you can
remove the temporary copies of the old libraries from /usr/lib/ or
wherever you copied them.


5.6 Has anyone ported / compiled / written XXX for Linux?

First, look in the Linux Software Map--it's at
metalab.unc.edu/pub/Linux/docs/linux-software-map, and on the
other FTP sites. A search engine is available on the World Wide Web at
http://www.boutell.com/lsm/.

Check the FTP sites ("Where can I get Linux material by FTP?")
first--search the ls-lR or INDEX files for appropriate strings.

Also look at the Linux Projects Map,
ftp.ix.de/pub/ix/Linux/docs/Projects-Map.gz.

There's a search engine for Linux FTP archives at
http://lfw.linuxhq.com/.

Also check out the Freshmeat Web site http://www.freshmeat.net,
which is really cool, even if the logo does look like cat food. ("
What online/free periodicals exist for Linux?" Freshmeat is
basically a site index that continuously updates the notices of new or
upgraded software for Linux.

If you don't find anything, you could download the sources to the
program yourself and compile them. See "How do I port XXX to
Linux?" If it's a large package that may require some porting, post a
message to comp.os.linux.development.apps.

If you compile a large-ish program, please upload it to one or more of
the FTP sites, and post a message to comp.os.linux.announce (submit
your posting to [EMAIL PROTECTED]).

If you're looking for an application program, the chances are that
someone has already written a free version. The comp.sources.wanted
FAQ has instructions for finding the source code.


5.7 Can I use code or a compiler compiled for a 486 on my 386?

Yes, unless it's the kernel.

The -m486 option to GCC, which is used to compile binaries for x486
machines, merely changes certain optimizations. This makes for
slightly larger binaries that run somewhat faster on a 486. They still
work fine on a 386, though, with a small performance hit.

However, from version 1.3.35 the kernel uses 486 or Pentium-specific
instructions if configured for a 486 or Pentium, thus making it
unusable on a 386.

GCC can be configured for a 386 or 486; the only difference is that
configuring it for a 386 makes -m386 the default and configuring for a
486 makes -m486 the default. In either case, these can be overridden
on a per-compilation basis or by editing
/usr/lib/gcc-lib/i*-linux/n.n.n/specs.

There is an Alpha version of GCC which knows how to do optimization
well for the 586, but it is quite unreliable, especially at high
optimization settings. The Pentium GCC can be found on tsx-11.mit.edu
in /pub/linux/ALPHA/pentium-gcc. I'd recommend using the ordinary 486
GCC instead; word has it that using -m386 produces code that's better
for the Pentium, or at least slightly smaller.


5.8 What does gcc -O6 do?

Currently, the same as -O2 (GCC 2.5) or -O3 (GCC 2.6, 2.7). Any number
greater than that does the same thing. The Makefiles of newer kernels
use -O2, and you should probably do the same.


5.9 Where are linux/*.h and asm/*.h?

The files /usr/include/linux/ and /usr/include/asm/ are often soft
links to the directories where the kernel headers are. They are
usually under /usr/src/kernel*/.

If you don't have the kernel sources, download them--see, "How
do I upgrade/recompile my kernel?"

Then, use rm to remove any garbage, and ln to create the links:
rm -rf /usr/include/linux /usr/include/asm
ln -sf /usr/src/linux/include/linux /usr/include/linux
ln -sf /usr/src/linux/include/asm /usr/include/asm

/usr/src/linux/include/asm/ is a symbolic link to an
architecture-specific asm directory--if you have a freshly unpacked
kernel source tree, you must make symlinks. You'll also find that you
may need to do `make config' in a newly-unpacked kernel source tree,
to create linux/autoconf.h.


5.10 I get errors when I try to compile the kernel.

See the previous question regarding the header files.

Remember that when you apply a patch to the kernel, you must use the
-p0 or -p1 option: otherwise, the patch may be misapplied. See the
patch manual page for details.

"ld: unrecognized option `-qmagic"' means that you should get a
newer linker, from ftp://tsx-11.mit.edu/pub/linux/packages/GCC/,
in the file binutils-2.8.1.0.1.bin.tar.gz.


5.11 How do I make a shared library?

For ELF,
gcc -fPIC -c *.c
gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o

For a.out, get tools-n.nn.tar.gz from tsx-11.mit.edu, in
/pub/linux/packages/GCC/src/. It comes with documentation that will
tell you what to do. Note that a.out shared libraries are a very
tricky business. Consider upgrading your libraries to ELF shared
libraries. See the ELF HOWTO, at
metalab.unc.edu/pub/Linux/docs/HOWTO/


5.12 My executables are (very) large.

With an ELF compiler ("What's all this about ELF?"), the most
common cause of large executables is the lack of an appropriate .so
library link for one of the libraries you're using. There should be a
link like libc.so for every library like libc.so.5.2.18.

With an a.out compiler 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--one which includes a copy of the C library instead of 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.13 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.
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
    metalab.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.14 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.15 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 metalab.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 <Ctrl-V><Ctrl-O>

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 <Ctrl-V><Esc>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
metalab.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 unices and need to read a
good book to find out how things work. Clue: the ability to delete
files 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 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 in
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(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.

-- 
[EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Paul Kimoto)
Subject: Re: Kernel 2.2.1 make zImage error with RedHat-5.2
Date: 4 Mar 1999 00:46:46 -0500
Reply-To: [EMAIL PROTECTED]

[posted and e-mailed]

In article <7bfii8$ji0$[EMAIL PROTECTED]>, Ryan Gaul wrote:
> # cd /usr/src/
> # gzip -cd linux-2.2.1.tar.gz | tar xfv -

> make[2]: Entering directory '/usr/src/linux-2.0.36/arch/i386/lib'
> gcc -D__KERNEL__ -I/usr/src/linux-2.0.36/include -Wall -Wstrict-prototypes 
> -02 -fomit-frame-pointer -pipe -fno-strength-reduce -m486 -malign-loops=2 
> -malign-jumps=2 -malign-functions=2 -DCPU=686  -c -o checksum.o 
> checksum.c
> chucksum.c:200: redefinition of 'csum_partial_copy' 

There is no file arch/i386/lib/checksum.c in 2.2.2.  Try deleting it.
(Did you unpack the new kernel source over the old?  There is now a 
file arch/i386/lib/checksum.S, though.)

-- 
Paul Kimoto             <[EMAIL PROTECTED]>

------------------------------

From: [EMAIL PROTECTED] (Leslie Mikesell)
Crossposted-To: 
comp.unix.questions,comp.unix.advocacy,comp.unix.misc,comp.unix.bsd.freebsd.misc
Subject: Re: Best Free Unix? (why FreeBSD?)
Date: 3 Mar 1999 23:44:00 -0600

In article <7beddd$sg1$[EMAIL PROTECTED]>,
Paul Hughett <[EMAIL PROTECTED]> wrote:

>: >Linus does not have the power to make such an exception.
>: >
>
>: It isn't an exception about derived works being covered, it is
>: a definition of the module interface that says that such
>: modules do not become derived works of the kernel.  While there
>: still might be a legal question here, I don't see how anyone
>: can consider Linux as anything but an expert on this topic.
>
>
>Excuse me a moment.  I have absolutely no problem with calling
>Linus an authority on operating system kernels, but I have seen
>absolutely no evidence (either way) concerning his expertise in
>intellectual property law.

Are you suggesting that the legal semantics have no relationship
at all to the interface semantics?

  Les Mikesell
    [EMAIL PROTECTED]

------------------------------

From: [EMAIL PROTECTED] (Philip Armstrong)
Crossposted-To: comp.os.linux,gnu.misc.discuss
Subject: Re: Public license question
Date: 4 Mar 1999 22:53:21 GMT

In article <X7DD2.69703$[EMAIL PROTECTED]>,
Christopher Seawood <[EMAIL PROTECTED]> wrote:
>(I recently discovered that shared libs under linux didn't work in the way
>I thought they did.  I was under the assumption that there was one copy
>of the library that was loaded by the system and used by all processes
>that depend upon it.  Apparently, according to a guy from Cygnus, the
>portions of the library that are used by the application are copied
>into the executable's process space.  Does anyone know if this is true
>of all dynamic loaders?)
>
Both of the above statements are true. A shared library is mapped into
multiple processes address spaces at once -- in different places
in each process probably. But only one copy is in 'real' memory.
Read up on vm...


cheers,

Phil
-- 
nosig


------------------------------

From: Greg <[EMAIL PROTECTED]>
Subject: Newbie - Xfree86Config question
Date: Thu, 04 Mar 1999 18:45:20 -0800

I'm new to Red Hat Linux. I have just installed version 5.2. When I go
to start X windows (using startx) it opens but the screen is not
centered. On the left side there is an area of black Why is this? I the
display is bigger than my monitor screen so I have to scroll right and
up & down to see the whole windows environment. I've changed the virtual
res and it has only changed alittle. The max res of my monitor is
1280x1024. What is wrong?

Thank you for your time

Greg Kaufman
[EMAIL PROTECTED]


------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.misc) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Misc Digest
******************************

Reply via email to