Monday, February 4, 2008

The Linux BLFAQ

Neil Zanella <nzanella@ganymede.cs.mun.ca>
v0.2.5, Sep 30 2000

Copyright Notice:
Copyright (c) 1998-2000 by Neil Zanella. This document may be distributed under
the terms set forth in the LDP license at
<http://www.linuxdoc.org/COPYRIGHT.html>

Intro:
Welcome to the Brief Linux FAQ (BLFAQ)!
This document contains a list of some frequently asked Linux questions and their answers. It is meant to provide general help to Linux users, especially newbies.

I invite you to modify and add to this list but if you do so please be sure to mail me so that I can include your changes in future releases. Finally, I hope that this document will prove helpful to all Linux users, newbies especially.

Current releases of this document can be found at:
<ftp://metalab.unc.edu/pub/Linux/docs/faqs/BLFAQ>

FAQs:
--------------------------------------------------------------------------------
Q: I am trying to use the text based ftp program to download some stuff via
anonymous ftp from an ftp site. I have never done this before and the ftp
server doesn't seem to be letting me log in. Do I need a special user name
and password to do this?

A: To use anonymous ftp services log in with user name "anonymous" without
quotations and your full e-mail address as your password.
Some ftp sites will also accept the words "ftp" or "guest" instead of the
word "anonymous" as user name.

--------------------------------------------------------------------------------
Q: I plan to use the FIPS program to shrink a FAT32 partition (such as one used
by MS-Windows 95/98) and hence create space for my Linux operating system.
Can this be done?

A: Yes, but in order to do so you will need a version of FIPS at least as recent
as FIPS 1.5c. You can get the latest version of FIPS by anonymous ftp from
the official FIPS web site at <http://www.igd.fhg.de/~aschaefe/fips/>.

--------------------------------------------------------------------------------
Q: I am using the DOS Fdisk utility to destructively repartition my hard drive.
How should I deal with the question pertaining to whether or not I should
"enable large disk support"?

A: That question really has to do with whether you want to use a FAT32 or a
FAT16 file system with your DOS/Windows partition. Linux will coexist equally
well with both file systems except that in order to see a FAT32 file system
from your Linux partition you will need a version of the kernel at least
as recent as 2.0.35 .

--------------------------------------------------------------------------------
Q: I have upgraded to kernel 2.0.35 or later but still can't see my FAT32
partition. What went wrong?

A: You must ensure that you have an entry for your DOS partition in your
/etc/fstab file resembling the line:

/dev/hda1 /dos vfat auto,user,rw 0 0

Once the line is there you can just issue the command "umount -a;mount -a"
to mount your DOS partition under the /dos directory.

--------------------------------------------------------------------------------
Q: I am trying to install Linux via CD-ROM. I have made space for Linux on my
hard drive but inserting the Linux CD into the CD-ROM drive and rebooting
has no effect.

A: You must configure your BIOS settings so that booting from the CD-ROM
drive is enabled and so that the boot sequence forces the computer to
boot from the CD-ROM drive instead of from some other device such as
a hard drive or floppy drive. On most systems the BIOS settings can be
accessed by entering a keystroke shortly after the computer powers up.
The required keystroke varies from system to system and typical values
include <del>, <f2>, and <ctrl>-<esc>.

--------------------------------------------------------------------------------
Q: I have completed the installation process but upon reboot I get a LI
prompt or a bunch of zeros and ones.

A: If your machine is somewhat old and you have an IDE (or EIDE) hard drive then
you must install your root partition completely below cylinder 1023
which means below 512 MB of disk space. On SCSI drives this means
your root partition must be contained within approximately one GB.
If your machine is fairly new and your BIOS supports it you may be able to
get around this problem by enabling LBA mode in the BIOS settings.

--------------------------------------------------------------------------------
Q: I can log in and out of my system but how do I shut it down / reboot it?

A: There are various ways. The most popular ones are logging in as root and
issuing the command "/sbin/shutdown -h now" or "/sbin/halt" to shut it
down or "/sbin/shutdown -r now" or "/sbin/reboot" to reboot.
On most systems while using a text based console pressing the <ctrl>, <alt>
and <del> keys simultaneously will also reboot the system.

--------------------------------------------------------------------------------
Q: I have shut down my system with the "halt" command and gotten to a message
saying "System Halted" but why is my computer still on?

A: If you want it to power off on shutdown then you must recompile the kernel to
enable support for that feature by selecting the appropriate entry in the
APM options.

--------------------------------------------------------------------------------
Q: My new video card is listed at <http://www.linux.org/> as a card which the
X Window System supports under Linux but I cannot get it to work.

A: Make sure that you have the newest version of XFree86 and that you installed
the right X Server. If all else fails you might want to try selecting the
generic SVGA server as your X Server.

--------------------------------------------------------------------------------
Q: I have successfully installed the X Window System and use the startx
command to run it from a text based virtual console. How can I have the X
Window System run at all times so that I don't have to use the startx
command?

A: If you are running Red Hat then you can edit the file /etc/inittab on
your system and replace the entry

id:3:initdefault:

with the entry

id:5:initdefault:

and reboot.
On other systems you might have to change the number 5 (the run level) to
another number like 4. How to choose the correct run level should be clear
by reading the comments in the file /etc/inittab . Alternatively, you might
have to change a link in /etc/rc[2345].d . Run levels 2-5 don't have really
strong conventions behind them like 0, 1, and 6 do. It depends on the
distribution.

--------------------------------------------------------------------------------
Q: When I use the X Window system and open multiple windows I find that my
screen size is insufficient. How can I use more virtual screen space?

A: Most window managers running under X Window have a built in feature known as
a pager which allows you to have more virtual screen space.

--------------------------------------------------------------------------------
Q: I would like to have xdm run multiple local displays on my system and switch
back and forth by pressing <ctrl><alt><F*> where * is a number between
1 and 12.

A: If you wanted to run 6 virtual consoles accessible by pressing the keys
<ctrl><alt><F7> through <ctrl><alt><F12> then you could put the following
entries in the file /usr/X11R6/lib/X11/xdm/Xservers

:0 local /usr/X11R6/bin/X vt07 :0
:1 local /usr/X11R6/bin/X vt08 :1
:2 local /usr/X11R6/bin/X vt09 :2
:3 local /usr/X11R6/bin/X vt10 :3
:4 local /usr/X11R6/bin/X vt11 :4
:5 local /usr/X11R6/bin/X vt12 :5

I would limit myself to only a few of these though as X seems to eat up
quite a lot of memory when multiple displays are running.

--------------------------------------------------------------------------------
Q: I hate the sound of the bell. I would prefer to disable it perhaps enabling
the visual bell as an alternative.

A: If you are running X then you can simply type "xset -b" without quotation
marks at the command prompt. Alternatively, if you are running the bash
shell then you can add the command "xset -b 2> /dev/null" without quotation
marks at the end of your .bash_profile file in your home directory to have
the audible bell disabled each time you log in.
For more information see the Visual-Bell-mini-HOWTO at
<http://www.linux.org/>

--------------------------------------------------------------------------------
Q: I have access to a remote Unix machine that has some commercial software that
uses X which I would like to run remotely on my display. How do I do it?

A: First connect to the remote machine using dip or whatever you use. If the
remote machine is called grasshopper.uvw.edu and your machine is called
kiwi.fruit.org then first type

xhost +grasshopper.uvw.edu

from your own machine's shell prompt while running X. If you telnet to the
remote machine and you're using a modem to connect then your machine name
on the Internet may be different from your actual machine name at home
so be sure to use the finger command on the remote machine with your remote
user name as an argument to find out what your machine name is on the
Internet. Assuming your machine name has not changed you must type

export DISPLAY=kiwi.fruit.org:0.0

on the remote machine if it uses the Korn shell or the equivalent if it uses
another shell. You should be now ready to fire up the remote application
from your machine.

--------------------------------------------------------------------------------
Q: I am sick of having to type in my password interactively each time I want to
start a shell on a remote server. Is there a way to avoid this.

A: Surprisingly yes. Simply replace the words "remote-host", "username", and
"password" in the following expect script and do a "chmod +x name-of-script".
You can then simply invoke the script to log into the remote host.

#!/usr/bin/expect
eval spawn telnet remote-host
set timeout 20
expect ogin:
send "username\r"
expect assword:
send "password\r"
sleep 2
interact

Alternatively you can try out the ktelnet program.

--------------------------------------------------------------------------------
Q: Is it possible to make recursive downloads to mirror ftp or web sites or
just download a file, perhaps while not even logged in?

A: Yes, use the wget program. See <ftp://sunsite.auc.dk/pub/infosystems/wget/>
for the latest version of the software.

--------------------------------------------------------------------------------
Q: I use the lp or lpr programs to print ASCII files and man pages. Is there
any way that I can get more text on one page, hence less pages of output?

A: Yes. If you have a printer which can print postscript files you could
try the a2ps program. Make sure you specify the -M option for the paper's
size and the -m option in case you're printing man pages. For example to
convert the xterm man page to postscript you can use

man xterm | a2ps -M Letter -m -o xterm.ps

--------------------------------------------------------------------------------
Q: I have more than 64 MB of RAM but when I use the "free" command to check
the amount of available memory on my system only slightly less than 64MB
show up. How do I get Linux to recognize the additional RAM?

A: Linux uses the BIOS to detect the amount of available RAM. At the present
time there are two separate function calls available to do the job. Any
version of Linux prior to 2.1.x uses the old call which is limited to 64M.
The newer call (used by 95/NT and Linux 2.1.x) can return more than 64M.
This problem should be fixed in the next stable release of the Linux kernel
(release 2.2.0). For now it is possible to have Linux detect all of your
RAM by adding the line:

append = "mem=128M"

to the file /etc/lilo.conf if you use LILO or to the end of the respective
LOADLIN file if you use LOADLIN. This will enable 128MB of RAM, for example.
You will need to rerun LILO for the changes to take effect. The next time you
boot up, Linux will see all of your memory.

--------------------------------------------------------------------------------
Q: I have used the rm command to delete a file. Is it possible to undelete the
file and hence recover its contents?

A: In theory there is a way to undelete a file if you are using the ext2fs
file system (most common). In practice, it is rarely possible. To prevent
significant loss of data in this manner you must ensure that your system
is backed up regularly. Alternatively if you had installed the program
midnight commander before deleting and compiled a version with undelf
then you could use cd undel:/dev/hda8 to see your deleted files (without
names). Alternatively, some users like to have a shell script that moves
a file to a directory like /tmp each time it is removed or just before
it is overwritten. If you are really desperate, read the Ext2fs-Undeletion
mini-HOWTO, which might work.

--------------------------------------------------------------------------------
Q: I am trying to run a script file named script or test but I am getting some
unexpected results.

A: The names script and test are names of executable programs on your system so
you should not use them for your own executables. If you got unexpected
it's because the system binaries got to be executed before your own binaries.

--------------------------------------------------------------------------------
Q: I (re/)installed windows on the same hard drive as Linux but now I no longer
get the LILO prompt and can't boot into Linux. What should I do?

