You can't do this !
You can not make any folder named any of the following :
CON, PRN, AUX, CLOCK$, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9
And many more...
Reason :
This is because these are windows inbuilt 'Reserved Device Names' .
Just avoid these words and name anything else !
Add folders to-"SEND TO" !
Many a times we require a FOLDER too often, like to store our Multimedia files and all !!!
No no need to access the folder and carry out the traditional COPY & PASTE !!!
Just add it too "SEND TO" !!!
Do as follows :
** Open any FOLDER.
** Then, TOOLS >> Folder Options
** Click view TAB.
** In LIST of Advance Settings, click Show hidden files and folders !
** Now, go to C:\Documents and Settings
** Here, double click and open your (username) folder !
** Now, open SendTo folder.
** Here copy and paste the shortcut of your favorite folder.
That's Done !!!
Now, tranfer files to your favorite folder :
** Right Click the file
** Then, Send To
** Click the folder name !
Tricks for how to hide the files in image files
** You require WinRAR installed on your PC for this trick.
** First add your files to .rar and i.e. say files.rar
** Say you have a image as img.jpg
** Now, save files.rar and img.jpg in c:\ drive.
** Click start >> Run
** Type cmd
** Now in command prompt type cd..
** Again type cd..
** Type copy /b img.jpg + files.rar new.jpg
-------------- Please Note --------------
>> This command will concatenate the two files into the new file new.jpg
>> Don't type files.rar + img.jpg instead of img.jpg + files.rar.
>> Now, (size of new.jpg) = (size of img.jpg) + (size of files.rar) .
-------------------------------------------
*** Mission Accomplished !!! ***
Now, we have new.jpg consisting of both img.jpg and files.rar .
Accessing the files :
** Double click new.jpg and img.jpg can be viewed.
** Now, to access files.rar :
# Right click on new.jpg >> Select Open With >> Choose Program...
# Select WinRAR archiver.
# Now, simply Extract your files !
Lock your folders in windows xp !
Procedure :
1. Make a folder on the desktop and name it as "folder"
2. Now, open notepad and write ren folder folder.{21EC2020-3AEA-1069-A2DD-08002B30309D} and now (Notepad Menu) File>save as.
3. In the 'save as' name it as lock.bat and click save ! (Save it on Desktop)
4. Now, again open notepad again and write ren folder.{21EC2020-3AEA-1069-A2DD-08002B30309D} folder and now (Notepad Menu) File>save as.
5. In the 'save as' name it as key.bat and click save ! (Save it on Desktop)
6. Now, double click lock.bat to lock the folder and now if you open your folder, control panel will open up !
7. Now, double click key.bat to open the folder and now if you open your folder, you can access your data inside the folder again !
8. Lock your folder and hide the key.bat somewhere else on your hard disk !
9. Whenever you want to open your folder just paste the key.bat on desktop and open your folder using it !
Simple !
Make your own icon in windows xp !
Now even personalize your ICONS with Windows XP !
To make your own ICON :
1. Start>>All Programs>>Accessories
2. Click Paint
3. In toolbar select Image
4. Click Attributes
--------------------- Note : The size of a icon is 32 x 32 pixels ! ---------------------
5. Type 32 in both Height and Width and sure that Pixels is selected under Units
6. Click OK
7. Now add your photo or design .
8. File>>Save As
9. Type name.ico
10. Click Save
Enjoy your New ICON !!!
Open active folders in command prompt !
Working through cmd prompt is not easy with long paths and folder names.
This trick provides a solution !!!
What can be done :
** Command prompt can be added to 'Right Click Menu' of each folder.
** Clicking on this will open the folder in cmd prompt.
** Now, the files in that folder can easily be operated.
How to do it :
** Open any folder.
** Tools >> Folder Options...
** Change to File Types
** Select Folder from the list.
** Click Advanced button.
** Now, click New
** Type Command Prompt in Action
** Type cmd.exe in Application used to perform action:
** Now, click OK and Apply
That's All !!!
Now, Right Click any folder and click Command Prompt
And see what happens !!!
Trace Websites !
My Exclusive... another contribution to Computer Tricks !
Surfing Internet...
Type in the url and Hit Enter, that's it ?
But...
Have you ever thought what happens after that ?
Lets Trace n see what happens !
Do the following :
# Start >> Run
# Type cmd
# This will open the Command Prompt
# Type cd\
# Type tracert www.google.com
---------------------- Note ---------------------------
You can replace www.google.com with any website url.
---------------------------------------------------------
Results :
$ First line shows the IP address of the website...
$ You'll be shown steps in which the website gets load !
$ More is the number of steps more is time taken to load the website !
That's all !
Google search tips !
You can make your search more efficient by learning some search basics !
Try these tips :
1. Use Of '+' sign :
This ensures that the results returned to you will definatly consist of the word following the '+' sign. For Eg :
Search: reviews of +iPhone and iPod
This will show results containing the word reviews or iPod but the results will definatly consist of iPhone !
2. Use Of '-' sign :
Using '-' sign before any word will ensure that the particular word will not be included in the results !
3. Use Of '~' sign :
Using '~' before any word will return the results also containing the synonyms of the word !
4. Search a particular site :
To search a particular website you can use the following syntax in the google search :
Search: site:www.xyz.com abc
For Eg :
Search: site:http://pcremix.blogspot.com/ Google Search Tips
5. Define a word :
To get the definition of a word just use :
Search: define:abc
For Eg : Search: define:Computer
This will return you results which define 'Computer'.
6. Find Pages similar to a page :
To find a page similar i.e. consisting of same type of content, use the following syntax :
Search: related:http://www.xyz.com/
7. Search for exact phrase :
To search a set of words exactly together i.e.
For Eg :
Search: "contact us"
This will return the results containing both contact and us together !
8. Using the wild card '*' :
The * sign can be used in places where the whole word is not known.
For Eg:
Search: friend*
This will return the results containing friend , friends , friendship.
9. Using the '?' sign :
This is used when the full spelling of the word is not known.
For Eg:
Search: fri??d
This will result that in the results in which any alphabet can take the place of '?' sign.
10. Use of boolean operators :
The boolean operators like AND,OR,NOT can be used in search box to connect the words !
The search engine understands them as what they mean but the must be in capital letters !
For Eg:
Search: swim OR float
This will return the results containing either swim or float !
Firewall bypass via protocol stegnography
::::::::::::::::::::::::::::::::::::::::
This paper demonstrates flaws in current firewall architecture through the use of protocol stenography.
Overview of Firewall Design
::::::::::::::::::::::::::-
Firewall design is basically split into three main areas:
Port blocking -
A port blocking firewall, does exactly what is says on the tin, it just blocks ports.
e.g. you want to allow traffic to travel from your network to only webservers, you would block all ports outgoing except port 80.
It is a very fast, cheap and very lightwieght on hardware. Unfortunatly it is very easy to bypass.
This type a firewall _should_ not be in use today as it is a trivial case to bind your RAT (Remote Access Trojan) to use port 80 on the way out.
Proxy -
A proxy firewall takes requests from an internal client for the relevant protocol and then passes it out as a request from itself to the internet. Then the reply is passed back to
the originating client. This is inherently secure because the client themselves have no _real_ connection to the outside world.
e.g. you only need a http proxy to only allow web access.
As there is no real connection a trojan has no route back to the attacker.
This is a very clunky solution, there is a need for a seperate proxy for every protocol the firewall needs to allow through, and the lack of transparency to the end user (every
client app need to be configured to use the proxy) bought up the third design.
Stateful Inspection -
Stateful inspection is similar to a port blocking firewall, except that when traffic travels out through port 80, to a web server, it is checked to make sure it is really http stuff. This
is a very effective method for firewalling as it makes the rebinding of a trojan a pointless task as the firewall will drop non (in this example) http traffic.
Bypass
::::::
In order to communicate with a RAT we need to be able to send AND recieve data to AND from the trojan and its control. We need an upstream and a downstream.
To communicate with a RAT through a firewall we need to identify an upstream and a downstream we can hijack to put our data in. I choose http. (It is usally allowed..)
Using http it is possible to bypass both http proxy firewalls and stateful inspection firewalls.
Upstream
::::::::
As a upstream, from the RAT to it's control, I choose http GET request. A typical http get looks like this :
GET /somedir/somefile.html HTTP/1.0
Now to use this a covert data path is fairly easy, the RAT already inside the network, (sent as email, browser bug etc.) only has to append its data to the end of the GET
request and send it to the control (fake) webserver. e.g.
GET /somedir/somefile.html?covertdataleakingaway HTTP/1.0
The fake webserver at the control end will the pickup the sent URL drop everything before the question mark, leaving just our data, successfully sent out and through the
firewall, because it looked like a valid http GET request.
Downstream
::::::::::
For the downstream from the control to the RAT, a fake webserver is required, when sent a GET, after the control decodes the upstream, a webpage complete with images,
is served to our RAT via a standard http 200 OK reply. The data to be sent in the downstream can be anywhere in that 200 OK reply. I use stenography on the images, but
you could place it in the html if you wanted to.
Diagram
::::::-
RAT<::::stenographied images<::::control
RAT::::>http GET request::::::::>webserver
Conclusion
::::::::::
Using protocol stenography it is possible to bypass probably all firewalls. You would need to find out which protocols the firewall allowed and then locate redundant
information in that particular protocol. I use http as an example as it is the most usally allowed on a firewall.
This is a very hard hole to plug as a firewall needs to let through some valid traffic, and by hiding as that valid traffic we circumvent it's security.
Demo client/server coming soon..
linux secrets
Tips
Speeding up your hard drive (#1)
Get faster file transfer by using 32-bit transfers on your hard drive
Just add the line:
hdparm -c3 /dev/hdX
to a bootup script.
If you use SuSE or other distros based on SYS V,
/sbin/init.d/boot.local
should work for you.
This enables 32-bit transfer on your hard drive. On some systems it can improve transfer performance by 75%.
To test your performance gain, type:
hdparm -t -T /dev/hdX
Protecting yourself from being a spam base(#2)
Sendmail allows for someone to telnet to port 25 and do an expn (expand) to see what users and aliases are on your machine. Also, vrfy (verify) means someone can get legal e-mail addresses from your box and send spam through your machine.
Don't want that, so look in your /etc/sendmail.cf file for a line that looks like this:
###############
# Options #
###############
Now cut and paste these next few lines below that:
# turning off the expand option and requiring a helo from
# a remote computer
Opnoexpn,novrfy,needmailhelo
Now there is no expansion, no verify, and sendmail requires a helo with a legitimate DNS in order to use the mailer.
Then look in your /etc/mail/aliases file and ensure you have only your own boxen and/or subnet in there as OK or RELAY. That will help cut down on spammers' ability to find relay machines to do their dirty work for them.
Cleaning up Netscape crashes(#3)
You have a tip about Netscape leaving copies of itself running below, but you can make a general shell script to clean up a Netscape crash like this:
#!/bin/sh
#kill.netscape
killall -9 netscape
rm ~/.netscape/lock
Then all your users can use it and clean up the dreaded hundred instances of Netscape running when it crashed. Change netscape to netscape-communicator or netscape-navigator as appropriate
More DOS-like commands(#4)
Many people are moving to Linux because they miss the stability of good old DOS. In that light, many users are typing DOS commands (which originated from UNIX in the first place) that look fine but cause errors. The command "cd.." in DOS is perfectly valid, but Linux balks. This is because "cd" is a command, and any parameter for that command must be separated from the command by a space. The same goes for "cd/" and "cd~". A quick fix is here.
Use your favorite text editor in your home directory to edit the file ".bashrc". The period is there on purpose, this hides the file from normal ls display.
Add the lines:
alias cd/="cd /"
alias cd~="cd ~"
alias cd..="cd .."
And I usually add these...
alias md="mkdir"
alias rd="rmdir -i"
alias rm="rm -i"
and my first and still favorite alias...
alias ls="ls --color"
alias is a powerful tool, and can be used in the .bashrc script as well as from the command line. You can, if you want to spend the time, create your own group of shell commands to suit how you work. As long as you put them in your .bashrc file, they'll be there everytime you log in. Note that if you frequently log in as root, you might want to copy /home/username/.bashrc to /root/.bashrc to keep yourself sane.
Resurrecting corrupted floppies(#5)
Here's how to make a floppy disk with "track-0 bad" reusable again:
If the track zero of a floppy disk is found to be bad, no DOS or Windows utility is going to do anything about it--you just have to throw it in your unrecycle bin.
This tip cannot recover the data, but can make the disk carry things again, at least for the time being (moments of desperation).
How to:
(A) Format the disk with Linux. Build a Linux file system (don't use mformat). I did this some time before by invoking the makebootdisk command (in Slakware) and stopped after the formatting was over. There should be better ways to do it in RedHat 5.2 or other recent versions.
( Reformat the disk with Windows. Use the DOS window and the /u option while formatting.
Using DOS-like commands(#6)
There's a package called mtools which is included with most of the distributions out there.
There are several commands for basic DOS stuff. For example, to directory the floppy drive, type mdir a:. This is rather handy--you don't need to mount the floppy drive to use it.
Other commands are: mattrib , mcd, mcopy, mdel, mformat, mlabel, mren (rename), mmd, mrd, and mtype.
This doesn't work for reading from hard disks. In that case, you would add entries to /etc/fstab, drive type msdos for fat16 partitions, and vfat for fat32.
Copying files from Linux to Windows 98 or 95B (FAT32)(#7)
It's as easy as installing the program explore2fs. It uses a Windows Explorer interface and supports drag-and-drop. I have found it reliable and useful for migrating files from my RedHat 6.1 partition to my Win95B partition quickly and with a minimum of fuss.
It's available free--as all software should be--from this URL:
CODE
http://uranus.it.swin.edu.au/~jn/linux/explore2fs.htm
Installing in partitions(#8)
I am using SuSE Linux, which has some interesting options (I don't know if RedHat or other distributions offer you this, too).
1. You can install Linux on a single file in your Windows Partition. Nice to try it out, but I guess it is not that fast then. You can load it then with a DOS program, loadlin.
2. Use Fips or Partition Magic. Defragment your hard drive (you should do this for Point 1, too) and split it up. I guess most users just have one partition, which you should split up into at least three: one for the Linux files, and a smaller swap partition (take about 32 to 64 MB, depending on your RAM--less RAM needs bigger swap partitions). If you decide later to deinstall Linux you can always delete both partitions and create one big one for Windows again.
Fips is a stupid command line program, but if you're too lazy to read at least a little bit, then you should stop thinking about Linux anyway...
Command Pipelines(#9)
Pipes are easy. The Unix shells provide mechanisms which you can use them to allow you to generate remarkably sophisticated `programs' out of simple components. We call that a pipeline. A pipeline is composed of a data generator, a series of filters, and a data consumer. Often that final stage is as simple as displaying the final output on stdout, and sometimes the first stage is as simple as reading from stdin. I think all shells use the "|" character to separate each stage of a pipeline. So:
data-generator | filter | ... | filter | data-consumer
Each stage of the pipeline runs in parallel, within the limits which the system permits. Hey, look closely, because that last phrase is important. Are you on a uni-processor system because if you are, then obviously only one process runs at a time, although that point is simply nitpicking. But pipes are buffers capable of holding only finite data. A process can write into a pipe until that pipe is full. When the pipe is full the process writing into it blocks until some of the data already in the pipe has been read. Similarly, a process can read from a pipe until that pipe is empty. When it's empty the reading process is blocked until some more data has been written into the pipe.
What is IP masquerading and when is it of use?(#10)
IP masquerading is a process where one computer acts as an IP gateway for a network. All computers on the network send their IP packets through the gateway, which replaces the source IP address with its own address and then forwards it to the internet. Perhaps the source IP port number is also replaced with another port number, although that is less interesting. All hosts on the internet see the packet as originating from the gateway.
Any host on the Internet which wishes to send a packet back, ie in reply, must necessarily address that packet to the gateway. Remember that the gateway is the only host seen on the internet. The gateway rewrites the destination address, replacing its own address with the IP address of the machine which is being masqueraded, and forwards that packet on to the local network for delivery.
This procedure sounds simple, and it is. It provides an effective means by which you can provide second class internet connections for a complete LAN using only one (internet) IP address.
Setting UTC or local time(#11)
When Linux boots, one of the initialisation scripts will run the /sbin/hwclock program to copy the current hardware clock time to the system clock. hwclock will assume the hardware clock is set to local time unless it is run with the --utc switch. Rather than editing the startup script, under Red Hat Linux you should edit the /etc/sysconfig/clock file and change the ``UTC'' line to either ``UTC=true'' or ``UTC=false'' as appropriate.
Setting the system clock(#12)
To set the system clock under Linux, use the date command. As an example, to set the current time and date to July 31, 11:16pm, type ``date 07312316'' (note that the time is given in 24 hour notation). If you wanted to change the year as well, you could type ``date 073123161998''. To set the seconds as well, type ``date 07312316.30'' or ``date 073123161998.30''. To see what Linux thinks the current local time is, run date with no arguments.
Setting the hardware clock(#13)
To set the hardware clock, my favourite way is to set the system clock first, and then set the hardware clock to the current system clock by typing ``/sbin/hwclock --systohc'' (or ``/sbin/hwclock --systohc --utc'' if you are keeping the hardware clock in UTC). To see what the hardware clock is currently set to, run hwclock with no arguments. If the hardware clock is in UTC and you want to see the local equivalent, type ``/sbin/hwclock --utc''
Setting your timezone(#14)
The timezone under Linux is set by a symbolic link from /etc/localtime[1] to a file in the /usr/share/zoneinfo[2] directory that corresponds with what timezone you are in. For example, since I'm in South Australia, /etc/localtime is a symlink to /usr/share/zoneinfo/Australia/South. To set this link, type:
ln -sf ../usr/share/zoneinfo/your/zone /etc/localtime
Replace your/zone with something like Australia/NSW or Australia/Perth. Have a look in the directories under /usr/share/zoneinfo to see what timezones are available.
[1] This assumes that /usr/share/zoneinfo is linked to /etc/localtime as it is under Red Hat Linux.
[2] On older systems, you'll find that /usr/lib/zoneinfo is used instead of /usr/share/zoneinfo. See also the later section ``The time in some applications is wrong''.
Zombies(#15)
What are these zombie processes that show up in ps? I kill them but they don't go away!
Zombies are dead processes. You cannot kill the dead. All processes eventually die, and when they do they become zombies. They consume almost no resources, which is to be expected because they are dead! The reason for zombies is so the zombie's parent (process) can retrieve the zombie's exit status and resource usage statistics. The parent signals the operating system that it no longer needs the zombie by using one of the wait() system calls.
When a process dies, its child processes all become children of process number 1, which is the init process. Init is ``always'' waiting for children to die, so that they don't remain as zombies.
If you have zombie processes it means those zombies have not been waited for by their parent (look at PPID displayed by ps -l). You have three choices: Fix the parent process (make it wait); kill the parent; or live with it. Remember that living with it is not so hard because zombies take up little more than one extra line in the output of ps.
How do i give users an ftp only account (no telnet, etc).(#16)
give them shell which doesn't work, but is listed in /etc/shells
for example /bin/false...
How to do backup with tar?(#17)
You can mantain a list of files that you with to backup into a file and tar
it when you wish.
tar czvf tarfile.tar.gz -T list_file
where list_file is a simple list of what you want to include into the tar
i.e:
/etc/smb.conf
/root/myfile
/etc/ppp (all files into the /etc/ppp directory)
/opt/gnome/html/gnome-dev-info.html
How to keep a computer from answering to ping?(#18)
a simple "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all" will do the
trick... to turn it back on, simply
"echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all"
Customizing your directory colors.(#19)
I know a lot of you know the command ls --color. Which displays your directory with colors. But, a lot of people may not know that those colors are customizable. All you need to do is add the following line to your /etc/bashrc file.
eval `dircolors /etc/DIR_COLORS`
And then all of the color configuration can be found in the file /etc/DIR_COLORS
Frozen Xwindow(#20)
If your Xwindow freezes sometimes, here are two ways that you may try to kill your server. The first is the simple simple way of killing your X server the key combination: Ctrl+Alt+Backspace
The second way is a little more complicated, but it works most of the time. Hit Ctrl+Alt+F2 to startup a virtual console, then log in with your user name and password and run:
# ps -ax | grep startx
This will give you the PID of your Xserver. Then just kill it with:
# kill -9 PID_Number
To go back to your first console, just hit Alt-F1
Converting all files in a directory to lowercase.(#21)
#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done
Wow. That's a long script. I wouldn't write a script to do that; instead, I would use this command:
for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`;
done;
on the command line.
Script to view those compressed HOWTOs.(#22)
From a newbie to another, here is a short script that eases looking for and viewing howto documents. My howto's are in /usr/doc/faq/howto/ and are gzipped. The file names are XXX-HOWTO.gz, XXX being the subject. I created the following script called "howto" in the /usr/local/sbin directory:
#!/bin/sh
if [ "$1" = "" ]; then
ls /usr/doc/faq/howto | less
else
gunzip -c /usr/doc/faq/howto/$1-HOWTO.gz | less
fi
When called without argument, it displays a directory of the available howto's. Then when entered with the first part of the file name (before the hyphen) as an argument, it unzips (keeping the original intact) then displays the document.
For instance, to view the Serial-HOWTO.gz document, enter:
$ howto Serial
Util to clean up your logfiles.(#23)
If you're like me, you have a list with 430 subscribers, plus 100+ messages per day coming in over UUCP. Well, what's a hacker to do with these huge logs? Install chklogs, that's what. Chklogs is written by Emilio Grimaldo, grimaldo@panama.iaehv.nl, and the current version 1.8 available from ftp.iaehv.nl:/pub/users/grimaldo/chklogs-1.8.tar.gz. It's pretty self explanatory to install(you will, of course, check out the info in the doc subdirectory). Once you've got it installed, add a crontab entry like this:
# Run chklogs at 9:00PM daily.
00 21 * * * /usr/local/sbin/chklogs -m
Handy Script to Clean Up Corefiles.(#24)
Create a file called rmcores(the author calls it handle-cores) with the following in it:
#!/bin/sh
USAGE="$0 "
if [ $# != 2 ] ; then
echo $USAGE
exit
fi
echo Deleting...
find $1 -name core -atime 7 -print -type f -exec rm {} \;
echo e-mailing
for name in `find $1 -name core -exec ls -l {} \; | cut -c16-24`
do
echo $name
cat $2 | mail $name
done
And have a cron job run it every so often.
Moving directories between filesystems.Quick way to move an entire tree of files from one disk to another (#25)
(cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xvfp -)
[ Change from cd /source/directory; tar....etc. to prevent possibility of trashing directory in case of disaster.]
Finding out which directories are the largest.Ever wondered which directories are the biggest on your computer? Here's how to find out.(#26)
du -S | sort -n
How do I stop my system from fscking on each reboot?(#27)
When you rebuild the kernel, the filesystem is marked as 'dirty' and so your disk will be checked with each boot. The fix is to run:
rdev -R /zImage 1
This fixes the kernel so that it is no longer convinced that the filesystem is dirty.
Note: If using lilo, then add read-only to your linux setup in your lilo config file (Usually /etc/lilo.conf)
How to avoid fscks caused by "device busy" at reboot time.(#28)
If you often get device busy errors on shutdown that leave the filesystem in need of an fsck upon reboot, here is a simple fix:
To /etc/rc.d/init.d/halt or /etc/rc.d/rc.0, add the line
mount -o remount,ro /mount.dir
for all your mounted filesystems except /, before the call to umount -a. This means if, for some reason, shutdown fails to kill all processes and umount the disks they will still be clean on reboot. Saves a lot of time at reboot for me.
How to find the biggest files on your hard-drive.(#29)
ls -l | sort +4n
Or, for those of you really scrunched for space this takes awhile but works great:
cd /
ls -lR | sort +4n
A script for cleaning up after programs that create autosave and backup files.(#30)
Here is a simple two-liner which recursively descends a directory hierarchy removing emacs auto-save (#) and backup (~) files, .o files, and TeX .log files. It also compresses .tex files and README files. I call it 'squeeze' on my system.
#!/bin/sh
#SQUEEZE removes unnecessary files and compresses .tex and README files
#By Barry tolnas, tolnas@sun1.engr.utk.edu
#
echo squeezing $PWD
find $PWD \( -name \*~ -or -name \*.o -or -name \*.log -or -name \*\#\) -exec
rm -f {} \;
find $PWD \( -name \*.tex -or -name \*README\* -or -name \*readme\* \) -exec gzip -9 {} \;
How to find out what process is eating the most memory.(#31)
ps -aux | sort +4n
-OR-
ps -aux | sort +5n
How do I find which library in /usr/lib holds a certain function?(#32)
What if you're compiling and you've missed a library that needed linking in? All gcc reports are function names... Here's a simple command that'll find what you're looking for:
for i in *; do echo $i:;nm $i|grep tgetnum 2>/dev/null;done
Where tgetnum is the name of the function you're looking for.
I compiled a small test program in C, but when I run it, I get no output!(#32)
You probably compiled the program into a binary named test, didn't you? Linux has a program called test, which tests if a certain condition is true, it never produces any output on the screen. Instead of just typing test, try: ./test
The Linux Kernel
This is a detailed guide to kernel configuration, compilation,
upgrades, and troubleshooting for ix86-based systems.
______________________________________________________________________
Table of Contents
1. Introduction
2. Quick Steps - Kernel Compile
2.1 Precautionary Preparations
2.2 For the Impatient
2.3 Building Kernel - Explanation of Steps
2.4 Troubleshoot Common Mistakes
2.4.1 The System Hangs at LILO
2.4.2 No init found
2.4.3 Lots of Compile Errors
2.4.4 The 'depmod' gives "Unresolved symbol error messages"
2.4.5 Kernel Does Not Load Module - "Unresolved symbols" Error Messages
2.4.6 Kernel fails to load a module
2.4.7 Loadable modules
2.5 Post Kernel Building
2.6 Sample lilo.conf
3. A word on style
4. Important questions and their answers
4.1 What does the kernel do, anyway?
4.2 Why would I want to upgrade my kernel?
4.3 What kind of hardware do the newer kernels support?
4.4 What version of gcc and libc do I need?
4.5 What's a loadable module?
4.6 How much disk space do I need?
4.7 How long does it take?
5. How to actually configure the kernel
5.1 Getting the source
5.2 Unpacking the source
5.3 Configuring the kernel
5.3.1 Kernel math emulation (Processor type and features)
5.3.2 Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block Devices)
5.3.3 Networking support (General Setup)
5.3.4 System V IPC (General Setup)
5.3.5 Processor family (Processor type and features)
5.3.6 SCSI support
5.3.7 Network device support
5.3.8 Filesystems
5.3.8.1 But I don't know which filesystems I need!
5.3.9 Character devices
5.3.10 Sound
5.3.11 Other configuration options
5.3.12 Kernel hacking
5.4 Now what? (The Makefile)
6. Compiling the kernel
6.1 Cleaning and depending
6.2 Compile time
6.3 Other ``make''ables
6.4 Installing the kernel
7. Patching the kernel
7.1 Applying a patch
7.2 If something goes wrong
7.3 Getting rid of the .orig files
7.4 Other patches
8. Additional packages
8.1 kbd
8.2 util-linux
8.3 hdparm
8.4 gpm
9. Some pitfalls
9.1 make clean
9.2 Huge or slow kernels
9.3 The parallel port doesn't work/my printer doesn't work
9.4 Kernel doesn't compile
9.5 New version of the kernel doesn't seem to boot
9.6 You forgot to run LILO, or system doesn't boot at all
9.7 It says `warning: bdflush not running'
9.8 I can't get my IDE/ATAPI CD-ROM drive to work
9.9 It says weird things about obsolete routing requests
9.10 Firewalling not working in 1.2.0
9.11 ``Not a compressed kernel Image file''
9.12 Problems with console terminal after upgrade to 1.3.x
9.13 Can't seem to compile things after kernel upgrade
9.14 Increasing limits
10. Note for upgrade to version 2.0.x, 2.2.x
11. Modules
11.1 Installing the module utilities
11.2 Modules distributed with the kernel
12. Tips and tricks
12.1 Redirecting output of the make or patch commands
12.2 Conditional kernel install
12.3 Kernel updates
13. Other relevant HOWTOs that might be useful
14. Misc
14.1 Author
14.2 To do
14.3 Contributions
14.4 Copyright notice, License, and all that stuff
15. Other Formats of this Document
15.1 Acrobat PDF format
15.2 Convert Linuxdoc to Docbook format
15.3 Convert to MS WinHelp format
15.4 Reading various formats
______________________________________________________________________
1. Introduction
You compile Linux kernel for one of following reasons:
· You are doing kernel development
· You are adding a new hardware to machine
· You want to customize the kernel and do not want the default kernel
shipped out to you.
· For Defence Industries or Military applications, you must read the
kernel source code and compile with your own hands. No exceptions!!
(U.S Dept of Defence compiles the Linux kernel before distributing
computers).
· Every country and every Govt. compiles the kernel on site for
security. Every Govt. audits each and every line of kernel before
using the computer.
· Each and every University in the world compiles the kernel before
using any computer!
· For your education and knowledge of Linux kernel and ofcourse, just
for fun!
· For very advanced scientific applications - you may need to do
kernel compile
· And for many hundreds of reasons - too numerous to list!
If your time is precious then go straight to chapter 2 "Quick Steps".
And, if you are successful in compiling the Linux kernel then you can
skip the remaining chapters.
2. Quick Steps - Kernel Compile
This section is written by Al Dev (alavoor[AT]yahoo.com) (The latest
version of this document is at
<http://www.milkywaygalaxy.freeservers.com>. You may want to check
there for changes). Mirror sites are at - angelfire
<http://www.angelfire.com/country/aldev0>, geocities
<http://www.geocities.com/alavoor/index.html>. These sites have lots
of linux goodies and tips.
Kernel re-compile is required in order to make the kernel very lean
and which will result in FASTER operating system . It is also required
to support any new devices.
2.1. Precautionary Preparations
Before you build kernel, it is a good idea to do a backup of the
system. If you had not backed up your system recently then you can do
it now. You can use commercial backup tools like BRS Backup-Recovery-
Software <http://24.221.230.253> (also in this page you can find open-
source/freeware backup tools listed under 'Backup and Restore
Utility'). Backup is just a suggestion and it is not mandatory to do
backup before building the Linux kernel.
2.2. For the Impatient
1. Unpack the sources
2. Optional - You can copy the .config file from your old linux kernel
source tree to new kernel tree (may save time, if you want to reuse
the old settings).
3. make clean; make mrproper
4. make xconfig
5. make dep
6. make
7. make bzImage
8. make modules
9. make install
10.
make modules_install
11.
configure LILO or GRUB.
12.
Optional - make clean (If you want to free up disk space)
See details of above steps in next section....
2.3. Building Kernel - Explanation of Steps
Details of the steps mentioned in the previous section:
Note: Below 'bash#' denotes the bash prompt, you should type the
commands that appear after the 'bash#' prompt. Below are commands
tested on Redhat Linux Kernel 2.4.7-10, but it should work for other
distributions with very minor changes. It should also work for older
kernel versions like 2.2, 2.0 and 1.3. It should also work for future
or newer versions of kernel (with little changes - let me know).
· Note: You can have many kernel images on your system. By following
the steps below you do not overwrite or damage your existing
kernel. These steps are very safe and your current kernel will be
intact and will not be touched.
1. Unpack the sources: Login in as 'root' throughout all these steps.
Mount Redhat linux cdrom and install the linux kernel source rpm
___________________________________________________________________
bash$ su - root
bash# cd /mnt/cdrom/RedHat/RPMS
bash# rpm -i kernel-headers*.rpm
bash# rpm -i kernel-source*.rpm
bash# rpm -i dev86*.rpm
bash# rpm -i bin86*.rpm
___________________________________________________________________
(The bin86*.rpm and 'as86' is required only for OLDER Linux systems
like Redhat 5.x. Get Intel assembler 'as86' command from dev86*.rpm
on cdrom or from bin86-mandrake <http://rpmfind.net/linux/RPM/man
drake/7.1/Mandrake/RPMS/bin86-0.4-12mdk.i586.html> , bin86-kondara
<http://rpmfind.net/linux/RPM/kon
dara/jirai/i586/bin86-0.4-8k.i586.html> ).
2. Optional : You can copy the .config file from your old linux
kernel source tree to new kernel tree (may save time, if you want
to reuse the old settings).
___________________________________________________________________
bash# cd /usr/src/linux
bash# cp ../linux-old-tree/.config .
___________________________________________________________________
or alternatively, you can use "make oldconfig" which default all ques
tions based on the contents of your existing ./.config file.
3. Clean : Before doing mrproper below, you may want to backup the
.config file.
___________________________________________________________________
bash# cd /usr/src/linux
bash# make clean
bash# make mrproper # Must do this if want to start clean slate
___________________________________________________________________
4. Configure:
· Start X-windows with 'startx'. If you are not able to start X-
window then see next step below.
___________________________________________________________________
bash# man startx
bash# startx
bash# cd /usr/src/linux
bash# make xconfig
___________________________________________________________________
· If you are not able to start X-window above then try -
___________________________________________________________________
bash# export TERM=xterm
bash# make menuconfig
If you find scrambled display, then use different terminal emulators like vt100,
vt102, vt220 or ansi. The display will be scrambled and will have garbage
characters in cases where you use telnet to login to remote linux. In such
cases you should use the terminal emulators like vt100, vt220.
For example:
bash# export TERM=vt220
bash# export TERM=ansi
At a lower level of VT, use:
bash# export TERM=vt100
bash# make menuconfig
If the menuconfig command fails then try -
bash# make config
___________________________________________________________________
The "make xconfig" or "make menuconfig" brings up a user friendly GUI
interface. And "make config" brings up command-line console mode
interface. You can load the configuration file from
/usr/src/linux/.config (dot config file. Note the dot before config).
Click on button "Load Configuration from File".
Within 'make xconfig' you must do these (to avoid problems) -
· VERY IMPORTANT !!! : Select proper CPU type - Pentium 3, AMD K6,
Cyrix, Pentium 4, Intel 386, DEC Alpha, PowerPC otherwise kernel
compile will fail and even if it compiles will not boot!!
· Select SMP support - whether single CPU or multiple CPUs
· Filesystems - Select Windows95 Vfat, MSDOS, NTFS as part of kernel
and not as loadable modules. (My personal preference but you are
free to pick your own option).
· Enable the Loadable kernel modules support! With this option you
can load/unload the device drivers dynamically on running linux
system on the fly. See these man pages
___________________________________________________________________
bash# rpm -i /mnt/cdrom/Redhat/RPMS/modutils*.rpm
bash# man lsmod
bash# man insmod
bash# man rmmod
bash# man depmod
bash# man modprobe
___________________________________________________________________
Save and Exit "make xconfig". All the options which you selected is
now saved into configuration file at /usr/src/linux/.config (dot
config file).
5. Dep : And now, do -
___________________________________________________________________
bash# make dep
___________________________________________________________________
6. Give Name to Kernel: You can give a name to your kernel, so that
it is unique and does not interfere with others.
___________________________________________________________________
bash# cd /usr/src/linux
bash# vi Makefile
___________________________________________________________________
Here look for EXTRAVERSION = -19.8.0blahblah and change to EXTRAVER
SION = -19.8.0MyKer.26Jan03
7. Do make: Read the following file (to gain some knowledge about
kernel building. Tip: Use the color editor gvim
<http://www.linuxdoc.org/HOWTO/Vim-HOWTO.html> for better
readability.
___________________________________________________________________
bash# gvim -R /usr/src/linux/arch/i386/config.in
bash# man less
bash# less /usr/src/linux/arch/i386/config.in
Type 'h' for help and to navigate press i, j, k, l, h or arrow, page up/down keys.
___________________________________________________________________
Now, give the make command -
______________________________________________________________________
bash# cd /usr/src/linux
bash# man nohup
bash# nohup make bzImage &
bash# man tail
bash# tail -f nohup.out (.... to monitor the progress)
This will put the kernel in /usr/src/linux/arch/i386/boot/bzImage
______________________________________________________________________
8. bzImage: After bzImage is successful, copy the kernel image to
/boot directory. You must copy the new kernel image to /boot
directory, otherwise the new kernel MAY NOT boot.
___________________________________________________________________
bash# cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.myker.26mar2001
___________________________________________________________________
NOTE : For latest kernels (kernel versions 2.4.0 or greater) you may
want to give these commands, so that /boot/initrd*.img is created as
well entries in grub are made automatically:
______________________________________________________________________
bash# make install
______________________________________________________________________
9. Configure LILO or GRUB : There are two options for boot loading
under Redhat Linux -
· LILO
· GRUB
Configure LILO: Read the manual page on lilo (see also
<http://www.linuxdoc.org/HOWTO/LILO-crash-rescue-HOWTO.html>) and
see the ``sample lilo.conf'' file. Always give a date extension to
the filename, because it tells you when you built the kernel, as
shown below:
___________________________________________________________________
bash# man lilo
bash# man lilo.conf
And edit /etc/lilo.conf file and put these lines -
image=/boot/bzImage.myker.26mar2001
label=myker
root=/dev/hda1
read-only
You can check device name for 'root=' with the command -
bash# df /
Now give -
bash# lilo
bash# lilo -q
___________________________________________________________________
You must re-run lilo even if the entry 'myker' exists, everytime you
create a new bzImage.
Configure GRUB: GRUB differs from bootloaders such as LILO in that it
can lie to Windows and make Windows believe that it's installed on the
first partition even if it's not. So you can keep your current Linux
system where it is and install Windows on the side. See
· <http://www.tldp.org/HOWTO/Linux+Win9x+Grub-HOWTO/intro.html>
· GNU GRUB <http://www.gnu.org/software/grub>
· Redhat Manual
<http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-
guide/ch-grub.html>.
· Multiboot-with-GRUB minihowto
<http://www.tldp.org/HOWTO/mini/Multiboot-with-GRUB.html>
· Grub Manual <http://www.mcc.ac.uk/grub/grub_toc.html>
___________________________________________________________________
bash# man grub
bash# man grubby # (command line tool for configuring grub, lilo, and elilo)
bash# man grub-install
___________________________________________________________________
Edit the file /etc/grub.conf to make entries for the new kernel.
10.
Reboot the machine and at lilo press tab key and type 'myker' If it
boots then you did a good job! Otherwise at lilo select your old
kernel, boot and re-try all over again. Your old kernel is still
INTACT and SAFE at say /boot/vmlinuz-2.0.34-0.6
11.
If your new kernel 'myker' boots and works properly, you can create
the boot disk. Insert a blank floppy into floppy drive and -
___________________________________________________________________
bash# cd /usr/src/linux
bash# make bzdisk
See also mkbootdisk -
bash# rpm -i mkbootdisk*.rpm
bash# man mkbootdisk
___________________________________________________________________
12.
LOADABLE MODULES: This step is required ONLY if you had enabled
Loadable module support in step 3 above. Loadable module are
located in /lib/modules. You MUST do this step if you enabled or
disabled any modules, otherwise you will get 'unresolved symbols'
errors during or after kernel boot. Check for insmod command which
is extensively used for loading the modules.
___________________________________________________________________
bash# cd /usr/src/linux
bash# make modules
bash# make modules_install
___________________________________________________________________
This will copy the modules to /lib/modules directory.
For example to load the module /lib/modules/2.4.2-2/ker
nel/drivers/block/loop.o, you would do :
______________________________________________________________________
bash# man insmod
bash# modprobe loop
bash# insmod loop
bash# lsmod
______________________________________________________________________
You can set PATH the insmod searches in /etc/modules.conf
13.
Clean: Optional - make clean (If you want to free up disk space)
14.
Optional - Initrd.img :
To create /boot/initrd.img see the documentation at
/usr/src/linux/Documentation/initrd.txt and Loopback-Root-mini-
HOWTO <http://www.tldp.org/HOWTO/mini/Loopback-Root-
FS-3.html#ss3.3>. You do not need to create as you use the
existing /boot/initrd.img.
2.4. Troubleshoot Common Mistakes
2.4.1. The System Hangs at LILO
Sympton: After you build the kernel and reboot, the system hangs just
before LILO.
Reason: Probably you did not set the BIOS to pick up the proper
Primary Master IDE and Secondary Slave IDE hard disk partition.
Solution: Power on the machine and press DEL key to do setup of the
BIOS (Basic Input Output system). Select the IDE settings and set
proper primary hard disk partition and slave drives. When the system
boots it looks for the primary IDE hard disk and the Master Boot
Record partition. It reads the MBR and starts loading the Linux
Kernel from the hard disk partition.
2.4.2. No init found
The following mistake is commited very frequently by new users.
If your new kernel does not boot and you get -
______________________________________________________________________
Warning: unable to open an initial console
Kernel panic: no init found. Try passing init= option to kernel
______________________________________________________________________
The problem is that you did not set the "root=" parameter properly in
the /etc/lilo.conf. In my case, I used root=/dev/hda1 which is having
the root partition "/". You must properly point the root device in
your lilo.conf, it can be like /dev/hdb2 or /dev/hda7.
The kernel looks for the init command which is located in /sbin/init.
And /sbin directory lives on the root partition. For details see -
______________________________________________________________________
bash# man init
______________________________________________________________________
2.4.3. Lots of Compile Errors
The 'make', 'make bzImage', 'make modules' or 'make modules_install'
gives compile problems. You should give 'make mrproper' before doing
make.
______________________________________________________________________
bash# make mrproper
______________________________________________________________________
If this problem persists, then try menuconfig instead of xconfig.
Sometimes GUI version xconfig causes some problems:
______________________________________________________________________
bash# export TERM=VT100
bash# make menuconfig
______________________________________________________________________
2.4.4. The 'depmod' gives "Unresolved symbol error messages"
When you run depmod it gives "Unresolved symbols". A sample error
message is given here to demonstrate the case:
______________________________________________________________________
bash$ su - root
bash# man depmod
bash# depmod
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/linear.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/multipath.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid0.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid1.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid5.o
______________________________________________________________________
Reason: You did not make modules and install the modules after
building the new kernel with "make bzImage".
Solution: After you build the new kernel, you must do:
______________________________________________________________________
bash$ su - root
bash# cd /usr/src/linux
bash# make modules
bash# make modules_install
______________________________________________________________________
2.4.5. Kernel Does Not Load Module - "Unresolved symbols" Error Mes
sages
When you boot kernel and system tries to load any modules and you get
"Unresolved symbol : __some_function_name" then it means that you did
not clean compile the modules and kernel. It is mandatory that you
should do make clean and make the modules. Do this -
______________________________________________________________________
bash# cd /usr/src/linux
bash# make dep
bash# make clean
bash# nohup make bzImage &
bash# tail -f nohup.out (.... to monitor the progress)
bash# make modules
bash# make modules_install
______________________________________________________________________
2.4.6. Kernel fails to load a module
If the kernel fails to load a module (say loadable module for network
card or other devices), then you may want to try to build the driver
for device right into the kernel. Sometimes loadable module will NOT
work and the driver needs to be built right inside the kernel. For
example - some network cards do not support loadable module feature -
you MUST build the driver of the network card right into linux kernel.
Hence, in 'make xconfig' you MUST not select loadable module for this
device.
2.4.7. Loadable modules
You can install default loadable modules with -
The step given below may not be required but is needed ONLY FOR
EMERGENCIES where your /lib/modules files are damaged. If you already
have the /lib/modules directory and in case you want replace them use
the --force to replace the package and select appropriate cpu
architecture.
For new versions of linux redhat linux 6.0 and later, the kernel
modules are included with kernel-2.2*.rpm. Install the loadable
modules and the kernel with
______________________________________________________________________
This will list the already installed package.
bash# rpm -qa | grep -i kernel
bash# rpm -U --force /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.0.i686.rpm
(or)
bash# rpm -U --force /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.0.i586.rpm
(or)
bash# rpm -U --force /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.0.i386.rpm
______________________________________________________________________
This is only for old versions of redhat linux 5.2 and before. Boot
new kernel and install the loadable modules from RedHat Linux
"contrib" cdrom
______________________________________________________________________
bash# rpm -i /mnt/cdrom/contrib/kernel-modules*.rpm
....(For old linux systems which do not have insmod pre-installed)
______________________________________________________________________
2.5. Post Kernel Building
After successfully building and booting the Linux kernel, you may be
required to do these additional steps to make some of the devices to
work with Linux. (The steps below were tested on Redhat Linux but
should work with other distributions as well.)
Video card/Monitor configuration:
· Please see the video card manual which is usually shipped with the
PC. You should look for a "Technical Specifications" page.
· Please see the monitor's manual and look for a "Technical
Specifications" page.
You can configure the Video card and monitor by using these
commands:
___________________________________________________________________
bash$ su - root
bash# man Xconfigurator
bash# /usr/bin/X11/Xconfigurator --help
bash# /usr/bin/X11/Xconfigurator
bash# /usr/bin/X11/Xconfigurator --expert
See also:
bash# man xf86config
bash# /usr/bin/X11/xf86config
___________________________________________________________________
If your card is not detected automatically, then you can use the
--expert option and select the "Unlisted card". If your monitor is not
listed then select the generic monitor type SVGA 1024x768.
Sound card configuration:
· Connect your external speakers to the sound card's audio port.
· Connect your CDROM audio wire to sound card's audio 4-pin socket.
(Otherwise your cdrom drive will not play the music from your music
cd)
· Refer to HOWTO docs on 'Sound' at <http://www.linuxdoc.org>
___________________________________________________________________
bash$ su - root
bash# man sndconfig
bash# /usr/sbin/sndconfig
___________________________________________________________________
Then start X-window 'KDE desktop' with 'startx' command. Click on 'K
Start->ControlCenter->SoundServer->General->Test Sound'. This should
play the test sound. Then click on 'K Start->MultiMedia->Sound
Mixer->SoundVolumeSlider' and adjust the sound volume.
Network card configuration:
· Use /sbin/linuxconf
· Or use KDE control panel
· Refer to HOWTO docs on 'Networking' at <http://www.linuxdoc.org>
Configure Firewall and IP Masquerading : For Linux kernel version 2.4
and above, the firewall and IP Masquerading is implemented by
NetFilter package. Hence in kernel config you should enable Netfilter
and run the Firewall/IPMasq script. Download the scripts from
Firewall-IPMasq scripts
<http://www.BoingWorld.com/workshops/linux/iptables-tutorial> , main
page of Netfilter is at <http://netfilter.samba.org>. Related
materials at firewalling-matures
<http://www.linuxsecurity.com/feature_stories/kernel-netfilter.html>
and Netfilter-FAQ <http://netfilter.filewatcher.org/netfilter-
faq.html>.
For kernel version below 2.4 you should install the firewall rpms from
rpmfind.net
<http://rpmfind.net/linux/rpm2html/search.php?query=firewall> or
firewall.src.rpm
<http://rpmfind.net/linux/RPM/contrib/noarch//SRPMS//firewall-2.2-3.src.html>.
Configuration of other devices: Refer to HOWTO docs relating to your
devices at <http://www.linuxdoc.org>
2.6. Sample lilo.conf
Read this section only if you are using LILO and if you are using GRUB
skip this section. Given below is a sample /etc/lilo.conf file. You
should follow the naming conventions like ker2217 (for kernel 2.2.17),
ker2214 (for kernel 2.2.14). You can have many kernel images on the
same /boot system. On my machine I have something like:
______________________________________________________________________
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=firewall
image=/boot/vmlinuz-2.2.14-5.0
label=ker2214
read-only
root=/dev/hda9
image=/boot/vmlinuz-2.2.17-14
label=ker2217
read-only
root=/dev/hda9
#image=/usr/src/linux/arch/i386/boot/bzImage
# label=myker
# root=/dev/hda7
# read-only
image=/boot/bzImage.myker.11feb2001
label=myker11feb
root=/dev/hda9
read-only
image=/boot/bzImage.myker.01jan2001
label=myker01jan
root=/dev/hda9
read-only
image=/boot/bzImage.myker-firewall.16mar2001
label=firewall
root=/dev/hda9
read-only
______________________________________________________________________
3. A word on style
All the chapters from this here are written by Brian Ward
<http://www.o--o.net>.
Text that looks like this is either something that appears on your
screen, a filename, or something that can be directly typed in, such
as a command, or options to a command (if you're looking at a plain-
text file, it doesn't look any different). Commands and other input
are frequently quoted (with ` '), which causes the following classic
punctuation problem: if such an item appears at the end of a sentence
in quotes, people often type a `.' along with the command, because the
American quoting style says to put the period inside of the quotation
marks. Even though common sense (and unfortunately, this assumes that
the one with the ``common sense'' is used to the so-called American
style of quotation) should tell one to strip off the punctuation
first, many people simply do not remember, so I will place it outside
the quotation marks in such cases. In other words, when indicating
that you should type ``make config'' I would write `make config', not
`make config.'
4. Important questions and their answers
All the chapters from this here are written by Brian Ward
<http://www.o--o.net>.
4.1. What does the kernel do, anyway?
The Unix kernel acts as a mediator for your programs and your
hardware. First, it does (or arranges for) the memory management for
all of the running programs (processes), and makes sure that they all
get a fair (or unfair, if you please) share of the processor's cycles.
In addition, it provides a nice, fairly portable interface for
programs to talk to your hardware.
There is certainly more to the kernel's operation than this, but these
basic functions are the most important to know.
4.2. Why would I want to upgrade my kernel?
Newer kernels generally offer the ability to talk to more types of
hardware (that is, they have more device drivers), they can have
better process management, they can run faster than the older
versions, they could be more stable than the older versions, and they
fix silly bugs in the older versions. Most people upgrade kernels
because they want the device drivers and the bug fixes.
4.3. What kind of hardware do the newer kernels support?
See the Hardware-HOWTO <http://www.tldp.org/HOWTO/Hardware-HOWTO> .
Alternatively, you can look at the `config.in' file in the linux
source, or just find out when you try `make config'. This shows you
all hardware supported by the standard kernel distribution, but not
everything that linux supports; many common device drivers (such as
the PCMCIA drivers and some tape drivers) are loadable modules
maintained and distributed separately.
4.4. What version of gcc and libc do I need?
Linus recommends a version of gcc in the README file included with the
linux source. If you don't have this version, the documentation in the
recommended version of gcc should tell you if you need to upgrade your
libc. This is not a difficult procedure, but it is important to
follow the instructions.
4.5. What's a loadable module?
These are pieces of kernel code which are not linked (included)
directly in the kernel. One compiles them separately, and can insert
and remove them into the running kernel at almost any time. Due to its
flexibility, this is now the preferred way to code certain kernel
features. Many popular device drivers, such as the PCMCIA drivers and
the QIC-80/40 tape driver, are loadable modules.
4.6. How much disk space do I need?
It depends on your particular system configuration. First, the
compressed linux source is nearly 14 megabytes large at version 2.2.9.
Many sites keep this even after unpacking. Uncompressed and built
with a moderate configuration, it takes up another 67 MB.
4.7. How long does it take?
With newer machines, the compilation takes dramatically less time than
older ones; an AMD K6-2/300 with a fast disk can do a 2.2.x kernel in
about four minutes. As for old Pentiums, 486s, and 386s, if you plan
to compile one, be prepared to wait, possibly hours, days..
If this troubles you, and you happen to have a faster machine around
to compile on, you can build on the fast machines (assuming you give
it the right parameters, that your ulilities are up-to-date, and so
on), and then transfer the kernel image to the slower machine.
5. How to actually configure the kernel
5.1. Getting the source
You can obtain the source via anonymous ftp from ftp.kernel.org in
/pub/linux/kernel/vx.y, where x.y is the version (eg 2.2), and as
mentioned before, the ones that end with an odd number are development
releases and may be unstable. It is typically labelled linux-
x.y.z.tar.gz, where x.y.z is the version number. The sites also
typically carry ones with a suffix of .bz2, which have been compressed
with bzip2 (these files will be smaller and take less time to
transfer).
It's best to use ftp.xx.kernel.org where xx is your country code;
examples being ftp.at.kernel.org for Austria, and ftp.us.kernel.org
for the United States.
5.2. Unpacking the source
Log in as or su to `root', and cd to /usr/src. If you installed
kernel source when you first installed linux (as most do), there will
already be a directory called `linux' there, which contains the entire
old source tree. If you have the disk space and you want to play it
safe, preserve that directory. A good idea is to figure out what
version your system runs now and rename the directory accordingly. The
command `uname -r' prints the current kernel version. Therefore, if
`uname -r' said `1.0.9', you would rename (with `mv') `linux' to
`linux-1.0.9'. If you feel mildly reckless, just wipe out the entire
directory. In any case, make certain there is no `linux' directory in
/usr/src before unpacking the full source code.
Now, in /usr/src, unpack the source with `tar zxpvf linux-
x.y.z.tar.gz' (if you've just got a .tar file with no .gz at the end,
`tar xpvf linux-x.y.z.tar' works.). The contents of the source will
fly by. When finished, there will be a new `linux' directory in
/usr/src. cd to linux and look over the README file. There will be a
section with the label `INSTALLING the kernel'. Carry out the
instructions when appropriate -- symbolic links that should be in
place, removal of stale .o files, etc.
If you have a .bz2 file and the bzip2 program (read about it at
http://www.muraroa.demon.co.uk/), do this:
bz2cat linux-x.y.z.tar.bz2 | tar xvf -
5.3. Configuring the kernel
Note: Some of this is reiteration/clarification of a similar section
in Linus' README file.
The command `make config' while in /usr/src/linux starts a configure
script which asks you many questions. It requires bash, so verify that
bash is /bin/bash, /bin/sh, or $BASH.
However, there are some much more pleasant alternatives to `make
config' and you may very well find them easier and more comfortable to
use. `make menuconfig' is probably the most widely-used. Whatever you
choose, it's best to get familiar with the interface because you may
find yourself back at it sooner than you think. For those ``running
X,'' you can try `make xconfig' if you have Tk installed (`click-o-
rama' - Nat). `make menuconfig' is for those who have (n)curses and
would prefer a text-based menu. These interfaces have a rather clear
advantage: If you goof up and make a wrong choice during
configuration, it is simple to go back and fix it.
The configuration options will appear in hierarchies with `make
menuconfig' and `make xconfig'.
You are ready to answer the questions, usually with `y' (yes) or `n'
(no). Device drivers typically have an `m' option. This means
``module,'' meaning that the system will compile it, but not directly
into the kernel, but as a loadable module. A more comical way to
describe it is as ``maybe.'' Some of the more obvious and non-critical
options are not described here; see the section ``Other configuration
options'' for short descriptions of a few others. With `make
menuconfig', the space bar toggles the selection.
In 2.0.x and later, there is a `?' option, which provides a brief
description of the configuration parameter. That information is likely
to be the most up-to-date. Here are a listing of some of the important
features, which hierarchy they are in, and brief description.
5.3.1. Kernel math emulation (Processor type and features)
If you don't have a math coprocessor (you have a bare 386 or 486SX),
you must say `y' to this. If you do have a coprocessor and you still
say `y', don't worry too much -- the coprocessor is still used and the
emulation ignored. For any halfway modern machine, the answer will be
no, but don't worry if you say yes accidentally; if not needed, it is
not used.
5.3.2. Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block
Devices)
You probably need to support this; it means that the kernel will
support standard PC hard disks, which most people have. This driver
does not include SCSI drives; they come later in the configuration.
You will then be asked about the ``old disk-only'' and ``new IDE''
drivers. You want to choose one of them; the main difference is that
the old driver only supports two disks on a single interface, and the
new one supports a secondary interface and IDE/ATAPI cdrom drives. The
new driver is 4k larger than the old one and is also supposedly
``improved,'' meaning that aside from containing a different number of
bugs, it might improve your disk performance, especially if you have
newer (EIDE-type) hardware.
5.3.3. Networking support (General Setup)
In principle, you would only say `y' if your machine is on a network
such as the internet, or you want to use SLIP, PPP, term, etc to dial
up for internet access. However, as many packages (such as the X
window system) require networking support even if your machine does
not live on a real network, you should say `y'. Later on, you will be
asked if you want to support TCP/IP networking; again, say `y' here if
you are not absolutely sure.
5.3.4. System V IPC (General Setup)
One of the best definitions of IPC (Interprocess Communication) is in
the Perl book's glossary. Not surprisingly, some Perl programmers
employ it to let processes talk to each other, as well as many other
packages (DOOM, most notably), so it is not a good idea to say n
unless you know exactly what you are doing.
5.3.5. Processor family (Processor type and features)
(in older kernels: Use -m486 flag for 486-specific optimizations)
Traditionally, this compiled in certain optimizations for a particular
processor; the kernels ran fine on other chips, but the kernel was
perhaps a bit larger. In newer kernels, however, this is no longer
true, so you should enter the processor for which you are compiling
the kernel. A ``386'' kernel will work on all machines.
5.3.6. SCSI support
If you have SCSI devices, say `y'. You will be prompted for further
information, such as support for CD-ROM, disks, and what kind of SCSI
adapter you have. See the SCSI-HOWTO for greater detail.
5.3.7. Network device support
If you have a network card, or you would like to use SLIP, PPP, or a
parallel port adapter for connecting to the Internet, say `y'. The
config script will prompt for which kind of card you have, and which
protocol to use.
5.3.8. Filesystems
The configure script then asks if you wish to support the following
filesystems:
Standard (minix) - Newer distributions don't create minix filesystems,
and many people don't use it, but it may still be a good idea to
configure this one. Some ``rescue disk'' programs use it, and still
more floppies may have a minix filesystem, since the minix filesystem
is less painful to use on a floppy.
Second extended - This is the standard Linux filesystem. You almost
definitely have one of these, and need to say `y'.
msdos - If you want to use your MS-DOS hard disk partitions, or mount
MS-DOS formatted floppy disks, say `y'.
There are various other foreign operating system filesystem types
available.
/proc - (idea from Bell Labs, I guess). One doesn't make a proc
filesystem on a disk; this is a filesystem interface to the kernel and
processes. Many process listers (such as `ps') use it. Try `cat
/proc/meminfo' or `cat /proc/devices' sometime. Some shells (rc, in
particular) use /proc/self/fd (known as /dev/fd on other systems) for
I/O. You should almost certainly say `y' to this; many important linux
tools depend on it.
NFS - If your machine lives on a network and you want to use
filesystems which reside on other systems with NFS, say `y'.
ISO9660 - Found on most CD-ROMs. If you have a CD-ROM drive and you
wish to use it under Linux, say `y'.
5.3.8.1. But I don't know which filesystems I need!
Ok, type `mount'. The output will look something like this:
blah# mount
/dev/hda1 on / type ext2 (defaults)
/dev/hda3 on /usr type ext2 (defaults)
none on /proc type proc (defaults)
/dev/fd0 on /mnt type msdos (defaults)
Look at each line; the word next to `type' is the filesystem type. In
this example, my / and /usr filesystems are second extended, I'm
using /proc, and there's a floppy disk mounted using the msdos (bleah)
filesystem.
You can try `cat /proc/filesystems' if you have /proc currently
enabled; it will list your current kernel's filesystems.
The configuration of rarely-used, non-critical filesystems can cause
kernel bloat; see the section on modules for a way to avoid this and
the ``Pitfalls'' section on why a bloated kernel is undesirable.
5.3.9. Character devices
Here, you enable the drivers for your printer (parallel printer, that
is), busmouse, PS/2 mouse (many notebooks use the PS/2 mouse protocol
for their built-in trackballs), some tape drives, and other such
``character'' devices. Say `y' when appropriate.
Note: gpm is a program which allows the use of the mouse outside of
the X window system for cut and paste between virtual consoles. It's
fairly nice if you have a serial mouse, because it coexists well with
X, but you need to do special tricks for others.
5.3.10. Sound
If you feel a great desire to hear biff bark, say `y', and you can
tell the configuration program all about your sound board. (A note on
sound card configuration: when it asks you if you want to install the
full version of the driver, you can say `n' and save some kernel
memory by picking only the features which you deem necessary.)
If you are serious about sound card support, have a look at both the
free drivers at http://www.linux.org.uk/OSS/ and the commercial Open
Sound System at http://www.opensound.com/.
5.3.11. Other configuration options
Not all of the configuration options are listed here because they
change too often or fairly self-evident (for instance, 3Com 3C509
support to compile the device drive for this particular ethernet
card). There exists a fairly comprehensive list of all the options
(plus a way to place them into the Configure script) in an effort
started and maintained by Axel Boldt (boldt@math.ucsb.edu) and it's
the online help. It's also available as one big file at the
Documentation/Configure.help in your Linux kernel source tree as of
version 2.0.
5.3.12. Kernel hacking
>From Linus' README:
the ``kernel hacking'' configuration details usually result in a
bigger or slower kernel (or both), and can even make the kernel less
stable by configuring some routines to actively try to break bad code
to find kernel problems (kmalloc()). Thus you should probably answer
`n' to the questions for a ``production'' kernel.
5.4. Now what? (The Makefile)
After you finish configuration, a message tells you that your kernel
has been configured, and to ``check the top-level Makefile for
additional configuration,'' etc.
So, look at the Makefile. You probably will not need to change it, but
it never hurts to look. You can also change its options with the
`rdev' command once the new kernel is in place. If you're feel lost
when you look at the file, then don't worry about it.
6. Compiling the kernel
6.1. Cleaning and depending
When the configure script ends, it also tells you to `make dep' and
(possibly) `clean'. So, do the `make dep'. This insures that all of
the dependencies, such the include files, are in place. It does not
take long, unless your computer is fairly slow to begin with. For
older versions of the kernel, when finished, you should do a `make
clean'. This removes all of the object files and some other things
that an old version leaves behind. In any case, do not forget this
step before attempting to recompile a kernel.
6.2. Compile time
After depending and cleaning, you may now `make bzImage' or `make
bzdisk' (this is the part that takes a long time.). `make bzImage'
will compile the kernel, and leave a file in arch/i386/boot called
`bzImage' (among other things). This is the new compressed kernel.
`make bzdisk' does the same thing, but also places the new bzImage on
a floppy disk which you hopefully put in drive ``A:''. `bzdisk' is
fairly handy for testing new kernels; if it bombs (or just doesn't
work right), just remove the floppy and boot with your old kernel. It
can also be a handy way to boot if you accidentally remove your kernel
(or something equally as dreadful). You can also use it to install new
systems when you just dump the contents of one disk onto the other
(``all this and more! NOW how much would you pay?'').
All even halfway reasonably recent kernels are compressed, hence the
`bz' in front of the names. A compressed kernel automatically
decompresses itself when executed.
In older kernels, you don't have the option to build a bzImage; it was
simply a zImage. That option is at the moment still available,
however, given the code size of newer kernels, it is now more or less
mandatory to build a bzImage because the older methods can't handle a
kernel that's just too large.
6.3. Other ``make''ables
`make mrproper' will do a more extensive `clean'ing. It is sometimes
necessary; you may wish to do it at every patch. `make mrproper' will
also delete your configuration file, so you might want to make a
backup of it (.config) if you see it as valuable.
`make oldconfig' will attempt to configure the kernel from an old
configuration file; it will run through the `make config' process for
you. If you haven't ever compiled a kernel before or don't have an old
config file, then you probably shouldn't do this, as you will most
likely want to change the default configuration.
See the section on modules for a description of `make modules'.
6.4. Installing the kernel
After you have a new kernel that seems to work the way you want it to,
it's time to install it. Most people use LILO (Linux Loader) for this.
`make bzlilo' will install the kernel, run LILO on it, and get you all
ready to boot, BUT ONLY if lilo is configured in the following way on
your system: kernel is /vmlinuz, lilo is in /sbin, and your lilo
config (/etc/lilo.conf) agrees with this.
Otherwise, you need to use LILO directly. It's a fairly easy package
to install and work with, but it has a tendency to confuse people with
the configuration file. Look at the config file (either
/etc/lilo/config for older versions or /etc/lilo.conf for new
versions), and see what the current setup is. The config file looks
like this:
image = /vmlinuz
label = Linux
root = /dev/hda1
...
The `image =' is set to the currently installed kernel. Most people
use /vmlinuz. `label' is used by lilo to determine which kernel or
operating system to boot, and `root' is the / of that particular
operating system. Make a backup copy of your old kernel and copy the
bzImage which you just made into place (you would say `cp bzImage
/vmlinuz' if you use `/vmlinuz'). Then, rerun lilo -- on newer
systems, you can just run `lilo', but on older stuff, you might have
to do an /etc/lilo/install or even an /etc/lilo/lilo -C
/etc/lilo/config.
If you would like to know more about LILO's configuration, or you
don't have LILO, get the newest version from your favorite ftp site
and follow the instructions.
To boot one of your old kernels off the hard disk (another way to save
yourself in case you screw up the new kernel), copy the lines below
(and including) `image = xxx' in the LILO config file to the bottom of
the file, and change the `image = xxx' to `image = yyy', where `yyy'
is the full pathname of the file you saved your backup kernel to.
Then, change the `label = zzz' to `label = linux-backup' and rerun
lilo. You may need to put a line in the config file saying `delay=x',
where x is an amount in tenths of a second, which tells LILO to wait
that much time before booting, so that you can interrupt it (with the
shift key, for example), and type in the label of the backup boot
image (in case unpleasant things happen).
7. Patching the kernel
7.1. Applying a patch
Incremental upgrades of the kernel are distributed as patches. For
example, if you have version 1.1.45, and you notice that there's a
`patch46.gz' out there for it, it means you can upgrade to version
1.1.46 through application of the patch. You might want to make a
backup of the source tree first (`make clean' and then `cd /usr/src;
tar zcvf old-tree.tar.gz linux' will make a compressed tar archive for
you.).
So, continuing with the example above, let's suppose that you have
`patch46.gz' in /usr/src. cd to /usr/src and do a `zcat patch46.gz |
patch -p0' (or `patch -p0 < patch46' if the patch isn't compressed).
You'll see things whizz by (or flutter by, if your system is that
slow) telling you that it is trying to apply hunks, and whether it
succeeds or not. Usually, this action goes by too quickly for you to
read, and you're not too sure whether it worked or not, so you might
want to use the -s flag to patch, which tells patch to only report
error messages (you don't get as much of the ``hey, my computer is
actually doing something for a change!'' feeling, but you may prefer
this..). To look for parts which might not have gone smoothly, cd to
/usr/src/linux and look for files with a .rej extension. Some
versions of patch (older versions which may have been compiled with on
an inferior filesystem) leave the rejects with a # extension. You can
use `find' to look for you;
find . -name '*.rej' -print
prints all files who live in the current directory or any subdirecto
ries with a .rej extension to the standard output.
If everything went right, do a `make clean', `config', and `dep' as
described in sections 3 and 4.
There are quite a few options to the patch command. As mentioned
above, patch -s will suppress all messages except the errors. If you
keep your kernel source in some other place than /usr/src/linux, patch
-p1 (in that directory) will patch things cleanly. Other patch options
are well-documented in the manual page.
7.2. If something goes wrong
(Note: this section refers mostly to quite old kernels)
The most frequent problem that used to arise was when a patch modified
a file called `config.in' and it didn't look quite right, because you
changed the options to suit your machine. This has been taken care of,
but one still might encounter it with an older release. To fix it,
look at the config.in.rej file, and see what remains of the original
patch. The changes will typically be marked with `+' and `-' at the
beginning of the line. Look at the lines surrounding it, and remember
if they were set to `y' or `n'. Now, edit config.in, and change `y' to
`n' and `n' to `y' when appropriate. Do a
patch -p0 < config.in.rej
and if it reports that it succeeded (no fails), then you can continue
on with a configuration and compilation. The config.in.rej file will
remain, but you can get delete it.
If you encounter further problems, you might have installed a patch
out of order. If patch says `previously applied patch detected: Assume
-R?', you are probably trying to apply a patch which is below your
current version number; if you answer `y', it will attempt to degrade
your source, and will most likely fail; thus, you will need to get a
whole new source tree (which might not have been such a bad idea in
the first place).
To back out (unapply) a patch, use `patch -R' on the original patch.
The best thing to do when patches really turn out wrong is to start
over again with a clean, out-of-the-box source tree (for example, from
one of the linux-x.y.z.tar.gz files), and start again.
7.3. Getting rid of the .orig files
After just a few patches, the .orig files will start to pile up. For
example, one 1.1.51 tree I had was once last cleaned out at 1.1.48.
Removing the .orig files saved over a half a meg.
find . -name '*.orig' -exec rm -f {} ';'
will take care of it for you. Versions of patch which use # for
rejects use a tilde instead of .orig.
There are better ways to get rid of the .orig files, which depend on
GNU xargs:
find . -name '*.orig' | xargs rm
or the ``quite secure but a little more verbose'' method:
find . -name '*.orig' -print0 | xargs --null rm --
7.4. Other patches
There are other patches (I'll call them ``nonstandard'') than the ones
Linus distributes. If you apply these, Linus' patches may not work
correctly and you'll have to either back them out, fix the source or
the patch, install a new source tree, or a combination of the above.
This can become very frustrating, so if you do not want to modify the
source (with the possibility of a very bad outcome), back out the
nonstandard patches before applying Linus', or just install a new
tree. Then, you can see if the nonstandard patches still work. If they
don't, you are either stuck with an old kernel, playing with the patch
or source to get it to work, or waiting (possibly begging) for a new
version of the patch to come out.
How common are the patches not in the standard distribution? You will
probably hear of them. I used to use the noblink patch for my virtual
consoles because I hate blinking cursors (This patch is (or at least
was) frequently updated for new kernel releases.). With most newer
device drivers being developed as loadable modules, though, the
frequecy of ``nonstandard'' patches is decreasing significantly.
8. Additional packages
Your linux kernel has many features which are not explained in the
kernel source itself; these features are typically utilized through
external packages. Some of the most common are listed here.
8.1. kbd
The linux console probably has more features than it deserves. Among
these are the ability to switch fonts, remap your keyboard, switch
video modes (in newer kernels), etc. The kbd package has programs
which allow the user to do all of this, plus many fonts and keyboard
maps for almost any keyboard, and is available from the same sites
that carry the kernel source.
8.2. util-linux
Rik Faith (faith@cs.unc.edu) put together a large collection of linux
utilities which are, by odd coincidence, called util-linux. These are
now maintained by Andries Brouwer (util-linux@math.uio.no). Available
via anonymous ftp from sunsite.unc.edu in /pub/Linux/system/misc, it
contains programs such as setterm, rdev, and ctrlaltdel, which are
relevant to the kernel. As Rik says, do not install without thinking;
you do not need to install everything in the package, and it could
very well cause serious problems if you do.
8.3. hdparm
As with many packages, this was once a kernel patch and support
programs. The patches made it into the official kernel, and the
programs to optimize and play with your hard disk are distributed
separately.
8.4. gpm
gpm stands for general purpose mouse. This program allows you to cut
and paste text between virtual consoles and do other things with a
large variety of mouse types.
9. Some pitfalls
9.1. make clean
If your new kernel does really weird things after a routine kernel
upgrade, chances are you forgot to make clean before compiling the new
kernel. Symptoms can be anything from your system outright crashing,
strange I/O problems, to crummy performance. Make sure you do a make
dep, too.
9.2. Huge or slow kernels
If your kernel is sucking up a lot of memory, is too large, and/or
just takes forever to compile even when you've got your new
Quadbazillium-III/4400 working on it, you've probably got lots of
unneeded stuff (device drivers, filesystems, etc) configured. If you
don't use it, don't configure it, because it does take up memory. The
most obvious symptom of kernel bloat is extreme swapping in and out of
memory to disk; if your disk is making a lot of noise and it's not one
of those old Fujitsu Eagles that sound like like a jet landing when
turned off, look over your kernel configuration.
You can find out how much memory the kernel is using by taking the
total amount of memory in your machine and subtracting from it the
amount of ``total mem'' in /proc/meminfo or the output of the command
`free'.
9.3. The parallel port doesn't work/my printer doesn't work
Configuration options for PCs are: First, under the category `General
Setup', select `Parallel port support' and `PC-style hardware'. Then
under `Character devices', select `Parallel printer support'.
Then there are the names. Linux 2.2 names the printer devices
differently than previous releases. The upshot of this is that if you
had an lp1 under your old kernel, it's probably an lp0 under your new
one. Use `dmesg' or look through the logs in /var/log to find out.
9.4. Kernel doesn't compile
If it does not compile, then it is likely that a patch failed, or your
source is somehow corrupt. Your version of gcc also might not be
correct, or could also be corrupt (for example, the include files
might be in error). Make sure that the symbolic links which Linus
describes in the README are set up correctly. In general, if a
standard kernel does not compile, something is seriously wrong with
the system, and reinstallation of certain tools is probably necessary.
In some cases, gcc can crash due to hardware problems. The error
message will be something like ``xxx exited with signal 15'' and it
will generally look very mysterious. I probably would not mention
this, except that it happened to me once - I had some bad cache
memory, and the compiler would occasionally barf at random. Try
reinstalling gcc first if you experience problems. You should only get
suspicious if your kernel compiles fine with external cache turned
off, a reduced amount of RAM, etc.
It tends to disturb people when it's suggested that their hardware has
problems. Well, I'm not making this up. There is an FAQ for it -- it's
at http://www.bitwizard.nl/sig11/.
9.5. New version of the kernel doesn't seem to boot
You did not run LILO, or it is not configured correctly. One thing
that ``got'' me once was a problem in the config file; it said `boot =
/dev/hda1' instead of `boot = /dev/hda' (This can be really annoying
at first, but once you have a working config file, you shouldn't need
to change it.).
9.6. You forgot to run LILO, or system doesn't boot at all
Ooops! The best thing you can do here is to boot off of a floppy disk
or CDROM and prepare another bootable floppy (such as `make zdisk'
would do). You need to know where your root (/) filesystem is and
what type it is (e.g. second extended, minix). In the example below,
you also need to know what filesystem your /usr/src/linux source tree
is on, its type, and where it is normally mounted.
In the following example, / is /dev/hda1, and the filesystem which
holds /usr/src/linux is /dev/hda3, normally mounted at /usr. Both are
second extended filesystems. The working kernel image in
/usr/src/linux/arch/i386/boot is called bzImage.
The idea is that if there is a functioning bzImage, it is possible to
use that for the new floppy. Another alternative, which may or may not
work better (it depends on the particular method in which you messed
up your system) is discussed after the example.
First, boot from a boot/root disk combo or rescue disk, and mount the
filesystem which contains the working kernel image:
mkdir /mnt
mount -t ext2 /dev/hda3 /mnt
If mkdir tells you that the directory already exists, just ignore it.
Now, cd to the place where the working kernel image was. Note that
/mnt + /usr/src/linux/arch/i386/boot - /usr = /mnt/src/linux/arch/i386/boot
Place a formatted disk in drive ``A:'' (not your boot or root disk!),
dump the image to the disk, and configure it for your root filesystem:
cd /mnt/src/linux/arch/i386/boot
dd if=bzImage of=/dev/fd0
rdev /dev/fd0 /dev/hda1
cd to / and unmount the normal /usr filesystem:
cd /
umount /mnt
You should now be able to reboot your system as normal from this
floppy. Don't forget to run lilo (or whatever it was that you did
wrong) after the reboot!
As mentioned above, there is another common alternative. If you
happened to have a working kernel image in / (/vmlinuz for example),
you can use that for a boot disk. Supposing all of the above
conditions, and that my kernel image is /vmlinuz, just make these
alterations to the example above: change /dev/hda3 to /dev/hda1 (the /
filesystem), /mnt/src/linux to /mnt, and if=bzImage to if=vmlinuz. The
note explaining how to derive /mnt/src/linux may be ignored.
Using LILO with big drives (more than 1024 cylinders) can cause
problems. See the LILO mini-HOWTO or documentation for help on that.
9.7. It says `warning: bdflush not running'
This can be a severe problem. Starting with a kernel release after 1.0
(around 20 Apr 1994), a program called `update' which periodically
flushes out the filesystem buffers, was upgraded/replaced. Get the
sources to `bdflush' (you should find it where you got your kernel
source), and install it (you probably want to run your system under
the old kernel while doing this). It installs itself as `update' and
after a reboot, the new kernel should no longer complain.
9.8. I can't get my IDE/ATAPI CD-ROM drive to work
Strangely enough, lots of people cannot get their ATAPI drives
working, probably because there are a number of things that can go
wrong.
If your CD-ROM drive is the only device on a particular IDE interface,
it must be jumpered as ``master'' or ``single.'' Supposedly, this is
the most common error.
Creative Labs (for one) has put IDE interfaces on their sound cards
now. However, this leads to the interesting problem that while some
people only have one interface to being with, many have two IDE
interfaces built-in to their motherboards (at IRQ15, usually), so a
common practice is to make the soundblaster interface a third IDE port
(IRQ11, or so I'm told).
This causes problems with linux in that versions 1.2.x don't support a
third IDE interface (there is support in starting somewhere in the
1.3.x series but that's development, remember, and it doesn't auto-
probe). To get around this, you have a few choices.
If you have a second IDE port already, chances are that you are not
using it or it doesn't already have two devices on it. Take the ATAPI
drive off the sound card and put it on the second interface. You can
then disable the sound card's interface, which saves an IRQ anyway.
If you don't have a second interface, jumper the sound card's
interface (not the sound card's sound part) as IRQ15, the second
interface. It should work.
9.9. It says weird things about obsolete routing requests
Get new versions of the route program and any other programs which do
route manipulation. /usr/include/linux/route.h (which is actually a
file in /usr/src/linux) has changed.
9.10. Firewalling not working in 1.2.0
Upgrade to at least version 1.2.1.
9.11. ``Not a compressed kernel Image file''
Don't use the vmlinux file created in /usr/src/linux as your boot
image; [..]/arch/i386/boot/bzImage is the right one.
9.12. Problems with console terminal after upgrade to 1.3.x
Change the word dumb to linux in the console termcap entry in
/etc/termcap. You may also have to make a terminfo entry.
9.13. Can't seem to compile things after kernel upgrade
The linux kernel source includes a number of include files (the things
that end with .h) which are referenced by the standard ones in
/usr/include. They are typically referenced like this (where xyzzy.h
would be something in /usr/include/linux):
#include <linux/xyzzy.h>
Normally, there is a link called linux in /usr/include to the
include/linux directory of your kernel source
(/usr/src/linux/include/linux in the typical system). If this link is
not there, or points to the wrong place, most things will not compile
at all. If you decided that the kernel source was taking too much room
on the disk and deleted it, this will obviously be a problem. Another
way it might go wrong is with file permissions; if your root has a
umask which doesn't allow other users to see its files by default, and
you extracted the kernel source without the p (preserve filemodes)
option, those users also won't be able to use the C compiler. Although
you could use the chmod command to fix this, it is probably easier to
re-extract the include files. You can do this the same way you did the
whole source at the beginning, only with an additional argument:
blah# tar zxvpf linux.x.y.z.tar.gz linux/include
Note: ``make config'' will recreate the /usr/src/linux link if it
isn't there.
9.14. Increasing limits
The following few example commands may be helpful to those wondering
how to increase certain soft limits imposed by the kernel:
echo 4096 > /proc/sys/kernel/file-max
echo 12288 > /proc/sys/kernel/inode-max
echo 300 400 500 > /proc/sys/vm/freepages
10. Note for upgrade to version 2.0.x, 2.2.x
Kernel versions 2.0.x and 2.2.x introduced quite a bit of changes for
kernel installation. The file Documentation/Changes in the 2.0.x
source tree contains information that you should know when upgrading
to either of these versions. You will most likely need to upgrade
several key packages, such as gcc, libc, and SysVInit, and perhaps
alter some system files, so expect this. Don't panic, though.
11. Modules
Loadable kernel modules can save memory and ease configuration. The
scope of modules has grown to include filesystems, ethernet card
drivers, tape drivers, printer drivers, and more.
11.1. Installing the module utilities
The module utilities are available from wherever you got your kernel
source as modutils-x.y.z.tar.gz; choose the highest patchlevel x.y.z
that is equal to or below that of your current kernel. Unpack it with
`tar zxvf modutils-x.y.z.tar.gz', cd to the directory it creates
(modutils-x.y.z), look over the README, and carry out its installation
instructions (which is usually something simple, such as make
install). You should now have the programs insmod, rmmod, ksyms,
lsmod, genksyms, modprobe, and depmod in /sbin. If you wish, test out
the utilities with the ``hw'' example driver in insmod; look over the
INSTALL file in that subdirectory for details.
insmod inserts a module into the running kernel. Modules usually have
a .o extension; the example driver mentioned above is called
drv_hello.o, so to insert this, one would say `insmod drv_hello.o'. To
see the modules that the kernel is currently using, use lsmod. The
output looks like this:
blah# lsmod
Module: #pages: Used by:
drv_hello 1
`drv_hello' is the name of the module, it uses one page (4k) of mem
ory, and no other kernel modules depend on it at the moment. To remove
this module, use `rmmod drv_hello'. Note that rmmod wants a module
name, not a filename; you get this from lsmod's listing. The other
module utilities' purposes are documented in their manual pages.
11.2. Modules distributed with the kernel
As of version 2.0.30, most of everything is available as a loadable
modules. To use them, first make sure that you don't configure them
into the regular kernel; that is, don't say y to it during `make
config'. Compile a new kernel and reboot with it. Then, cd to
/usr/src/linux again, and do a `make modules'. This compiles all of
the modules which you did not specify in the kernel configuration, and
places links to them in /usr/src/linux/modules. You can use them
straight from that directory or execute `make modules_install', which
installs them in /lib/modules/x.y.z, where x.y.z is the kernel
release.
This can be especially handy with filesystems. You may not use the
minix or msdos filesystems frequently. For example, if I encountered
an msdos (shudder) floppy, I would insmod
/usr/src/linux/modules/msdos.o, and then rmmod msdos when finished.
This procedure saves about 50k of RAM in the kernel during normal
operation. A small note is in order for the minix filesystem: you
should always configure it directly into the kernel for use in
``rescue'' disks.
12. Tips and tricks
12.1. Redirecting output of the make or patch commands
If you would like logs of what those `make' or `patch' commands did,
you can redirect output to a file. First, find out what shell you're
running: `grep root /etc/passwd' and look for something like
`/bin/csh'.
If you use sh or bash,
(command) 2>&1 | tee (output file)
will place a copy of (command)'s output in the file `(output file)'.
For csh or tcsh, use
(command) |& tee (output file)
For rc (Note: you probably do not use rc) it's
(command) >[2=1] | tee (output file)
12.2. Conditional kernel install
Other than using floppy disks, there are several methods of testing
out a new kernel without touching the old one. Unlike many other Unix
flavors, LILO has the ability to boot a kernel from anywhere on the
disk (if you have a large (500 MB or above) disk, please read over the
LILO documentation on how this may cause problems). So, if you add
something similar to
image = /usr/src/linux/arch/i386/boot/bzImage
label = new_kernel
to the end of your LILO configuration file, you can choose to run a
newly compiled kernel without touching your old /vmlinuz (after run
ning lilo, of course). The easiest way to tell LILO to boot a new ker
nel is to press the shift key at bootup time (when it says LILO on the
screen, and nothing else), which gives you a prompt. At this point,
you can enter `new_kernel' to boot the new kernel.
If you wish to keep several different kernel source trees on your
system at the same time (this can take up a lot of disk space; be
careful), the most common way is to name them /usr/src/linux-x.y.z,
where x.y.z is the kernel version. You can then ``select'' a source
tree with a symbolic link; for example, `ln -sf linux-1.2.2
/usr/src/linux' would make the 1.2.2 tree current. Before creating a
symbolic link like this, make certain that the last argument to ln is
not a real directory (old symbolic links are fine); the result will
not be what you expect.
12.3. Kernel updates
Russell Nelson (nelson@crynwr.com) summarizes the changes in new
kernel releases. These are short, and you might like to look at them
before an upgrade. They are available with anonymous ftp from
ftp.emlist.com in pub/kchanges or through the URL
http://www.crynwr.com/kchanges
13. Other relevant HOWTOs that might be useful
· Sound-HOWTO: sound cards and utilities
· SCSI-HOWTO: all about SCSI controllers and devices
· NET-2-HOWTO: networking
· PPP-HOWTO: PPP networking in particular
· PCMCIA-HOWTO: about the drivers for your notebook
· ELF-HOWTO: ELF: what it is, converting..
· Hardware-HOWTO: overview of supported hardware
· Module mini-HOWTO: more on kernel modules
· Kerneld mini-HOWTO: about kerneld
· BogoMips mini-HOWTO: in case you were wondering
14. Misc
14.1. Author
The author and maintainer of the Linux Kernel-HOWTO is Brian Ward
Brian Ward <http://www.o--o.net> . Please send me any comments,
additions, corrections (Corrections are, in particular, the most
important to me.).
You can take a look at my `home page' at one of these URLs:
http://www.math.psu.edu/bri/
http://blah.math.tu-graz.ac.at/~bri/
Even though I try to be attentive as possible with mail, please
remember that I get a lot of it every day, so it may take a little
time to get back to you. Especially when emailing me with a question,
please try extra hard to be clear and detailed in your message. If
you're writing about non-working hardware (or something like that), I
need to know what your hardware configureation is. If you report an
error, don't just say ``I tried this but it gave an error;'' I need to
know what the error was. I would also like to know what versions of
the kernel, gcc, and libc you're using. If you just tell me you're
using this-or-that distribution, it won't tell me much at all. I don't
care if you ask simple questions; remember, if you don't ask, you may
never get an answer! I'd like to thank everyone who has given me
feedback.
If your question does not relate to the kernel, or is in some language
that I don't understand, I may not answer.
If you mailed me and did not get an answer within a resonable amount
of time (three weeks or more), then chances are that I accidentally
deleted your message or something (sorry). Please try again.
I get a lot of mail about thing which are actually hardware problems
or issues. That's OK, but please try to keep in mind that I'm not
familiar with all of the hardware in the world. I use AMD processors,
Adaptec and Sybios SCSI controllers, and IBM SCSI disks.
Version -0.1 was written on October 3, 1994. This document is
available in SGML, PostScript, TeX, roff, and plain-text formats.
14.2. To do
The ``Tips and tricks'' section is a little small. I hope to expand on
it with suggestions from others.
So is ``Additional packages.''
More debugging/crash recovery info needed.
14.3. Contributions
A small part of Linus' README (kernel hacking options) is inclusive.
(Thanks, Linus!)
uc@brian.lunetix.de (Ulrich Callmeier): patch -s and xargs.
quinlan@yggdrasil.com (Daniel Quinlan): corrections and additions in
many sections.
nat@nat@nataa.fr.eu.org (Nat Makarevitch): mrproper, tar -p, many
other things
boldt@math.ucsb.edu (Axel Boldt): collected descriptions of kernel
configuration options on the net; then provided me with the list
lembark@wrkhors.psyber.com (Steve Lembark): multiple boot suggestion
kbriggs@earwax.pd.uwa.edu.au (Keith Briggs): some corrections and
suggestions
rmcguire@freenet.columbus.oh.us (Ryan McGuire): makeables additions
dumas@excalibur.ibp.fr (Eric Dumas): French translation
simazaki@ab11.yamanashi.ac.jp (Yasutada Shimazaki): Japanese
translation
jjamor@lml.ls.fi.upm.es (Juan Jose Amor Iglesias): Spanish translation
mva@sbbs.se (Martin Wahlen): Swedish translation
jzp1218@stud.u-szeged.hu (Zoltan Vamosi): Hungarian translation
bart@mat.uni.torun.pl (Bartosz Maruszewski): Polish translation
donahue@tiber.nist.gov (Michael J Donahue): typos, winner of the
``sliced bread competition''
rms@gnu.ai.mit.edu (Richard Stallman): ``free'' documentation
concept/distribution notice
dak@Pool.Informatik.RWTH-Aachen.DE (David Kastrup): NFS thing
esr@snark.thyrsus.com (Eric Raymond): various tidbits
The people who have sent me mail with questions and problems have also
been quite helpful.
14.4. Copyright notice, License, and all that stuff
Copyright © Brian Ward, 1994-1999.
Permission is granted to make and distribute copies of this manual
provided the copyright notice and this permission notice are preserved
on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
derived work is distributed under the terms of a permission notice
identical to this one. Translations fall under the catagory of
``modified versions.''
Warranty: None.
Recommendations: Commercial redistribution is allowed and encouraged;
however, it is strongly recommended that the redistributor contact the
author before the redistribution, in the interest of keeping things
up-to-date (you could send me a copy of the thing you're making while
you're at it). Translators are also advised to contact the author
before translating. The printed version looks nicer. Recycle.
15. Other Formats of this Document
This section is written by Al Dev (at site
<http://www.milkywaygalaxy.freeservers.com> mirrors at angelfire
<http://www.angelfire.com/country/aldev0>, geocities
<http://www.geocities.com/alavoor/index.html>, virtualave
<http://aldev0.virtualave.net>, Fortunecity
<http://members.fortunecity.com/aldev>, Freewebsites
<http://aldev.freewebsites.com>, Tripod
<http://members.tripod.lycos.com/aldev>, 101xs
<http://www.101xs.com/101xs/aldev>, 50megs <http://aldev0.50megs.com>
)
This document is published in 14 different formats namely - DVI,
Postscript, Latex, Adobe Acrobat PDF, LyX, GNU-info, HTML, RTF(Rich
Text Format), Plain-text, Unix man pages, single HTML file, SGML
(Linuxdoc format), SGML (Docbook format), MS WinHelp format.
This howto document is located at -
· <http://www.linuxdoc.org> and click on HOWTOs and search for howto
document name using CTRL+f or ALT+f within the web-browser.
You can also find this document at the following mirrors sites -
· <http://www.caldera.com/LDP/HOWTO>
· <http://www.linux.ucla.edu/LDP>
· <http://www.cc.gatech.edu/linux/LDP>
· <http://www.redhat.com/mirrors/LDP>
· Other mirror sites near you (network-address-wise) can be found at
<http://www.linuxdoc.org/mirrors.html> select a site and go to
directory /LDP/HOWTO/xxxxx-HOWTO.html
· You can get this HOWTO document as a single file tar ball in HTML,
DVI, Postscript or SGML formats from -
<ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO/other-formats/> and
<http://www.linuxdoc.org/docs.html#howto>
· Plain text format is in:
<ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO> and
<http://www.linuxdoc.org/docs.html#howto>
· Single HTML file format is in:
<http://www.linuxdoc.org/docs.html#howto>
Single HTML file can be created with command (see man sgml2html) -
sgml2html -split 0 xxxxhowto.sgml
· Translations to other languages like French, German, Spanish,
Chinese, Japanese are in
<ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO> and
<http://www.linuxdoc.org/docs.html#howto> Any help from you to
translate to other languages is welcome.
The document is written using a tool called "SGML-Tools" which can
be got from - <http://www.sgmltools.org> Compiling the source you
will get the following commands like
· sgml2html xxxxhowto.sgml (to generate html file)
· sgml2html -split 0 xxxxhowto.sgml (to generate a single page html
file)
· sgml2rtf xxxxhowto.sgml (to generate RTF file)
· sgml2latex xxxxhowto.sgml (to generate latex file)
15.1. Acrobat PDF format
PDF file can be generated from postscript file using either acrobat
distill or Ghostscript. And postscript file is generated from DVI
which in turn is generated from LaTex file. You can download distill
software from <http://www.adobe.com>. Given below is a sample
session:
______________________________________________________________________
bash$ man sgml2latex
bash$ sgml2latex filename.sgml
bash$ man dvips
bash$ dvips -o filename.ps filename.dvi
bash$ distill filename.ps
bash$ man ghostscript
bash$ man ps2pdf
bash$ ps2pdf input.ps output.pdf
bash$ acroread output.pdf &
______________________________________________________________________
Or you can use Ghostscript command ps2pdf. ps2pdf is a work-alike for
nearly all the functionality of Adobe's Acrobat Distiller product: it
converts PostScript files to Portable Document Format (PDF) files.
ps2pdf is implemented as a very small command script (batch file) that
invokes Ghostscript, selecting a special "output device" called
pdfwrite. In order to use ps2pdf, the pdfwrite device must be included
in the makefile when Ghostscript was compiled; see the documentation
on building Ghostscript for details.
15.2. Convert Linuxdoc to Docbook format
This document is written in linuxdoc SGML format. The Docbook SGML
format supercedes the linuxdoc format and has lot more features than
linuxdoc. The linuxdoc is very simple and is easy to use. To convert
linuxdoc SGML file to Docbook SGML use the program ld2db.sh and some
perl scripts. The ld2db output is not 100% clean and you need to use
the clean_ld2db.pl perl script. You may need to manually correct few
lines in the document.
· Download ld2db program from
<http://www.dcs.gla.ac.uk/~rrt/docbook.html> or from Milkyway
Galaxy site <http://www.milkywaygalaxy.freeservers.com>
· Download the cleanup_ld2db.pl perl script from from Milkyway Galaxy
site <http://www.milkywaygalaxy.freeservers.com>
The ld2db.sh is not 100% clean, you will get lots of errors when
you run
___________________________________________________________________
bash$ ld2db.sh file-linuxdoc.sgml db.sgml
bash$ cleanup.pl db.sgml > db_clean.sgml
bash$ gvim db_clean.sgml
bash$ docbook2html db.sgml
___________________________________________________________________
And you may have to manually edit some of the minor errors after run
ning the perl script. For e.g. you may need to put closing tag <
/Para> for each < Listitem>
15.3. Convert to MS WinHelp format
You can convert the SGML howto document to Microsoft Windows Help
file, first convert the sgml to html using:
______________________________________________________________________
bash$ sgml2html xxxxhowto.sgml (to generate html file)
bash$ sgml2html -split 0 xxxxhowto.sgml (to generate a single page html file)
______________________________________________________________________
Then use the tool HtmlToHlp <http://javadocs.planetmirror.com/html
tohlpe.html>. You can also use sgml2rtf and then use the RTF files
for generating winhelp files.
15.4. Reading various formats
In order to view the document in dvi format, use the xdvi program. The
xdvi program is located in tetex-xdvi*.rpm package in Redhat Linux
which can be located through ControlPanel | Applications | Publishing
| TeX menu buttons. To read dvi document give the command -
xdvi -geometry 80x90 howto.dvi
man xdvi
And resize the window with mouse. To navigate use Arrow keys, Page
Up, Page Down keys, also you can use 'f', 'd', 'u', 'c', 'l', 'r',
'p', 'n' letter keys to move up, down, center, next page, previous
page etc. To turn off expert menu press 'x'.
You can read postscript file using the program 'gv' (ghostview) or The
ghostscript program is in ghostscript*.rpm package and gv program is
in gv*.rpm package in Redhat Linux which can be located through
ControlPanel | Applications | Graphics menu buttons. The gv program is
much more user friendly than ghostscript. Also ghostscript and gv are
available on other platforms like OS/2, Windows 95 and NT, you view
this document even on those platforms.
· Get ghostscript for Windows 95, OS/2, and for all OSes from
<http://www.cs.wisc.edu/~ghost>
To read postscript document give the command -
gv howto.ps
ghostscript howto.ps
You can read HTML format document using Netscape Navigator, Microsoft
Internet explorer, Redhat Baron Web browser or any of the 10 other web
browsers.
You can read the latex, LyX output using LyX a X-Windows front end to
latex.
Subscribe to:
Posts (Atom)