A: Most likely windows overwrote the MBR (Master Boot Record) hence deleting
LILO. If you manually installed the kernel and used "make zdisk" then you
can boot from the floppy, otherwise you can download a boot/root floppy
distribution of Linux like the one at <http://www.toms.net/rb/> or some
other one. Once you get to your hard drive don't forget to rerun /sbin/lilo
so that you won't have to boot from the floppy again. If you are using a
floppy that boots its own file system then you must first mount your hard
drive with something like "mount /dev/hda1 /mnt" and change to the hard
drive with "chroot /mnt /bin/sh" before rerunning "/sbin/lilo".

--------------------------------------------------------------------------------
Q: I removed Linux from my system, but now DOS won't boot because LILO is still
there. How do I remove LILO?

A: If you have a version of DOS at least as recent as DOS 5.0 then you can
insert your DOS boot diskette and boot from it. At the DOS prompt, type

fdisk /mbr

to remove LILO from the Master Boot Record (MBR).

--------------------------------------------------------------------------------
Q: I want to add '.' to root's PATH, to allow me to not have to put ./ in
front of every local command I type. But I hear this is a bad thing. Why?

A: Adding '.' to root's PATH would be a security risk. Imagine the case where a
malicious user creates a file called /tmp/ls containing a command sequence
such as

# Caution: This script removes everything from the Linux file system.
cat /tmp/ls
rm -Rf /

and you as root wander into /tmp and want to see what files are there. If
the . occurs in root's path before /bin then typing ls at the shell prompt
will execute the malicious command instead. Alternatively, the malicious
command could be named mroe, ls-l, caat, lss, or similar in which case a
typo on root's behalf would cause it to be executed even if . is the last
entry in root's path. Finally, the malicious command may be set to copy
/bin/bash to a hidden spot and change permissions of the copy to
suid ( -rws---r-x ) so that anyone executing the hidden copy would have
root permissions.

--------------------------------------------------------------------------------
Q: I can't execute my script/program. I can list the file with ls -l and
it is there with the correct permissions:

ls -l mumble
-rwxrw-r-- 1 me user 104 Feb 14 15:46 mumble

but when I type mumble at the command prompt I get the response:

bash: mumble: command not found

A: Most probably the current directory (CWD) is not in your path. The best
thing to do in such situations is probably to type the full path to the
script/program followed by the name of the script/program .
If you are work in a directory that you alone use and which is not shared
then you might want to take the risk of editing your PATH variable to
contain CWD. Alternatively you could keep all your executables in a directory
called ~/bin and put it in your path. You can look at your path by typing
echo $PATH at the shell prompt.

echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/me/bin

--------------------------------------------------------------------------------
Q: Why can't I telnet or rsh in to my Linux system as Root?

A: This is a security feature meant to protect you. Malicious users must
know a valid user password, as well as the root password in order to
get in to the system and do anything as root. Log in as a user, and
use the su command to then become root. Better still is to use the ssh
command (if installed) which encrypts your session to prevent anyone
from seeing the root password.
If your network is totally local (you have only a terminal connected
to a serial port), you can edit /etc/securetty to add that port as one
considered secure enough for root to log in.

--------------------------------------------------------------------------------
Q: Why can't I ftp as root?

A: This is a security feature meant to protect you. No user listed in
/etc/ftpuser is allowed to use ftp. Always ftp as a regular user.

--------------------------------------------------------------------------------
Q: I've tried to create a shell script and made it setuid root so the users
can execute it. But no matter what I do, it doesn't execute with root
privilege. Why?

A: Shell scripts are a notorious security hole. To protect you, the kernel
purposely ignores setuid and setgid in scripts. Create a C or Pearl
program to do the task.

--------------------------------------------------------------------------------
Q: Why should I create ordinary user accounts. I'm the only user on this
machine. Why not just work as root?

A: Root, commonly called the super-user, is for system administration tasks
only. The normal protection mechanisms are eliminated for this account
(indeed for any user with UID or GID equal to 0). So if you make any
little mistake (for example the classic "rm * myfile" -- note the
space between the wild-card and myfile) the system will do _exactly_
what you told it to do, not what you meant it to do. In the classic mistake
above, the system will remove all files in the current directory, then
complain because it can't remove 'myfile' which doesn't exist.

--------------------------------------------------------------------------------
Q: I am able to establish a dial up connection but when I use telnet to
connect to remote hosts telnet understands IP address but not host names.
What can I do to have telnet and other programs understand host names?

A: You should be able to get rid of this problem by adding an entry for a
name server in the file /etc/resolv.conf . If you have more than one name
server then you should put your primary dns first as nameserver entries
get read from top to bottom. The 'search' or 'domain' line should have
your isp's domain name. Your /etc/resolv.conf should look something like:

search virtual-impact.com
domain virtual-impact.com
nameserver 205.162.94.51
nameserver 205.162.88.33
nameserver 134.153.2.90

--------------------------------------------------------------------------------
Q: I don't like having to type the full host name when using telnet.
How can I resolve this problem?

A: Edit the file /etc/hosts and add entries like the following:

127.0.0.1 localhost localhost.localdomain
134.153.1.200 riemann riemann.math.mun.ca
134.153.39.1 ganymede ganymede.cs.mun.ca
134.153.1.1 garfield garfield.cs.mun.ca
134.153.2.151 plato plato.ucs.mun.ca
129.128.88.12 vega vega.math.ualberta.ca

--------------------------------------------------------------------------------
Q: I am logged into a host. I would like to find out its IP address
and a few other ones. How can I do this?

A: You could use the hosts command as follows:

ganymede $ host ganymede.cs.mun.ca
ganymede.cs.mun.ca has address 134.153.39.1
ganymede.cs.mun.ca mail is handled (pri=5) by garfield.cs.mun.ca
ganymede $

The programs nslookup and /sbin/ifconfig can also be used for this
purpose.

--------------------------------------------------------------------------------
Q: How can I have the "useradd" or "adduser" command automatically place some
default files in a user's directory when that user is added to the system?

A: Edit the contents of the files located under /etc/skel to suit your needs.
These files will be added to a user's home directory each time that user
is added.

--------------------------------------------------------------------------------
Q: I am trying to build a new kernel. Why is it that "make menuconfig" does not
display any colors when running under an xterm?

A: You could either use "make xconfig" or if you have the terminfo library
installed you could say "export TERM=xterm-color" or something similar.
Look at the entries in the terminfo library to chooses an appropriate value
for the TERM environment variable.

--------------------------------------------------------------------------------
Q: I am trying to get X to read my window manager's configuration file but with
no success.

A: If you start X with "startx" or "xinit" then you need a startup file
called "~/.xinitrc" otherwise if you start your X session with a session
manager such as "xdm" then you need a startup file called "~/.xsession".
The startup file should contain the command to execute your window manager.
You must make your startup file executable with "chmod +x ~/.xinitrc" or
"chmod +x ~/.xsession". For more information look at the files located
under /etc/X11 and /usr/X11R6/lib/X11 as well as your window manager's
documentation files.

--------------------------------------------------------------------------------
Q: Are the modules part of the Linux kernel or are they distributed separately?

A: They come with the kernel. There used to be an old package called
modules-x.y.z.tar.gz that you could download. This did not consist of the
modules themselves but the module utilities needed to handle modules.
For obvious reasons this package was renamed to modutils-x.y.z.tar.gz.

--------------------------------------------------------------------------------
Q: What is the quickest and safest way to recompile the kernel?

A: In short, as root issue the following commands after downloading a kernel:

# mv linux-x.y.z.tar.gz /usr/src; cd /usr/src
# rm -f linux; tar zxpvf linux-x.y.z.tar.gz
# mv linux linux-x.y.z; ln -s linux-x.y.z linux
# cd linux
# make menuconfig
# make dep
# make clean
# make bzImage (or better, insert a floppy and do a "make bzdisk").
# make bzlilo (or if this doesn't work,
cp /usr/src/linux-x.y.z/arch/i386/boot/bzImage /boot/vmlinuz
Edit /etc/lilo.conf and change the image label to point to
/boot/vmlinuz-x.y.z and rerun /sbin/lilo)
reboot (here you may use the disk you made if something goes wrong)
# cd /usr/src/linux
# make modules; make modules_install

This should do it.

--------------------------------------------------------------------------------
Q: I am trying to set up a home page. How do I go about doing that and where
should I put my web files to view them on my Linux box?

A: If you are running the Apache web server then look in
/etc/httpd/conf/srm.conf . There you should see lines like:

UserDir public_html
DirectoryIndex index.html index.shtml index.cgi

This means that your web files should be stored under a directory called
~/public_html and the first file to be read when a user accesses your web
site with http://x1.x2.x3.x4/~<your-username> must be one of ~/index.html ,
~/index.shtml , or ~/index.cgi . If you have an entry like:

127.0.0.1 localhost

in your /etc/hosts directory (ie. you have loopback enabled) than you can
make sure everything is OK by pointing your browser to
http://127.0.0.1/~<your-username> . Of course all files must have the right
permissions, in particular you probably want to do
a "chmod a+x ~/public_html" and a "chmod a+r index.html".
If you are not on the Internet this enables you to edit a whole web site on
a Linux box without having to be dialed up to your ISP. You can later upload
the pages to the Internet. This method will pay off in browser speed when
editing your web page.

--------------------------------------------------------------------------------
Q: I would like to have more lines and/or columns displayed when I use the text
consoles. Is there a way I can do this?

A: Yes. If you are using LILO to boot your system then you can do it by
inserting the vga option in your /etc/lilo.conf file. For example a line
saying "vga=ask" will let you choose the text mode at boot time (type
"man lilo.conf" for more details). Don't forget to rerun /sbin/lilo after
you modify /etc/lilo.conf .
Alternatively you could get the SVGATextMode program by anonymous ftp from
<ftp://metalab.unc.edu/pub/linux/utils/console/>.

--------------------------------------------------------------------------------
Q: I have two Linux boxes but they're not networked. What's a good way to
transfer data from one to another.

A: Get a bunch of floppies (one might be enough) and use:

$ tar cvMf /dev/fd0 <file/directory to be archived>

move the floppies to the other PC's floppy drive and do a:

$ tar xvMf /dev/fd0

Alternatively you can use the "split" command to split your file into many
files of a particular size with the "-b" option, copy them to a floppy
with a DOS file system with "mcopy", move the floppies to the other PC, copy
them to the hard drive and redirect the output of "cat" to merge them.

--------------------------------------------------------------------------------
Q: What's the cheapest way to network two Linux boxes?

A: Probably your best bet is to get an Interlink/Laplink/Bi-Directional cable
to connect the parallel ports. This method makes use of the PLIP protocol.
This will allow your PCs to communicate at a speed of approximately 47kB
per second. This is of course somewhat slower than a connection that makes
use of Ethernet cards. See the relevant HOWTOs and mini HOWTOs for more
detail.

--------------------------------------------------------------------------------
Q: I am running X. What's an easy way to put an image file in the background.

A: If you have "xv" installed then you may want to use:

xv -root -max -quit <absolute-path-to-image-file/image-file>

As "xv" is shareware you may want to try "qiv" which you may obtain from
<http://www.klografx.net/qiv/>.

--------------------------------------------------------------------------------
Q: I have read the Brief Linux FAQ (BLFAQ) but could not find what I was
looking for. Where else should I look?

A: Other places include links under <http://www.linux.org/> including the Linux
FAQ (LFAQ) and the various HOWTOs and mini-HOWTOs. Other sites of interest
might include <http://www.xfree86.org/> for X related things and
<ftp://metalab.unc.edu/> if you're looking for interesting applications to
run under Linux.

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

A big thank you to all those people who contributed to this FAQ.
Send me e-mail for corrections and enhancements.

--
maintained by: Neil Zanella
e-mail: nzanella@ganymede.cs.mun.ca

Read more ...

The Sig11 FAQ

Signal 11 while compiling the kernel

This FAQ describes what the possible causes are for an effect that
bothers lots of people lately. Namely that a linux(*)-kernel (or any
other large package for that matter) compile crashes with a "signal
11". The cause can be software or (most likely) hardware. Read on to
find out more.
(*) Of course nothing is Linux specific. If your hardware is flaky,
Linux, Windows 3.1, FreeBSD, Windows NT and NextStep will all crash.
If you are not reading this at http://www.bitwizard.nl/sig11/, that's
where you can find the most recent version.
For those of you who prefer reading this in French, the French
translation can be found at
http://www.linux-france.com/article/sig11fr/.
Email me at R.E.Wolff@BitWizard.nl if you find any spelling errors,
worthwhile additions or with an "it also happened to me" story. (Note
that I reject some suggested additions on my belief that it is
technical nonsense).



The Sig11 FAQ

QUESTION

My kernel compile crashes with
gcc: Internal compiler error: program cc1 got fatal signal 11

What is wrong with the compiler? Which version of the compiler do I
need? Is there something wrong with the kernel?

ANSWER

Most likely there is nothing wrong with your installation, your
compiler or kernel. It very likely has something to do with your
hardware. There are a variety of subsystems that can be wrong, and
there is a variety of ways to fix it. Read on, and you'll find out
more. There is one big exception to this "rule". Red Hat 5.0. There is
more near the end.
_________________________________________________________________

QUESTION

Ok it may not be the software, How do I know for sure?

ANSWER

First lets make sure it is the hardware that is causing your trouble.
When the "make" stops, simply type "make" again. If it compiles a few
more files before stopping, it must be hardware that is causing you
troubles. If it immediately stops again (i.e. scans a few directories
with "nothing to be done for xxxx" before bombing at exactly the same
place), try
dd if=/dev/HARD_DISK of=/dev/null bs=1024k count=MEGS

Change HARD_DISK to "hda" to the name of your harddisk (e.g. hda or
sda. Or use "df ."). Change the MEGS to the number of megabytes of
main memory that you have. This will cause the first several megabytes
of your harddisk to be read from disk, forcing the C source files and
the gcc binary to be reread from disk the next time you run it. Now
type make again. If it still stops in the same place I'm starting to
wonder if you're reading the right FAQ, as it is starting to look like
a software problem after all.... Take a peek at the "what are the
other possibilities" question..... If without this "dd" command the
compiler keeps on stopping at the same place, but moves to another
place after you use the "dd" you definitely have a disk->ram transfer
problem.

QUESTION

What does it really mean?

ANSWER

Well, the compiler accessed memory outside its memory range. If this
happens on working hardware it's a programming error inside the
compiler. That's why it says "internal compiler error". However when
the hardware occasionally flips a bit, gcc uses so many pointers, that
it is likely to end up accessing something outside of its addressing
range. (random addresses are mostly outside your addressing range, as
not very many people have a significant part of 4G as main memory...
:-) It seems that nowadays, everybody with "signal 11" problems gets
directed to this page. If you're developping your own software or have
software that hasn't been debugged quite enough, "signal 11" (or
segmentation fault) is still a strong hint that there is something
wrong with the program. Only when you can cause a "known working"
program like "gcc" to crash on a dataset (e.g. the Linux-kernel) that
has also been well-tested, then it becomes a hint that there is
something wrong with your hardware.
_________________________________________________________________

QUESTION

Ok. I may have a hardware problem what is it?

ANSWER

If it happens to be the hardware it can be:
* Main memory. Your main memory might be getting an occasional bit
wrong. If this happens on the "writes", you won't see any parity
errors. There are several ways to fix it:
+ The memory speed might be too slow. Increase the number of
wait states in the BIOS.
This could be caused by the AMIBIOSs autoconfig option: it
may only know about 486s running upto 80 MHz, whereas you
currently buy 100 MHz versions. -- Pat V.
+ The memory speed might be too slow. Get faster DRAM SIMMs.
For example current ASUS motherboards require 60 ns DRAM if
you have a 100, or 133 MHz processor (Take a look in your
motherboard's manual). I've heard reports that 70 ns also
works, reliability problems like random sig11's belong to the
possibilities.... (I wouldn't take the risk) -- Andrew
Eskilsson (mpt95aes@pt.hk-r.se)
+ There is a bad chip on one of the SIMMs. If you own more than
1 bank of memory you might be able to pull SIMMs and see if
the problem goes away. Be careful for STATIC!!!
+ We handled a hard one here the last week. It turned out that
ALL 4 16Mb SIMMs were broken in that they dropped a bit
around once per hour. This was sufficient to crash the
machine in about a day, or crash a kernel compile in about an
hour. A new set of SIMMs works perfectly. It took a long
while to diagnose this one, because all 4 of the SIMMs were
affected equally, so leaving half of the memory out didn't
change things.
Mark Kettner (kettner@cat.et.tudelft.nl) reports that his
system was capable of running my memory test for 2300 times
faultlessly, but then detected around 10 errors. It then
continued detecting no faults for a few hundred runs
again..... In his case running kernel compiles was a much
more efficient way of detecting the health of the system (in
the most stable configuration the system could compile around
14 kernels before going bzurk). His solution was to "trade
in" the old memory for a so called "memory upgrade". The
shopkeeper then "tests" in their memory tester, which OKs the
memory. he then got a good discount on the new memory :-).
+ It seems that some 30-72 pin converters can cause memory
errors. (It hasn't been proven whether the 4 SIMMS in the
converter had gone bad, or if the SIMM converter was at
fault. The SIMMS had been functioning perfectly for years
before they were moved into the converter....) -- Naresh
Sharma (n.sharma@is.twi.tudelft.nl). Paul Gortmaker
(paul.gortmaker@anu.edu.au) adds that the SIMM converters
should have at least 4 bypass capacitors to keep the power
supply of the SIMMs clean.
+ If the refresh of the DRAM isn't functioning properly, the
DRAMs will slowly lose their information. Some (486)
motherboards stop refreshing correctly when you turn on
"hidden refresh". There seems to be a program called "dram"
around that can also mess up your refresh to cause sig11
problems. -- Hank Barta (hank@pswin.chi.il.us), Ron Tapia
(tapia@nmia.com)
+ The number of waitstates could be too low. Increase the
number of waiststates in the BIOS for a fix. The Intel
Endeavour board doesn't allow you to increase the memory
waitstates. This can supposedly be fixed by flashing a MR
BIOS into the motherboard. -- David Halls
(david.halls@cl.cam.ac.uk)
* Cache memory. Your cache memory might be getting an occasional bit
wrong. Caches are usually not equipped with parity. You can
diagnose that this is the case by turning off the cache in the
BIOS. If the problem goes away it is probably the cache. There are
several ways to fix it:
+ The cache memory speed might be too slow. Increase the number
of wait states in the BIOS.
+ The cache memory speed might be too slow. Get faster SRAM
chips.
+ There is a bad chip in your cache. It is unlikely that you
can swap chips as easily as with SIMMs. Be careful for
STATIC!!! -- Joseph Barone (barone@mntr02.psf.ge.com)
+ The cache might be set to "write back" while there is a bug
in the write back implementation of your chipset. The
motherboard where this happened was a "MV020 486VL3H" (with
20M RAM) -- Scott Brumbaugh (scottb@borris.beachnet.com)
(Mail address doesn't work. Scott: Get back at me with a
valid return address)
+ The motherboard may require a jumper to switch between Cache
On A Stick and the old-fashioned dip chip cache. (JP16 on Rev
2.4 ASUS P/I-P55TP4XE motherboards)
* Disk transfers. A block coming from disk might incur an occasional
bit error.
+ If you have this problem, you are most likely to have to do
the "dd" command to "move" the problem from one place to the
next....
+ Some IDE harddisks cannot handle the "irq_unmasking" option.
This may only show under load. And it could show as a sig11.
+ Do you have a kalok 31xx? Throw it in the garbage. (or sell
it to a DOS user)
+ SCSI? Termination? A short bus might still work (unreliably
that is) with bad termination. A long bus might get errors
anyway. Can you turn on parity on the host and the DISK?
* Overclocking. Some vendors (or private people) think it is
possible to overclock some CPUs. Some of them may work others
don't. You might want to try turning off turbo (note that most
pentium motherboards no longer support a non-turbo mode) and see
if the problem goes away. Check the speed of your CPU compared
(printed on it, carefully remove the fan if necessary) with what
the motherboard jumpers or BIOS settings say.... It seems that
even Intel may make mistakes in this area. I now have several
reliable reports that official pentium would sig11 at their rated
speed, but not at a lower speed. As for some speeds the
motherboard is only stressed HARDER for a slower processor speed,
(120 MHz-> motherboard runs at 60MHz, 100MHz-> motherboard runs at
66MHz), I think it is unlikely that this has anything to do with
the motherboard. Moreover a new 120MHz processor is now
functioning correctly. -- Samuel Ramac (sramac@vnet.ibm.com). This
is not unique to Intel or any of its competitors.
* CPU temperature. A high speed processor might overheat without the
correct heat sink. This can also be caused by a failing fan. (My
personal '486 has a fan that takes a few minutes to get up to
speed. It probably will never really FAIL because it's now
decommisioned :-). The CPU can become erratic if "pushed" by
compiling a kernel. This problem becomes worse if you disable
"HALT" on the LILO command line. Linux tries to power-down the CPU
by executing the "halt" instruction when the system is idle. This
preserves power, and therefore the CPU temperature drops when the
system is idle. You therefore might not notice this problem when
simply editing, and it might only surface after hours of CPU
intensive jobs when the ambient temp is high. If you have a
Pentium with Fdiv bug, it is advisable to trade it in at Intel.
They will send you a new one that preconfigured with an official
Intel-approved FAN. Also note that most normal glues are very bad
thermal conductors. There is special thermal glue available that
should be used when a fan needs to be glued to a CPU. -- Arno
Griffioen (arno@ixe.net), -- W. Paul Mills (wpmills@midusa.net) --
Alan Wind (wind@imada.ou.dk)
Intel says that the allowable temperature ranges for the outside
of your CPU is:
0 to +85 C: Intel486 SX, Intel486 DX, IntelDX2, IntelDX4 processor
0 to +95 C: IntelDX2, IntelDX4 OverDrive® processors
0 to +80 C: 60 MHz Pentium® processor
0 to +70 C: 66 to 166 MHz Pentium processor
For information on how to measure this and some confirmation of
what I say here, see:
http://pentium.intel.com/procs/support/faqs/iarcfaq.htm
(Especially questions Q5, Q6 and Q12. The document is getting
slightly outdated, but it is still very accurate. It seems the
questions move around a bit every now and then as well.)
* CPU voltage. Some motherboards allow you to select the CPU
voltage. Some motherboards badly document the jumper settings that
manage this. It seems that a 5V processor might still work most of
the time at 3.3 volts..... -- Karl Heyes (krheyes@comp.brad.ac.uk)
* RAM voltage. It seems that vendors are preparing for 3.3V RAM now.
Most memory is still 5V. (but be careful.... 3.3v RAM will break
at 5V.....)
* Local bus overloading. At 25 MHz you're allowed to have 3
VesaLocalBus (VLB) cards, At 33MHz only two, at 40MHz only one and
guess what at 50MHz NONE! (i.e. you are allowed to run your system
with a 50MHz local bus, but then you're not allowed to use any VLB
cards). Some systems start acting flaky when you overload the VLB.
Even when your VLB isn't overloaded (over the limits stated
above), the system may lose a few nanoseconds of margin by adding
an extra VLB card, so you might need to add a cache wait state or
something after you've added a new VLB card.... -- Richard
Postgate (postgate@cafe.net)
* Power management. Some laptops (and nowadays also "green" pc's)
have power management features. These might interfere with Linux.
One feature might save a memory image to HD and restore the RAM
when you press a key. This sounds like fun, but Linux device
drivers don't expect that the hardware has been turned off between
two acesses. Some may recover, but others not. Try turning it off,
or enabeling "APM support" in your kernel. -- Elizabeth Ayer
(eca23@cam.ac.uk)
* The CPU itself. Several people are reporting that they have found
nothing to blame except the CPU. This could also have been an
incompatibility between the CPU and the motherboard. A wave of
reports concerning Intel CPUs has passed (Feb '97). A new wave of
reports is coming in that are blaming Cyrix/IBM 6x86 CPUs.
Although it could indeed be the CPU, it could also be that your
motherboard is incompatible with your CPU. At least I've seen a
motherboard manual mention that it isn't compatible with older
6x86's. My own experience is that these devices aren't bad at all,
and on a kernel compile I benchmarked a P166+ to be equivalent
with a P155 (1.3 times faster than a P120).

The Memory hole. Many modern motherboards allow you to use old ISA
video cards with one or two megabytes of linear frame buffer. To
achieve this, they have to map out the memory just below 16Mb. Nobody
actually ever used this feature, but if you turn the memory hole (or
LFB support in some BIOSes) on, your machine will certainly be
flaky..... -- Paul Connolly (pconnolly@macdux.com.au)
_________________________________________________________________

QUESTION

RAM timing problems? I fiddled with the bios settings more than a
month ago. I've compiled numerous kernels in the mean time and nothing
went wrong. It can't be the RAM timing. Right?

ANSWER

Wrong. Do you think that the RAM manufacturers have a machine that
makes 60ns RAMs and another one that makes 70ns RAMs? Off course not!
They make a bunch, and then test them. Some meet the specs for 60 ns,
others don't. Those might be 61 ns if the manufacturer would have to
put a number to it. In that case it is quite likely that it works in
your computer when for example the temperature is below 40 degrees
centigrade (chips become slower when the temp rises. That's why some
supercomputers need so much cooling).

However "the coming of summer" or a long compile job may push the
temperature inside your computer over the "limit". -- Philippe Troin
(ptroin@compass-da.com)
_________________________________________________________________

QUESTION

I got suckered into not buying ECC memory because it was slightly
cheaper. I feel like a fool. I should have bought the more expensive
ECC memory. Right?

ANSWER

Buying the more expensive ECC memory and motherboards protects you
against a certain type of errors: Those that occur randomly by passing
alpha particles.
Because most people can reproduce "signal 11" problems within half an
hour using "gcc" but cannot reproduce them by memory testing for hours
in a row, that proves to me that it is not simply a random alpha
particle flipping a bit. That would get noticed by the memory test
too. This means that something else is going on. I have the impression
that most sig11 problems are caused by timing errors on the CPU <->
cache <-> memory path. ECC on your main memory doesn't help you in
that case. When should you buy ECC? a) When you feel you need it. b)
When you have LOTS of RAM. (Why not a cut-off number? Because the
cut-off changes with time, just like "LOTS".) Some people feel very
strong about everybody using ECC memory. I refer them to reason "a)".
_________________________________________________________________

QUESTION

Memory problems? My BIOS tests my memory and tells me its ok. I have
this fancy DOS program that tells me my memory is OK. Can't be memory
right?

ANSWER

Wrong. The memory test in the BIOS is utterly useless. It may even
occasionally OK more memory than really is available, let alone test
whether it is good or not.
A friend of mine used to have a 640k PC (yeah, this was a long time
ago) which had a single 64kbit chip instead of a 256kbit chip in the
second 256k bank. This means that he effectively had 320k working
memory. Sometimes the BIOS would test 384k as "OK". Anyway, only
certain applications would fail. It was very hard to diagnose the
actual problem....
Most memory problems only occur under special circumstances. Those
circumstances are hardly ever known. gcc Seems to exercise them. Some
memory tests, especially BIOS memory tests, don't. I'm no longer
working on creating a floppy with a linux kernel and a good memory
tester on it. Forget about bugging me about it......
The reason is that a memory test causes the CPU to execute just a few
instructions, and the memory access patterns tend to be very regular.
Under these circumstances only a very small subset of the memories
breaks down. If you're studying Electrical Engineering and are
interested in memory testing, a masters thesis could be to figure out
what's going on. There are computer manufacturers that would want to
sponsor such a project with some hardware that clients claim to be
unreliable, but doesn't fail the production tests......
_________________________________________________________________

QUESTION

Does it only happen when I compile a kernel?

ANSWER

Nope. There is no way your hardware can know that you are compiling a
kernel. It just so happens that a kernel compile is very tough on your
hardware, so it just happens a lot when you are compiling a kernel.
* People have seen "random" crashes for example while installing
using the slackware installation script.... -- dhn@pluto.njcc.com
* Others get "general protection errors" from the kernel (with the
crashdump). These are usually in /var/adm/messages. --
fox@graphics.cs.nyu.edu
_________________________________________________________________

QUESTION

Nothing crashes on NT, Windows 95, OS/2 or DOS. It must be something
Linux specific.

ANSWER

First of all, Linux stresses your hardware more than all of the above.
Some OSes like the Microsoft ones named above crash in unpredictable
ways anyway. Nobody is going to call Microsoft and say "hey, my
windows box crashed today". If you do anyway, they will tell you that
you, the user, made an error (see the interview with Bill Gates in a
German magazine....) and that since it works now, you should shut up.
Those OSes are also somewhat more "predictable" than Linux. This means
that Excel might always be loaded in the exact same memory area.
Therefore when the bit-error occurs, it is always excel that gets it.
Excel will crash. Or excel will crash another application. Anyway, it
will seem to be a single application that fails, and not related to
memory.
What I am sure of is that a cleanly installed Linux system should be
able to compile the kernel without any errors. Certainly no sig-11
ones. (** Exception: Red Hat 5.0 with a Cyrix processor. See
elsewhere. **)
Really Linux and gcc stress your hardware more than other OSes. If you
need a non-linux thingy that stresses your hardware to the point of
crashing, you can try winstone. -- Jonathan Bright
(bright@informix.com)
_________________________________________________________________

QUESTION

Is it always signal 11?

ANSWER

Nope. Other signals like four, six and seven also occur occasionally.
Signal 11 is most common though.

As long as memory is getting corrupted, anything can happen. I'd
expect bad binaries to occur much more often than they really do.
Anyway, it seems that the odds are heavily biased towards gcc getting
a signal 11. Also seen:
* free_one_pmd: bad directory entry 00000008
* EXT2-fs warning (device 08:14): ext_2_free_blocks bit already
cleared for block 127916
* Internal error: bad swap device
* Trying to free nonexistent swap-page
* kfree of non-kmalloced memory ...
* scsi0: REQ before WAIT DISCONNECT IID
* Unable to handle kernel NULL pointer dereference at virtual
address c0000004
* put_page: page already exists 00000046
invalid operand: 0000
* Whee.. inode changed from under us. Tell Linus
* crc error -- System halted (During the uncompress of the Linux
kernel)
* Segmentation fault
* "unable to resolve symbol"
* make [1]: *** [sub_dirs] Error 139
make: *** [linuxsubdirs] Error 1
* The X Window system can terminate with a "caught signal xx"

The first few ones are cases where the kernel "suspects" a
kernel-programming-error that is actually caused by the bad memory.
The last few point to application programs that end up with the
trouble.

-- S.G.de Marinis (trance@interseg.it)
-- Dirk Nachtmann (nachtman@kogs.informatik.uni-hamburg.de)
_________________________________________________________________

QUESTION

What do I do?

ANSWER

Here are some things to try when you want to find out what is wrong...
note: Some of these will significantly slow your computer down. These
things are intended to get your computer to function properly and
allow you to narrow down what's wrong with it. With this information
you can for example try to get the faulty component replaced by your
vendor.
* Jumper the motherboard for lower CPU and bus speed.
* Go into the BIOS and tell it "Load BIOS defaults". Make sure you
write the disk drive settings down beforehand.
* Disable the cache (BIOS) (or pull it out if it's on a "stick").
* boot kernel with "linux mem=4M" (disables memory above 4Mb).
* Try taking out half the memory. Try both halves in turn.
* Fiddle with settings of the refresh (BIOS)
* Try borrowing memory from someone else. Preferably this should be
memory that runs Linux flawlessly in the other machine...
(Sillicon graphics Indy machines are also nice targets to borrow
memory from)
* If you want to verify if a solution really works try the
following:
tcsh
cd /usr/src/linux
make zImage
foreach i (0 1 2 3 4 5 6 7 8 9)
foreach j (0 1 2 3 4 5 6 7 8 9)
make clean;make zImage > log."$i"$j
end
end
All the resulting logfiles should be the same. (The first "make
zImage" makes sure that the dependencies are already
generated.....) This takes around 24 hours on a 100MHz pentium
with 16Mb of memory. (and about 3 months on a 386 with 4Mb :-).

The hardest part is that most people will be able to do all of the
above except borrowing memory from someone else, and it doesn't make a
difference. This makes it likely that it really is the RAM. Currently
RAM is the most pricy part of a PC, so you rather not have this
conclusion, but I'm sorry, I get lots of reactions that in the end
turn out to be the RAM. However don't despair just yet: your RAM may
not be completely wasted: you can always try to trade it in for
different or more RAM.
_________________________________________________________________

QUESTION

I had my RAMs tested in a RAM-tester device, and they are OK. Can't be
the RAM right?

ANSWER

Wrong. It seems that the errors that are currently occuring in RAMS
are not detectable by RAM-testers. It might be that your motherboard
is accessing the RAMs in dubious ways or otherwise messing up the RAM
while it is in YOUR computer. The advantage is that you can sell your
RAM to someone who still has confidence in his RAM-tester......
_________________________________________________________________

QUESTION

What are other possibilities?

ANSWER

Others have noted the following possibilities:
* Red Hat 5.0 crashes for some people while installing. Others are
only running into problems when compiling the kernel. It seems
that the gcc that comes with Red Hat 5.0 is odd in the respect
that it crashes on Cyrix processors when compiling the kernel.
This is VERY odd. I would think that the only way that this can be
the case is whent he Cyrix has a bug that has gone undetected all
this time, and reliably gets triggered when THAT gcc compiles the
Linux kernel. Anyway, if you just want compile a kernel, you
should get
ftp://ftp.redhat.com/home/wanger/gcc/gcc-2.7.2.3-9.i386.rpm . (I
had to change the URL twice in a week. If it changes again, you'll
just have to click your way to the errata at starting at
http://www.redhat.com/) I don't know of a workaround if your
system crashes while installing, except for installing a minimal
base and then adding packages using 'glint' or 'rpm'.
* Compiling a 2.0.x kernel with a 2.8.x gcc or any egcs doesn't
work. There are a few bugs in the kernel that don't show up
because gcc 2.7.x does a lowsy job optimizing it. gcc 2.8.x and
egcs just dump some of the code because we didn't tell it not to.
Anyway, you usually get a kernel that seems to work but has funny
bugs. For example X may crash with a signal 11. Oh, and before you
ask, no it's not going to be fixed. Don't bother Alan or Linus
about this OK? -- Hans Peter Verne (h.p.verne@kjemi.uio.no)
* The pentium-optimizing-gcc (the one with the version number ending
in "p") fails with the default options on certain source files
like floppy.c in the kernel. The "triggers" are in the kernel,
libc and in gcc itself. This is easily diagnosed as "not a
hardware problem" because it always happens in the same place. You
can either disable some optimizations (try -fno-unroll-loops
first) or use another gcc. -- Evan Cheng (evan@top.cis.syr.edu)
(In other words: gcc 2.7.2p crashes with sig11 on floppy.c .
Workaround-1: Use plain gcc. Workaround-2: Manually compile
floppy.c with "-O" instead of "-O2". )
* A badly misconfigured gcc -- some parts from one version, some
from another. After a few weeks I ended up re-installing from
scratch to get everything right. -- Richard H. Derr III
(rhd@Mars.mcs.com).
* Gcc or the resulting application may terminate with sig11 when a
program is linked against the SCO libraries (which come with
iBCS). This occurs on some applications that have -L/lib in their
LDFLAGS....
* When compiling a kernel with an ELF compiler, but configured for
a.out (or the other way around, I forgot) you will get a signal 11
on the first call to "ld". This is easily identified as a software
problem, as it always occurs on the FIRST call to "ld" during the
build. -- REW
* An Ethernet card together with a badly configured PCI BIOS. If
your (ISA) Ethernet card has an aperture on the ISA bus, you might
need to configure it somewhere in the BIOS setup screens.
Otherwise the hardware would look on the PCI bus for the shared
memory area. As the ISA card can't react to the requests on the
PCI bus, you are reading empty "air". This can result in
segmentation faults and kernel crashes. -- REW
* Corrupted swap partition. Tony Nugent (T.Nugent@sct.gu.edu.au)
reports he used to have this problem and solved it by an mkswap on
his swap partition. (Don't forget to type "sync" before doing
anything else after an mkswap. -- Louis J. LaBash Jr.
(lou@minuet.siue.edu))
* NE2000 card. Some cheap Ne2000 cards might mess up the system. --
Danny ter Haar (dth@cistron.nl) I personally might have had
similar problems, as my mail server crashed hard every now and
then (once a day). It now seems that 1.2.13 and lots of the 1.3.x
kernels have this bug. I haven't seen it in 1.3.48. Probably got
fixed somewhere in the meantime.... -- REW
* Power supply? No I don't think so. A modern heavy system with two
or three harddisk, both SCSI and IDE will not exceed 120 Watts or
so. If you have loads of old harddisks and old expansion cards the
power requirements will be higher, but still it is very hard to
reach the limits of the power supply. Of course some people manage
to find loads of old full-size harddisks and install them into
their big-tower. You can indeed overload a powersupply that way.
-- Greg Nicholson (greg@job.cba.ua.edu) A faulty power supply CAN
of course deliver marginal power, which causes all of the
malfunctioning that you read about in this file.... -- Thorsten
Kuehnemann (thorsten@actis.de)
* An inconsistent ext2fs. Some circumstances can cause the kernel
code of the ext2 file system to result in Signal 11 for Gcc. --
Morten Welinder (terra@diku.dk)
* CMOS battery. Even if you set the BIOS as you want it, it could be
changing back to "bad" settings under your nose if the CMOS
battery is bad. -- Heonmin Lim (coco@me.umn.edu)
* No or too little swap space. Gcc doesn't gracefully handle the
"out of memory" condition. -- Paul Brannan (brannanp@musc.edu)
* Incompatible libraries. When you have a symlink from "libc.so.5"
pointing to "libc.so.6", some applications will bomb with sig11.
-- Piete Brooks (piete.brooks@cl.cam.ac.uk).
_________________________________________________________________

QUESTION

I don't believe this. To whom has this happened?

ANSWER

Well for one it happened to me personally. But you don't have to
believe me. It also happened to:
* Johnny Stephens (icjps@asuvm.inre.asu.edu)
* Dejan Ilic (d92dejil@und.ida.liu.se)
* Rick Tessner (rick@myra.com)
* David Fox (fox@graphics.cs.nyu.edu)
* Darren White (dwhite@baker.cnw.com) (L2 cache)
* Patrick J. Volkerding (volkerdi@mhd1.moorhead.msus.edu)
* Jeff Coy Jr. (jcoy@gray.cscwc.pima.edu) (Temp problems)
* Michael Blandford (mikey@azalea.lanl.gov) (Temp problems: CPU fan
failed)
* Alex Butcher (Alex.Butcher@bristol.ac.uk) (Memory waitstates)
* Richard Postgate (postgate@cafe.net) (VLB loading)
* Bert Meijs (L.Meijs@et.tudelft.nl) (bad SIMMs)
* J. Van Stonecypher (scypher@cs.fsu.edu)
* Mark Kettner (kettner@cat.et.tudelft.nl) (bad SIMMs)
* Naresh Sharma (n.sharma@is.twi.tudelft.nl) (30->72 converter)
* Rick Lim (ricklim@freenet.vancouver.bc.ca) (Bad cache)
* Scott Brumbaugh (scottb@borris.beachnet.com)
* Paul Gortmaker (paul.gortmaker@anu.edu.au)
* Mike Tayter (tayter@ncats.newaygo.mi.us) (Something with the
cache)
* Benni ??? (benni@informatik.uni-frankfurt.de) (VLB Overloading)
* Oliver Schoett (os@sdm.de) (Cache jumper)
* Morten Welinder (terra@diku.dk)
* Warwick Harvey (warwick@cs.mu.oz.au) (bit error in cache)
* Hank Barta (hank@pswin.chi.il.us)
* Jeffrey J. Radice (jjr@zilker.net) (Ram voltage)
* Samuel Ramac (sramac@vnet.ibm.com) (CPU tops out)
* Andrew Eskilsson (mpt95aes@pt.hk-r.se) (DRAM speed)
* W. Paul Mills (wpmills@midusa.net) (CPU fan disconnected from CPU)
* Joseph Barone (barone@mntr02.psf.ge.com) (Bad cache)
* Philippe Troin (ptroin@compass-da.com) (delayed RAM timing
trouble)
* Koen D'Hondt (koen@dutlhs1.lr.tudelft.nl) (more kernel error
messages)
* Bill Faust (faust@pobox.com) (cache problem)
* Tim Middlekoop (mtim@lab.housing.fsu.edu) (CPU temp: fan
installed)
* Andrew R. Cook (andy@anchtk.chm.anl.gov) (bad cache)
* Allan Wind (wind@imada.ou.dk) (P66 overheating)
* Michael Tuschik (mt2@irz.inf.tu-dresden.de) (gcc2.7.2p victim)
* R.C.H. Li (chli@en.polyu.edu.hk) (Overclocking: ok for months...)
* Florin (florin@monet.telebyte.nl) (Overclocked CPU by vendor)
* Dale J March (dmarch@pcocd2.intel.com) (CPU overheating on laptop)
* Markus Schulte (markus@dom.de) (Bad RAM)
* Mark Davis (mark_d_davis@usa.pipeline.com) (Bad P120?)
* Josep Lladonosa i Capell (jllado@arrakis.es) (PCI options
overoptimization)
* Emilio Federici (mc9995@mclink.it) (P120 overheating)
* Conor McCarthy (conormc@cclana.ucd.ie) (Bad SIMM)
* Matthias Petofalvi (mpetofal@ulb.ac.be) ("Simmverter" problem)
* Jonathan Christopher Mckinney (jono@tamu.edu) (gcc2.7.2p victim)
* Greg Nicholson (greg@job.cba.ua.edu) (many old disks)
* Ismo Peltonen (iap@bigbang.hut.fi) (irq_unmasking)
* Daniel Pancamo (pancamo@infocom.net) (70ns instead of 60 ns RAM)
* David Halls (david.halls@cl.cam.ac.uk)
* Mark Zusman (marklz@pointer.israel.net) (Bad motherboard)
* Elizabeth Ayer (eca23@cam.ac.uk) (Power management features)
* Thorsten Kuehnemann (thorsten@actis.de)
*
* (Email me with your story, you might get to be mentioned here...
:-) ---- Update: I like to hear what happened to you. This will
allow me to guess what happens most, and keep this file as
accurate as possible. However I now have around 500 different
Email addresses of people who've had sig-11 problems. I don't
think that it is useful to keep on adding "random" people's names
on this list. What do YOU think?
_________________________________________________________________

I'm interested in new stories. If you have a problem and are unsure
about what it is, it may help to Email me at R.E.Wolff@BitWizard.nl .
My curiosity will usually drive me to answering your questions until
you find what the problem is..... (on the other hand, I do get pissed
when your problem is clearly described above :-)

Read more ...

Connect to MS SQL 6.x+ via Openlink/PHP/ODBC mini-HOWTO


Zili Zhang, silen@silen.net
v2.0b, 15 July 1999(http://www.silen.net/openlink-php-odbc.txt)
v1.0b, 5 June 1999(http://www.silen.net/openlink-php-odbc.old.txt)

How to connect to MS SQL 6.x+ database server via ODBC functions of
PHP3(3.0.1x or above) compiled
with Openlink drivers under Linux.

1. Disclaimer
2. Changlog
3. Introduction
4. Openlink
5. PHP
6. Example
7. FAQ


1. Disclaimer
The following document is offered in good faith as comprising only safe
configuration
and procedures. No responsibility is accepted by the author for any loss
or damage
caused in any way to any person or equipment, as a direct or indirect
consequence of
following these instructions.

2. ChangeLog
v2.0b
A. iODBC is not required to make things work.
B. No missing *.h files, so do not need to modify unified_odbc.h of
PHP.
C. Example code changes, discarding odbc_num_rows() function.
D. Explicit announce support for MS SQL 7.0.
E. FAQ section added.

3. Introduction
In the Unix world, people may hate to be invoked with any M$ related
software. However,
in the real world, the boss may require you to store data in a MS SQL
database on NT
and run web application on Linux. What to do? Quit the job or sit down
to read this
document? If you choose latter, I will give you a detailed installation
guide so that
you can keep the job for a while. It is a How-to guide, not a Why-so
guide. So don't ask
me why abc instead of cba. I don't know either. :>

PHP is becoming more and more popular in web programmers, mainly because
it can be configured
to connect to various databases like Oracle, MySQL, Solid and so on. But
for a MS SQL
server, the problem is different. Though you can use PHP's Sybase-ct
support features
to directly connect to MSSQL, many people(at least me) prefers to
connect via ODBC.

Utilizing Openlink ODBC middleware, you can use those ODBC_xxxx
functions to connect to all the database Openlink has a driver for. You
have to install
Openlink Linux client and Server middleware and re-compile PHP
to support ODBC functions. In the end, I made a script sample for
reference.

4. Openlink
This step is a little bit complicated. You have to done works on both
sides of your
Linux client machine and NT server.
4.1 On the client end:
a. From ftp://www.openlinksw.com/, download install.sh and likoxglc.taz
(for a libc6 system) or likoxxxx.taz(for a libc5 system).
b. mkdir /usr/local/openlink
c. copy install.sh and likoxglc.taz into /usr/local/openlink
d. cd /usr/local/openlink
e. sh install.sh, the install script will ask you the owner and group of
the program.
It will extract things to odbcsdk directory under /usr/local/openlink
and copy a
.odbc.ini into the owner's home directory.

4.2 On the server end:
a. From http://www.openlinksw.com/, download ntadm65x.zip into your NT
server.
b. unzip ntadm65x.zip
c. cd disk1 directory of where you unzip the package.
d. execute setup and follow the instructions to install the Openlink
middleware.
e. remember to start Openlink request broker from start menu or service
control
panel.

4.3 Configuration before test
a. keep the .odbc.ini in your home directory.
b. copy the udbc.ini file from the bin directory of Openlink middleware
install
directory to the /etc directory of client.
c. customize /etc/udbc.ini. In [dsn_sql6] section, change the host,
database, username
and password entries to fit your server settings. Here is part of my
/etc/udbc.ini:
[dsn_sql6]
Host = 10.0.0.1
ServerType = sql6
;ServerOptions =
Database = pubs
;FetchBufferSize = 30
UserName = sa
Password = xxxxxxx
d. add in your environment
LD_LIBRARY_PATH='/usr/local/openlink/odbcsdk/lib' and export
it. In csh shell, type: setenv LD_LIBRARY_PATH
/usr/local/openlink/odbcsdk/lib

4.4 Test with odbctest
a. cd /usr/local/openlink/odbcsdk/examples
b. ./odbctest
c. type dsn=dsn_sql6
d. when 'sql>' appears, you can execute your sql clauses to test the
connection.

5. PHP
Now we have Openlink and can go to PHP compilation. Note for this
version, PHP
3.0.10 or above is required to make things work.
a. From http://www.php.net, download php-3.0.11.tar.gz
b. gzip -dc php-3.0.11.tar.gz|tar -xof -
c. cd php-3.0.11
d. ./configure --with-openlink (--with-mysql --with-gd=/usr/local/gd1.3
--enable-track-vars) my configuration is to run PHP as CGI mode, support
mysql, gd
as well. Your configuration may be different.
e. make --silent(don't mind if there are warning messages)
f. make install
These will install php executable into /usr/local/bin. Before you
execute php, copy
the library files under /usr/local/openlink/odbcsdk/lib into /usr/lib to
make it easier
for php to find openlink libraries(I know there are better methods :>).

6. Example
Please refers to PHP manual for ODBC functions. Here is my example code
odbc.php3:
(Note that odbc_num_rows() will not return anything, so you must
repeately call
odbc_fetch_row() to get that number.)
/* some environment variables, you can test to comment them out to see
if things
* still work.
*/
putenv("LD_LIBRARY_PATH=/usr/local/openlink/odbcsdk/lib");
putenv("UDBCINI=/etc/udbc.ini");
putenv("ODBCINI=/root/.odbc.ini");
putenv("DebugFile=/tmp/udbc.out"); // debug trace output

$dsn="DSN=dsn_main"; // note 'DSN=' is required
$user="sa";
$password="xxxxxxx";

$sql="SELECT * FROM titles";

/* directly execute mode */
if ($conn_id=odbc_connect("$dsn",$user,$password)){
echo "connected to DSN: $dsn

";
if($result_id=odbc_do($conn_id, $sql)) {
echo "executing '$sql'

";
$num_fields=odbc_num_fields($result_id);
if($num_fields>0){
echo "Number of fields:
$num_fields
";
for($i=1;$i<=$num_fields;$i++){

$field_name[$i-1]=odbc_field_name($result_id,$i);
}
$num_rows=0;
while(odbc_fetch_row($result_id)){
for($i=1;$i<=$num_fields;$i++){

$result[$num_rows][$field_name[$i-1]]=odbc_result($result_id,$i);
}
$num_rows++;
}
echo "Number of rows: $num_rows
";
}else{
echo "not a field returned.

";
}
echo "Results:
";
for($i=0;$i&lq;sizeof($result);$i++){
while(list($key,$value)=each($result[$i])){
echo "$i:$key=$value
";
}
}
echo "freeing result

";
odbc_free_result($result_id);
}else{
echo "can not execute '$sql'

";
}
echo "closing connection $conn_id";
odbc_close($conn_id);
}else{
echo "can not connect to DSN: $dsn

";
}

?>

7. FAQ
a. Q: does this exact procedure work for MSSQL 7.0?
A: Yes, Openlink will upgrade their software to 7.0, but I don't know
when.

b. Q: I didn\'t know that MSSQL knows how to return the number of rows
in the
result, can it?
A: In methods of 1.0b, yes. In 2.0b, no.

c. Q: i followed your "openlink-php-odbc.txt" step by step to install
the
openlink drivers
but i stop by step 4.2 (install ntadm65x.zip).
After installed ntadm65x i try to start the OpenLink Request Broker
i got the error

unable to open the service control manager <5>
press RETURN to exit oplrqb

Could you please tell me how can i fix that Problem ?

A: This should be a problem with NT itself. try restart the computer
and then start openlink service from Control Panel/service manager.

Read more ...

Swap Space Mini HOWTO

by H. Peter Anvin
Copyright © 1994, 1995 H. Peter Anvin

VERSION: 1.3 Date: 19 Jun 1995

This Linux Mini-HOWTO describes how to share your Linux swap partition
with Windows.

Modifications by Rahul U. Joshi Date: 26 Nov 1999

- Added Windows 95/98 specific details.
- Added Red hat Linux specific details.
- Modified the msinfo program.
- Added sections 5 to 10.
- Split up the swap initalization and halt into two shell scripts.
- Modified the scripts to handle signature verification more than once.
- Added details about new type swap areas.


Legal:
Unless otherwise stated, Linux HOWTO documents are copyrighted
by their respective authors. Linux HOWTO documents may be
reproduced and distributed in whole or in part, in any medium
physical or electronic, as long as this copyright notice is
retained on all copies. Commercial redistribution is allowed
and encouraged; however, the author would like to be notified of
any such distributions.

All translations, derivative works, or aggregate works
incorporating Linux HOWTO documents must be covered under this
copyright notice. That is, you may not produce a derivative
work from a HOWTO and impose additional restrictions on its
distribution. Exceptions to these rules may be granted under
certain conditions; please contact the Linux HOWTO coordinator
at the address given below.

In short, we wish to promote dissemination of this information
through as many channels as possible. However, we do wish to
retain copyright on the HOWTO documents, and would like to be
notified of any plans to redistribute the HOWTOs.

If you have any questions, please contact Tim Bynum, the Linux
HOWTO coordinator, at linux-howto@sunsite.unc.edu via email.

Table of Contents

1. Introduction

2. What you need

3. Procedure

3.1 Turn off swapping and create a DOS partition
3.2 Tell Windows the location of the new swap file
3.3 Back up the Total Special Sectors
3.4 Modify the initalization and shutdown scripts to handle
our new configuration
3.5 Reenable swapping

4. A couple of notes

5. What are we exactly doing ?

6. The swapinit.sh script

7. The swaphalt.sh script

8. The msinfo.sh script

9. The original msinfo file

10. Acknowledgements

1. Introduction


Many people use both Linux and MS-Windows. The ability to do so is an
important part of "the Linux revolution"; i.e. letting people
experiment with (and get hooked on) Linux while still being able to
run their off-the-shelf software. Since both Linux and MS-Windows use
virtual memory with swap to disk, a frequently occurring question in
comp.os.linux.setup is how to share swap spaces, in order to reduce the
amount of disk space needed.

There are several methods for sharing swap spaces, the one described
in this document is probably the most complicated one but is the only
one I have encountered that allows maximum performance for both
environments without the risk of trashing a disk partition.

NOTE: If you have used a previous version of this document and have
had problems with swap space not getting properly restored (Windows
claims your permanent swap file is corrupt), try the slightly revised
shutdown script in this version.

2. What you need

This procedure have a few requirements that need to be filled. I
strongly recommend that you fill these requirements *anyway*, as there
are several problems with older versions.

* MS-DOS 5.0 or newer and MS-Windows 3.1/3.11
OR
MS-Windows 95/98

* A shutdown/init that knows to run a file on shutdown.
(The SysVinit-2.50 package can do this, for example.
SysVinit-2.50 is available from sunsite.unc.edu in
/pub/Linux/system/Daemons. Almost all current distributions
use this init package.)


3. The procedure


NOTE: This procedure has been written keeping in mind Red hat Linux 6.0
Although this procedure in general is applicable for all Linux
distributions, the details may vary. You are welcome to add the
details for your distribution. Many users will already have a
swap partition devoted to Linux. I assume you have one.


3.1. Turn off swapping and create a DOS partition

* Boot Linux. Turn off swapping by editing the /etc/fstab file and
commenting the line that describes your swap partition.

* Using fdisk under Linux, delete the swap partition in order to create
free space on the disk.

* Boot DOS. Create a DOS partition (using FDISK) the size = the size
swap space you want. If you cannot create the partition (probably
because DOS FDISK says that all the space in extended partition is
allocated to the logical drive), you can use fdisk or cfdisk under
Linux to create the partition. You can even just change the type of
your swap partition from 82h (Linux Swap) to 06h (FAT16). In that
case you don't need to delete the swap partition, just change the
type.

* Once you have created the partition, Boot DOS if you are not already
in DOS. DOS will be assigned a drive letter to your new partition.
Use that drive letter instead of X whenever these instructions lists
a command like "LABEL X:" or "COPY FOO X:DUMMY.DAT"

* Format this partition using the DOS FORMAT command.
FORMAT X:

* Set the volume label on this partition to "SWAP SPACE" using the DOS
LABEL command. Verify it by the DIR command. Please do this as a
separate step. Some versions of FORMAT do not seem to put the
volume label in the boot sector as it should. [Note: some people
has written me saying the volume label is stored in the root
directory. Yes, but at least since DOS 5.0 it has also been in the
boot sector.]
LABEL X:
DIR X:

* At this stage, you have a DOS partition ready for use for swapping.




3.2. Tell Windows the location of the new swap file

* For Windows 3.1 users --
---------------------

-Start Windows. Go to the Control Panel, select "386 Enhanced".
Select "Virtual Memory" and create a Windows Permanent swap file on
drive X: of maximum size (Windows will tell you the maximum size).
Windows may complain saying it will not use a swap file that big.
Ignore the message and create the file anyway.

-Exit Windows.

* For Windows 95/98 users --
-----------------------
-Start Windows. Go to the Control Panel (Start Settings Control
panel). Double click the System icon. In the resulting System
Properties dialog box, select the Performance tab. Now click the Virtual
Memory button. This will bring up the Virtual Memory dialog box. Select
"Let me specify my own virtual memory settings". Select the drive you
intend to share as swap space with Linux (X:). Keep the Maximum and
Minimum values as selected by Windows. Click OK. Windows will prompt you
to restart your computer. Do it.

-When you restart Windows, you will see that the win386.swp file has been
created on the X: drive. In addition, there is also the Recycled folder.
Since you don't intend to store any other files on this drive and also
a single file on this partition will be convienent, tell Windows not to
maintain Recycle Bin for this (X:) drive. On the Desktop, left click the
Recycle Bin icon, and in the resulting pop-up menu, click Properties.
This will bring up the Recycle Bin Properties dialog box. Click the
Global tab and select "Configure drives independently". Now click the
tab for X: drive (which will have the label SWAP SPACE). In this dialog
box, move the slider for "Maximum size of Recycle Bin" to 0 percent.
The "Space Reserved" entry should now read as 0 bytes. Click OK.
Restart your computer.

* Norton utilities for Win95 users --
--------------------------------
In addition to the above steps, you may want to do the following if you
have Norton Utilities for Win95 installed. In the Recycle Bin Properties
dialog box, click the Norton Protection tab. Select the drive X: and
uncheck the "Enable protection" and the "Pruge protected files after ...
days" check boxes. Click OK.

* Disk Cleanup troubles you ?
---------------------------
If you have Disk Cleanup installed, then ocassionally Windows comes
out with a "Low disk space on drive X:". Since we are using the entire
X: drive for swapping, there is no need to have any free space on X:.
To prevent this dialog box from appearing, start Disk Cleanup (point
to Start Programs Accessories System Tools Disk Cleanup). In
the resulting dialog box, select the X: drive and click OK. The "Disk
Cleanup for drive X:" dislog box appears. Click the "Settings" tab and
uncheck the "If this drive runs low on disk ... blah blah blah" check
box.

* From this stage onwards, Windows will assume that it's swap file is on
drive X:. So the drive X: must be intact each time you boot Windows.




3.3. Back up the Total Special Sectors

* Boot Linux, then log in as root.

* Use the fdisk command to find the name of the partition and its size
in blocks. Create a symbolic link from /dev/winswap to this
partition. If the partition is hda7, then type:
ln -s /dev/hda7 /dev/winswap

[NOTE TO PURISTS: Please use a symlink. The name of this partition
is going to go into several configuration files and inconsistencies
could be fatal.]

* Find the "Total Special Sectors" for the swap drive.
These are nothing but the total number of sectors required for the boot
sector, FAT and root directory. There are a number of ways to find this
number. Simplest copy the msinfo.sh file from section 8 using your
favourite editor. Give the following commands at the shell prompt

# cp Swap-Space-HOWTO msinfo.sh
# chmod +x msinfo.sh

(Much easier if you use one of the editors with KDE or GNOME)

Now, open the msinfo.sh file in the editor and delete everything except
the msinfo.sh file in section 8. Now run this file as

# ./msinfo.sh /dev/winswap

The program will print the some information about the swap partition.
Take note at the number saying "Total special sectors", and verify
that the volume label says "SWAP SPACE". If it does not, reboot DOS
and re-do the LABEL command.

* Note: You can also find the "Total Special Sectors" using tools
that can display the Boot sector like the Norton Disk Editor or
minfo from mtools under Linux. For Norton Disk Editor, select
"Boot Sector" from the Object menu. Note down the following
entries :

Reserved Sectors at beginning = r
FAT copies = f
Root directory entries = d
Sectors per FAT = s

Now the "Total Special Sectors" is given by

T = r + (s * f) + (d / 16)

However, using the above program is more convienent.

* [Optional step] Windows may occasionally leave some space on the
partition, even if it is told not to. Don't attempt to use this
space, since it will be erased any time you run Linux. If you want
to avoid accidentally using it (and lose data), you can create a
dummy file that fills that space by using the following commands:
mkdir /mnt
mount -t msdos /dev/winswap /mnt
dd if=/dev/zero of=/mnt/dummy.fil
umount /mnt

The dd command will report "No space left on device". This is
exactly what you want.

* Type on the shell prompt:

# dd if=/dev/winswap bs=512 count=XXX gzip -9 > /etc/winswap.gz
^^^
Replace
... where XXX is replaced with the "Total special sectors" number.

Here we are saving the Total Special Sectors in a compressed form
in the file /etc/winswap.gz


3.4. Modify the initalization and shutdown scripts to handle our new
configuration

* Now, we will modify our initalization scripts so that swap space will
be create on the partition each time Linux starts and the DOS/Windows
special sectors will be restored each time Linux shut downs.

* Instead of placing the command for handling the details directly in
the initalization scripts, we will prepare two seperate files called
swapinit.sh and swaphalt.sh. One sample of these files that should
work under Redhat Linux is given in sections 6 and 7. You can choose
to place these files under any directory, preferably /etc/rc.d/init.d.
Create the two files in this directory and copy into then the scripts
given in sections 6 and 7. One simple way is to copy this HOWTO in these
files as,

# cp Swap-Space-HOWTO /etc/rc.d/init.d/swapinit.sh
# cp Swap-Space-HOWTO /etc/rc.d/init.d/swaphalt.sh

and then using your favourite editor, delete all execpt the required
part. Now make these file "executable" by giving the following
commands

# chmod +x swapinit.sh
# chmod +x swaphalt.sh

* Run fdisk and find the size of the swap partition in blocks. In both
the above files (swap????.sh) replace the YYYYY by this number.

* Check the name of the shutdown file. For SysVinit this is the file
listed in the following line of /etc/inittab; add it if you don't
have it.

# Runlevel 0 means shut down the system
l0:0:wait:/etc/brc

(Under Red hat Linux, this file probably will be /etc/rc.d/init.d/halt)
If you are not in a position to find it out, browse through the /etc
directory and find the initialization file that contains the "swapon -a"
command. Only this much for now !
For the remainder of this file, I will assume the filename was
/etc/rc.d/init.d/halt (halt for short).


* Check the name of your system initalization file. For SysVinit, this
is the file listed in the following line of /etc/inittab.

# System initalization
si::sysinit:/etc/rc.d/rc.sysinit

In case of your distribution, your file may be different. I assume
that the file is /etc/rc.d/rc.sysinit (rc.sysinit for short)


* Add the following piece of code to your initalization file
(rc.sysinit), in place of the "swapon -a" command. You may consider
not deleting but just commenting the original commands so that if
something goes wrong, we can restore the script to it's initial state.

If your swapon is in /etc, replace /sbin/swapon with /etc/swapon.
If it is in /bin, replace with /bin/swapon. Do the same for mkswap.

# -----------------------------------------------------------------------
# removed by yourname
# Start up swapping.
# action "Activating swap partitions" swapon -a
# -----------------------------------------------------------------------

# ----------------------------------------------------------------------
# added by yourname
# Verify and initialize swap space
#
/etc/rc.d/init.d/swapinit.sh
# ----------------------------------------------------------------------


* A simple way to paste the text is to start two Virtual Consoles. Log as
a root in both cases. Use your favourite editor to open this HOWTO on
one console and the script to be modified on other console. Now select
the above code with your mouse and switch to the other console. Place
the cursor at the desired position to paste and press the right mouse
button. The selected text will be copied.

* Add the following piece of code to your shutdown file (halt).Put this
after any command that might need swap to be in place. Normally, your
halt file will have the "swapoff -a" command. First replace the -a by
/dev/winswap. Then immediately after that section, add the following
commands.

# ------------------------------------------------------------------------
# Modified by yourname
# replaced "swapoff -a" by "swapoff /dev/winswap"
#
# Turn off swap, then unmount file systems.
runcmd "Turning off swap and accounting" swapoff /dev/winswap
[ -x /sbin/accton ] && /sbin/accton
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
# Added by yourname
# check swap signature and restore Windows swap info
/etc/rc.d/init.d/swaphalt.sh
# ------------------------------------------------------------------------


3.5. Reenable swapping

* Uncomment the line in /etc/fstab that you commented earlier. (Not
really necessary, since we now do not refer to fstab for swap
partitions). Reboot Linux. You should now have swapping on the new
swap device.


_____________________________________________________________________________


4. A couple of notes

* There is no need to add /dev/winswap to your /etc/fstab file. In
fact, it is probably wise not to do so (except possibly as a
comment).

* If your Linux session crashes or otherwise exits without running
/etc/rc.d/init.d/halt, you will need to reboot and exit Linux before
swapping in Windows will work. It is also possible to FORMAT X: and
re-create the Windows swapfile. The only way around this would be to
put the equivalent of the /.../halt commands in the DOS AUTOEXEC.BAT file.
I have tried to write some programs to do this, but at this stage
nothing concrete is ready. One way is to first save the Total Special
sectors in a file say C:\EDRIVE.TSS. This file, in addition to the TSS's
will also contain the Cylinder/Head/Sector (CHS) address of the first
sector on X: (This can be found out on Linux using cfdisk). The restore
program will write all the saved data to consecutive sectors beginning
with this sector. The template AUTOEXEC.BAT file in this case would by

@ECHO OFF
IF EXIST X:\WIN386.SWP GOTO SKIPRSTR
ECHO Swap file not found, proceeding to restore ...
echo y > C:\YES
LOCK X: <> NUL
RESTORE C:\EDRIVE.TSS
UNLOCK X: > NUL
DEL C:\YES

:SKIPRSTR



* One way to restore your Windows swap partition is to start Linux,
disable swapping as described above, and then use the following
command :

# swapoff -a
# zcat /etc/winswap.gz > /dev/winswap
# reboot

* If DOS' FDISK reports the partition as a "logical DOS drive", it has
a number of 5 (as in /dev/hda5) or higher. It is *NOT* the
partition labelled "extended" which has a number of 4 or less!! If
your Linux fdisk does not display logical partitions, you have a
broken Linux fdisk (Slackware 2.2 included a broken fdisk, for
example.) You can try "cfdisk" if your distribution has it, or you
will have to get a working fdisk.

* Please do not mail me unless you have checked and re-checked that
you copied your scripts correctly. More than half of the problems
reported with this Mini-HOWTO have been due to typos when copying
the scripts. (Use cut-and-paste if you can!). Even a spacing error
can cause an error. For example, if at the startup you get the messages

Verifying swap space...Linux signature found
swapon: /dev/winswap invalid argument

Then, surely there has been a typing mistake in your scripts. Please
check your scripts.

* Sometimes, the swap partition is detected to have neither Linux nor
Windows info and the "No signature found" error appears. I exactly
don't know why this happens, but for that case, I have written the
code in swap????.sh files to try six times before reporting an error.
Normally, the DOS signature should be found on the first try, but many
a times on my system it is found on iteration 2, 5 or not at all after
12 iterations. You may consider increasing the number of tries to some
value like 12 or 24, there is no harm in doing so. Once on my system,
the script could not detect the signatures even after 50 iterations !
If such a situation arises, you may consider making a symbolic link
to the swapinit.sh file in your root home directory, and execute it at
startup.

# ln -s /etc/rc.d/init.d/swapinit.sh swapinit.sh
# ./swapinit.sh

* What if the swap partition is a FAT32 ?
No, you can't have a swap partition with a FAT32 file system. First of
all, Linux can use a maximum of 128MB of swap space on a single swap
partition. Thus, if your swap partition is larger than 128MB, you are
wasting your disk space. And Windows will refuse to convert a partition
of 128MB into a FAT32 file system.

* The new style swap space
Linux knows about two styles of swap areas, the old style and the new
style. By default, you will be using the old style swap space with a
signature "SWAP-SPACE". If you want to use the new style swap space,
then first of all change "SWAP-SCAPE" in all the above scripts to
"SWAPSPACE2". Also add an option -v1 in the mkswap command in the
swapinit.sh script, as follows

/sbin/mkswap -v1 /dev/winswap YYYYY

Also, run the following commands from the shell prompt :

# swapoff /dev/winswap
# mkswap -v1 /dev/winswap YYYYY
# swapon /dev/winswap

It seems that under new style swap space, your usable swap partition can
be as large as 2GB on i386 platforms. This means that you can now have a
swap partition larger than 512MB which Windows can format as a FAT32
partition . Someone help on how do we save the "Total Special Sectors"
under a FAT32 partition.

_____________________________________________________________________________


5. What are we exactly doing ?

* Both Windows and Linux use swap space. When an OS is shut down, the
contents of the swap space are just garbage, the OS doesn't bother
about what is in it. Now what is the point in devoting a 60MB partition
for swap space to Linux and about 32MB of disk space separately to
Windows when only one of them is going to run at a time. So we want
Linux and Windows to share the same hard disk space as swap space.

* The problem is that Linux uses a partition as a swap space and Windows
uses a file as a swap space. ( Although it is possible to create a swap
file for Linux, it is not recommended. See "Linux Installation and
Getting Started" by Mett Walsh). Now if Linux uses the same partition
on which Windows stores it's swap file, it will overwrite the boot
sector, FAT and other data tables that Windows assumes to exist on every
drive. Thus, Windows will not be in a position to find the swap file on
startup and will create the win386.swp file in the windows directory.
Thus, even if by chance, your Linux crashes, Windows will be in a
position to start. In such a case ( with Windows swap file in the
Windows directory), just restore the DOS/Windows swap info by
restarting Linux and the start Windows. Now Windows will be using
the swap file on drive X: so you can safely delete the win386.swp
file in the windows directory.

* The remedy is to store those critical data tables once on the Linux
partition in some file. Then every time Linux starts, check whether
the swap space was last used by Linux or Windows (using the label you
gave to your partition). If it was Linux, just enable swapping else
first make a swap partition on the X: drive using "mkswap /dev/winswap"
and then enable swapping.

* When you shut down Linux, it is important to restore the swap partition
to the DOS format, so that Windows can start properly. For that purpose
we add the

/bin/zcat /etc/winswap.gz > /dev/winswap

command to the halt file.

_____________________________________________________________________________


6. The swapinit.sh script

This shell script initalizes the swap space on the partition. The
code for signature setection has been repeated thrice because many a
times the signature is properly detected only on the second or the
third try.

(Adapted from the original Swap-Space-HOWTO by H. Peter Anvin)

#!/bin/sh
#
# /etc/rc.d/init.d/swapinit.sh - activate the swap partition
#
# written by Rahul U. Joshi
# Verify and initialize swap space
#

echo -n 'Verifying swap space... '

loopcount=0

# flag to indicate whether the partition has been activated or not
activated=0

# check for signatures 6 times before giving up
while [ $loopcount -lt 6 ]
do

if [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=10 skip=4086`" = 'SWAP-SPACE' ]; then
echo "Linux signature found, iteration $loopcount"
echo "Activating swap partitions"
swapon /dev/winswap
activated=1
break

elif [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=11 skip=43`" = 'SWAP SPACE ' ]; then
echo "DOS signature found, iteration $loopcount"
echo "Making swap partition"
mkswap /dev/winswap 62464
echo "Activating swap partitions"
swapon /dev/winswap
activated=1
break

else
let loopcount=loopcount+1
fi

done


if [ $activated -ne 1 ] ; then
echo "Swap signature not found after $loopcount tries"
echo "No swapping partitions activated"
exit 1
fi


_____________________________________________________________________________


7. The swaphalt.sh script

This script first checks the Linux swap signature and then restores the
Windows filesystem on it.

(Adapted from the original Swap-Space-HOWTO by H. Peter Anvin)


#!/bin/sh
#
# swaphalt.sh This file is executed through the /etc/rc.d/init.d/halt
# script after swapping and accounting has been turned off.
#
# Author: Rahul U. Joshi
#

# check swap partition signature and restore Windows swap info

loopcount=0

# flag to indicate whether the swap info has been restored or not
restored=0

# check for swap signature 3 times before giving up
while [ $loopcount -lt 3 ]
do

if [ "`/bin/dd 2>/dev/null if=/dev/winswap bs=1 count=10 skip=4086`" = 'SWAP-SPACE' ]; then
echo "Restoring DOS/Windows swap info , iteration $loopcount"
/bin/zcat /etc/winswap.gz > /dev/winswap
restored=1
break
else
loopcount=loopcount+1
fi

done

if [ $restored -ne 1 ] ; then
echo "Swap signature not found after $loopcount tries"
echo "Skipping restoring"
fi


_____________________________________________________________________________


8. The msinfo.sh script

This shell script analyses the boot sector of the given partition and
displays some information along with the "Total Special Sectors" in a
message box. It assumes that the filesystem on the given partition is a
FAT16. If not, it will print an error message and exit. To run it, you
need the "dialog" package installed (Included with RedHat Linux). If
you have not installed it, you may find it at
.

Invoke the program as

# msinfo



#!/bin/sh
#
# msinfo.sh This shell script displays the boot sector of the
# given partition.
#
# Author: Rahul U. Joshi
#
# Modifications Removed the use of expr and replaced it by the let
# command.


# check for command line arguments
if [ $# -ne 1 ]; then
echo "Usage: msinfo "
exit 1
fi

# check whether the input name is a block device
if [ ! -b $1 ]; then
echo "msinfo: $1 is not a block device"
exit 1
fi

# create two temporary files for use
TMPFILE=`mktemp -q /tmp/$0.XXXXXX`
if [ $? -ne 0 ]; then
echo "msinfo: Can't create temp file, exiting..."
exit 1
fi

TXTFILE=`mktemp -q /tmp/$0.XXXXXX`
if [ $? -ne 0 ]; then
echo "msinfo: Can't create temp file, exiting..."
rm -f $TMPFILE
exit 1
fi

back_title="`printf "%78s" "msinfo, Information about FAT16 filesystem -- Rahul Joshi"`"

dialog --title "Boot sector of $1" --backtitle "$back_title" --infobox "\nAnalysing boot sector for $1\nPlease wait ..." 14 60

# truncate TXTFILE to zero length
echo > $TXTFILE

# get Formatting DOS version
dd 2>/dev/null if=$1 bs=1 count=8 skip=3 dd 2>/dev/null of=$TMPFILE
printf >>$TXTFILE "%30s : %s\n" "Formatting DOS version" "`cat $TMPFILE`"


# get file system
dd 2>/dev/null if=$1 bs=1 count=8 skip=54 dd 2>/dev/null of=$TMPFILE
printf >>$TXTFILE "%30s : %s\n" "Filesystem" "`cat $TMPFILE`"

# check if filesystem in a FAT16
if [ "`cat $TMPFILE`" != "FAT16 " ]; then
dialog --title "Boot sector of $1" --backtitle "$back_title" --infobox "\nCan't find a FAT16 filesystem on $1" 14 60
exit 2
fi

# get volume label in boot sector
dd 2>/dev/null if=$1 bs=1 count=11 skip=43 dd 2>/dev/null of=$TMPFILE
printf >>$TXTFILE "%30s : %s\n" "Volume label in boot sector" "`cat $TMPFILE`"


# get Sector size
dd 2>/dev/null if=$1 bs=1 count=2 skip=11 od -An -tdS dd 2>/dev/null of=$TMPFILE
printf >>$TXTFILE "%30s : %d\n" "Sector size" `cat $TMPFILE`
sector_size=`cat $TMPFILE`


# get Reserved sectors
dd 2>/dev/null if=$1 bs=1 count=2 skip=14 od -An -tdS dd 2>/dev/null of=$TMPFILE
printf >>$TXTFILE "%30s : %d\n" " Reserved sectors" `cat $TMPFILE`
reserved_sectors=`cat $TMPFILE`


# get FAT sectors
dd 2>/dev/null if=$1 bs=1 count=1 skip=16 od -An -tdS dd 2>/dev/null of=$TMPFILE
fat_count=`cat $TMPFILE`

dd 2>/dev/null if=$1 bs=1 count=2 skip=22 od -An -tdS dd 2>/dev/null of=$TMPFILE
sectors_per_fat=`cat $TMPFILE`

# calculate the no of sectors allocated for FAT's
let fat_sectors=fat_count*sectors_per_fat

printf >>$TXTFILE "%30s : %u (%u x %u) \n" "FAT sectors" "$fat_sectors" "$fat_count" "$sectors_per_fat"


# get root directory sectors
dd 2>/dev/null if=$1 bs=1 count=2 skip=17 od -An -tdS dd 2>/dev/null of=$TMPFILE
root_sectors=`cat $TMPFILE`

# calculate the no of sectors allocated for root directory
let root_sectors=root_sectors*32/sector_size

printf >>$TXTFILE "%30s : %u\n" "Root directory sectors" "$root_sectors"


# get Total special sectors
let total=reserved_sectors+fat_sectors+root_sectors
printf >>$TXTFILE "%30s : %u\n" "Total special sectors" "$total"


# display the information in a message box
dialog --title "Boot sector of $1" --backtitle "$back_title" --msgbox "`cat $TXTFILE`" 14 60

# delete temporary files
rm -f $TMPFILE
rm -f $TXTFILE

# end of msinfo.sh



_____________________________________________________________________________


9. The original msinfo file

Here is the msinfo file required to find the "Total Special Sectors". It
was included by the original author of this HOWTO in an encoded form. First
copy the text from the line "begin 755 msinfo.gz" to the line "end" into a
temporary file say temp.uu. Then uudecode this file, and finally gunzip to get
msinfo file.

# uudecode temp.uu
# gunzip msinfo.gz

Now run the program using the command

# ./msinfo /dev/winswap

The program displays the boot sector information for given partition as well
as the "Total Special Sectors" for the drive.

10. Acknowledgements


This Mini-HOWTO has been derived from the Swap-Space Mini HOWTO by
H. Peter Anvin. I have added the Windows 95/98 specific details as well
as a few Red hat Linux specific details. The msinfo program given in the
original HOWTO didn't work on my Redhat linux 6 system, so I created a similar
program. However, I have also included the original msinfo program. Thanks to
all those great people involved with the developement of Linux, to the people
at RedHat for giving a great Linux distrbution and to Sanjiv Guha, one of the
co-authors of "Red Hat Linux 6 Unleashed" from Techmedia for guidance about
shell programming. Right now, I have no internet access, so I don't know how
would you contact me in case of questions. May be someone from you local
place may come to your rescue.

Enjoy Linux,

Rahul :-)

Read more ...