home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / KERNELD < prev    next >
Encoding:
Text File  |  1996-06-05  |  33.2 KB  |  770 lines

  1. kerneld mini-HOWTO
  2.  
  3. Version 1.4, last updated: June 3, 1996 by Henrik Storner
  4. (storner@osiris.ping.dk)
  5. ----------------------------------------------------------------------------
  6.  
  7. Introduction
  8.  
  9. This document explains how you can use the kerneld function now (since
  10. 1.3.57) in the Linux kernels. It describes
  11.  
  12.    * what is kerneld
  13.    * why do I want to use it
  14.    * how to get the necessary pieces
  15.    * how to set them up
  16.    * how to tell kerneld about modules it doesn't know
  17.    * how to spy on kerneld (can be useful in setting it up).
  18.    * on-demand dialing of PPP and SLIP connections
  19.    * special kerneld uses
  20.    * Common problems and weirdness
  21.  
  22. If you see things in this document that are wrong, please send me a note
  23. about it. I also appreciate any comments and suggestions for how to improve
  24. this mini-HOWTO. The latest released version of this document can be found
  25. at http://eolicom.olicom.dk/~storner/kerneld-mini-HOWTO.html. Between
  26. releases of the mini-HOWTO you can find updates on my unstructured list of
  27. changes at http://eolicom.olicom.dk/~storner/kern.html
  28.  
  29. ----------------------------------------------------------------------------
  30.  
  31. What is kerneld ?
  32.  
  33. kerneld is a feature introduced in the 1.3 development kernels by Bjorn
  34. Ekwall. It allows kernel "modules" - i.e. device drivers, network drivers,
  35. filesystems - to be loaded automatically when they are needed, rather than
  36. having to do it manually with modprobe or insmod.
  37.  
  38. kerneld also has some other functions:
  39.  
  40.    * It can start a program whenever you attempt to access another node on
  41.      the network, for instance - this makes it easy to implement
  42.      dial-on-demand networking if you are connected through SLIP or PPP.
  43.  
  44. And for the more amusing aspects, although these are not (yet ?) integrated
  45. with the standard kernel:
  46.  
  47.    * It can be setup to run a user-program instead of the default screen
  48.      blanker, thus letting you use any program as a screen-saver.
  49.    * Similar to the screen-blanker support, you can also change the standard
  50.      console "beep" into something completely different ...
  51.  
  52. kerneld consists of two separate entities:
  53.  
  54.    * Support in the Linux kernel for sending requests to a daemon that a
  55.      module is needed for a certain task.
  56.    * A user-level daemon that can figure out what modules must be loaded to
  57.      fulfill the request from the kernel.
  58.  
  59. Both pieces must be working for the kerneld support to function - it is not
  60. enough that only one or the other has been setup.
  61.  
  62. ----------------------------------------------------------------------------
  63.  
  64. Why do I want to use it ?
  65.  
  66. There are some good reasons for using kerneld. The ones I will mention are
  67. mine - others may want to use it for other reasons.
  68.  
  69.    * If you have to build kernels for several systems that only differ
  70.      slightly - different kind of network card, for instance - then you can
  71.      build a single kernel and some modules, instead of having to build
  72.      individual kernels for each system.
  73.    * Modules are easier for developers to test - you don't need to reboot
  74.      the system to load and unload the driver. (This applies to all modules,
  75.      not just kerneld-loaded ones).
  76.    * It cuts down on the kernel memory usage, meaning you have more memory
  77.      available for applications. Memory used by the kernel is *never*
  78.      swapped out, so if you have 100Kb worth of unused drivers compiled into
  79.      your kernel, they are simply wasting RAM.
  80.    * Some of the things I use - the ftape floppy-tape driver, for instance,
  81.      or iBCS - are only available as modules. But I don't want to bother
  82.      with loading and unloading them whenever I need them.
  83.  
  84. Of course, there are also reasons why you may not want to use it. One
  85. argument against it could be that you do not want to experiment with the
  86. development kernels - by their very nature, they are bound to have bugs in
  87. them, and they could possibly wipe out your entire disk. (It has never
  88. happened to me, and lots of people are using development kernels without any
  89. problems whatsoever, but there is a very small risk that they could wreak
  90. havoc with your system). Whenever the next stable release of the Linux
  91. kernel appears in a few months time, this argument will disappear.
  92.  
  93. ----------------------------------------------------------------------------
  94.  
  95. Where can I pick up the necessary pieces ?
  96.  
  97. The support in the Linux kernel was introduced with Linux 1.3.57. If you
  98. have an earlier kernel version, you will need to upgrade if you want the
  99. kerneld support. All of the major Linux ftp sites carry the kernel sources:
  100.  
  101.   ftp://sunsite.unc.edu/pub/Linux/kernel/v1.3/linux-1.3.57.tar.gz
  102.   ftp://tsx-11.mit.edu/pub/linux/sources/system/v1.3/linux-1.3.57.tar.gz
  103.   ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/v1.3/linux-1.3.57.tar.gz
  104.  
  105. The user-level daemon is included with the modules-1.2.8 package, and with
  106. the newer modules-1.3.57 package. These are normally available from the same
  107. place as the kernel sources, but the official locations include:
  108.  
  109.   ftp://sunsite.unc.edu/pub/Linux/kernel/modules-1.3.57.tar.gz
  110.   ftp://tsx-11.mit.edu/pub/linux/sources/sbin/modules-1.3.57.tar.gz
  111.   ftp://ftp.funet.fi/pub/Linux/tools/modules-1.3.57.tar.gz
  112.  
  113. NOTE: A newer modules-package is likely to be available by the time you read
  114. this; there is a known bug in modules-1.3.57 that causes insmod to complain
  115. about "gcc2_compiled not defined" when the module is compiled with some of
  116. the latest binutils versions. If you have this problem and cannot find an
  117. update at the sites mentioned above, checkout Bjorn Ekwall's website at
  118. http://www.pi.se/blox/modules
  119.  
  120. ----------------------------------------------------------------------------
  121.  
  122. How do I set it up ?
  123.  
  124. First get the necessary parts: A suitable kernel and the latest
  125. modules-utilities. Then you should install the modules-utilities. Pretty
  126. simple - just unpack the sources and run make install. This compiles and
  127. installs the following programs in /sbin: genksysm, insmod, lsmod, modprobe,
  128. depmod, kerneld. I recommend that you add some lines to your startup-scripts
  129. to do some necessary setup whenever you boot Linux. Add the following lines
  130. to your /etc/rc.d/rc.S file (if you are running Slackware), or to
  131. /etc/rc.d/rc.sysinit (if you are running SysVinit, i.e. Debian, RedHat,
  132. Caldera):
  133.  
  134.         # Start kerneld - this should happen very early in the
  135.         # boot process, certainly BEFORE you run fsck on filesystems
  136.         # that might need to have disk drivers autoloaded
  137.         if [ -x /sbin/kerneld ]
  138.         then
  139.                 /sbin/kerneld
  140.         fi
  141.  
  142.         # Your standard fsck commands go here
  143.         # And you mount command to mount the root fs read-write
  144.  
  145.         # Update kernel-module dependencies file
  146.         # Your root-fs MUST be mounted read-write by now
  147.         if [ -x /sbin/depmod ]
  148.         then
  149.                 /sbin/depmod -a
  150.         fi
  151.  
  152. The first part starts kerneld itself.
  153.  
  154. The second part calls 'depmod -a' at startup. The depmod program builds a
  155. list of all available modules and analyzes their inter-dependencies, so it
  156. knows if one module needs to have another loaded before it will itself load.
  157.  
  158. NOTE: Recent versions of kerneld links with the GNU dbm library, libgdbm.
  159. This means that kerneld will not start if libgdbm is not available which may
  160. well be the case if you have /usr on a separate partition and start kerneld
  161. before /usr is mounted. The recommended solution is to move libgdbm from
  162. /usr/lib to /lib.
  163.  
  164. Next, unpack the kernel sources, configure and build a kernel to your
  165. liking. If you have never done this before, you should definitely read the
  166. README file at the top level of the Linux sources. When you run make config
  167. to configure the kernel, you should pay attention to some questions that
  168. appear early on:
  169.  
  170.   Enable loadable module support (CONFIG_MODULES) [Y/n/?] Y
  171.  
  172. You need to select the loadable module support, or there will be no modules
  173. for kerneld to load! Just say Yes.
  174.  
  175.   Kernel daemon support (CONFIG_KERNELD) [Y/n/?] Y
  176.  
  177. This, of course, is also necessary. Then, a lot of the things in the kernel
  178. can be built as modules - you will see questions like
  179.  
  180.   Normal floppy disk support (CONFIG_BLK_DEV_FD) [M/n/y/?]
  181.  
  182. where you can answer with an 'M' for 'Module'. Generally, only the drivers
  183. necessary for you to boot up your system - the harddisk driver, the driver
  184. for the root filesystem - should be built into the kernel; the rest can be
  185. built as modules.
  186.  
  187. When you have gone through the 'make config', run 'make dep', 'make clean',
  188. 'make zImage' or 'make zlilo', 'make modules' and 'make modules_install'.
  189.  
  190. Phew.
  191.  
  192. The 'make zImage' puts the new kernel image in the file
  193. arch/i386/boot/zImage. You will need to copy it where you keep your
  194. boot-image, or install it in LILO afterwards.
  195.  
  196. For more information about configuring, building and installing your own
  197. kernel, check out the Kernel-HOWTO posted regularly to
  198. comp.os.linux.answers, and available from sunsite.unc.edu in
  199. /pub/Linux/docs/HOWTO .
  200.  
  201. ----------------------------------------------------------------------------
  202.  
  203. Trying out kerneld
  204.  
  205. Now reboot with the new kernel. When the system comes back up, you can run a
  206. 'ps -ax', and you should see a line for kerneld:
  207.  
  208.     PID TTY STAT  TIME COMMAND
  209.      59  ?  S     0:01 /sbin/kerneld
  210.  
  211. One of the nice things with kerneld is that once you have the kernel and the
  212. daemon installed, very little setup is needed. For a start, try using one of
  213. the drivers that you built as a module - it is more likely than not that it
  214. will work without further configuration. I build the floppy driver as a
  215. module, so I could put a DOS floppy in the drive and
  216.  
  217.   osiris:~ $ mdir a:
  218.    Volume in drive A has no label
  219.    Volume Serial Number is 2E2B-1102
  220.    Directory for A:/
  221.  
  222.   binuti~1 gz       1942 02-14-1996  11:35a binutils-2.6.0.6-2.6.0.7.diff.gz
  223.   libc-5~1 gz      24747 02-14-1996  11:35a libc-5.3.4-5.3.5.diff.gz
  224.           2 file(s)        26689 bytes
  225.  
  226. So the floppy driver works - it gets loaded automatically by kerneld when I
  227. try to use the floppy disk.
  228.  
  229. To see that the floppy module is indeed loaded, you can run /sbin/lsmod
  230. which lists all currently loaded modules:
  231.  
  232.   osiris:~ $ /sbin/lsmod
  233.   Module:        #pages:  Used by:
  234.   floppy            11    0 (autoclean)
  235.  
  236. The "(autoclean)" means that the module will automatically be removed by
  237. kerneld when it has not been used for more than one minute. So the 11 pages
  238. of memory (= 44kB, one page is 4 kB) will only be used while I access the
  239. floppy drive - if I don't use the floppy for more than a minute, they are
  240. freed. Quite nice, if you are short of memory for your applications!
  241.  
  242. ----------------------------------------------------------------------------
  243.  
  244. How does kerneld know what module to load ?
  245.  
  246. Although kerneld comes with builtin knowledge about the most common types of
  247. modules, there are situations where kerneld will not know how to handle a
  248. request from the kernel. This is the case with things like CD-ROM drivers or
  249. network drivers, where there are more than one possible module that can be
  250. loaded.
  251.  
  252. The requests that the kerneld daemon gets from the kernel is for one of the
  253. following items:
  254.  
  255.    * a block-device driver
  256.    * a character-device driver
  257.    * a binary format
  258.    * a tty line discipline
  259.    * a filesystem
  260.    * a network route (for demand dialing slip or ppp links)
  261.    * a network device
  262.    * a network service (e.g. rarp)
  263.    * a network protocol (e.g. IPX)
  264.  
  265. kerneld determines what module should be loaded by scanning the
  266. configuration file /etc/conf.modules There are two kinds of entries in this
  267. file: Paths (where the module-files are located), and aliases (what module
  268. should be loaded). If you don't have this file already, you could create it
  269. by running
  270.  
  271.   /sbin/modprobe -c | grep -v '^path' >/etc/conf.modules
  272.  
  273. If you want to add yet another "path" directive to the default paths, you
  274. _must_ include _all_ the "default" paths as well, since a path directive in
  275. /etc/conf.modules will _replace_ all the ones that modprobe knows by
  276. default!
  277.  
  278. Normally you don't want to add any paths by your own, since the built-in set
  279. should take care of all "normal" setups (and then some...), I promise!
  280.  
  281. On the other hand, if you just want to add an alias or an option directive,
  282. your new entries in /etc/conf.modules will be _added_ to the ones that
  283. modprobe already knows. If you should _redefine_ an alias or an option, your
  284. new entries in /etc/conf.modules will override the built-in ones.
  285.  
  286. Block devices
  287. =============
  288. If you run '/sbin/modprobe -c', you will get a listing of the modules that
  289. kerneld knows about, and what requests they correspond to. For instance, the
  290. request that ends up loading the floppy driver is for the block-device that
  291. has major number 2:
  292.  
  293.   osiris:~ $ /sbin/modprobe -c | grep floppy
  294.   alias block-major-2 floppy
  295.  
  296. Why block-major-2 ? Because the floppy devices /dev/fd* use major device 2
  297. and are block devices:
  298.  
  299.   osiris:~ $ ls -l /dev/fd0 /dev/fd1
  300.   brw-rw-rw-   1 root     root       2,   0 Mar  3  1995 /dev/fd0
  301.   brw-r--r--   1 root     root       2,   1 Mar  3  1995 /dev/fd1
  302.  
  303. Character devices
  304. =================
  305. Character devices are dealt with in a similar way. E.g. the ftape floppy
  306. tape driver sits on major-device 27:
  307.  
  308.   osiris:~ $ ls -lL /dev/ftape
  309.   crw-rw----   1 root     disk      27,   0 Jul 18  1994 /dev/ftape
  310.  
  311. However, kerneld does not by default know about the ftape driver - it is not
  312. listed in the output from '/sbin/modprobe -c'.
  313.  
  314. So to setup kerneld to load the ftape driver, I must add a line to the
  315. kerneld configuration file, /etc/conf.modules:
  316.  
  317.   alias char-major-27 ftape
  318.  
  319. Network devices
  320. ===============
  321. You can also use the device name instead of the 'char-major-xxx' /
  322. 'block-major-yyy' setup. This is especially useful for network drivers. E.g.
  323. a driver for an ne2000 netcard acting as eth0 would be loaded with
  324.  
  325.   alias eth0 ne
  326.  
  327. If you need to pass some options to the driver - e.g. to tell the module
  328. about what IRQ the netcard is using, you add an 'options' line:
  329.  
  330.   options ne irq=5
  331.  
  332. This will cause kerneld to load the NE2000 driver with the command
  333.  
  334.   /sbin/modprobe ne irq=5
  335.  
  336. Of course, the actual options available are specific to the module you are
  337. loading.
  338.  
  339. Binary formats
  340. ==============
  341. Binary formats are handled in a similar way. Whenever you try to run a
  342. program that the kernel does not know how to load, kerneld gets a request
  343. for "binfmt-xxx", where xxx is a number determined from the first few bytes
  344. of the executable. So, the kerneld configuration to support loading the
  345. binfmt_aout module for ZMAGIC (a.out) executables is
  346.  
  347.   alias binfmt-267 binfmt_aout
  348.  
  349. since the magic number (see /etc/magic) for ZMAGIC files is 267. (If you
  350. check /etc/magic, you will see the number 0413, but /etc/magic uses octal
  351. numbers where kerneld uses decimal, and octal 413 = decimal 267). There are
  352. actually three slightly different variants of a.out executables (NMAGIC,
  353. QMAGIC and ZMAGIC), so for full support of the binfmt_aout module we need
  354.  
  355.   alias binfmt-264 binfmt_aout  # pure executable (NMAGIC)
  356.   alias binfmt-267 binfmt_aout  # demand-paged executable (ZMAGIC)
  357.   alias binfmt-204 binfmt_aout  # demand-paged executable (QMAGIC)
  358.  
  359. a.out, Java and iBCS binary formats are recognized automatically by kerneld,
  360. without any configuration.
  361.  
  362. Line disciplines (slip, cslip and ppp)
  363. ======================================
  364. Line disciplines are requested with "tty-ldisc-x", with 'x' being usually 1
  365. (for SLIP) or 3 (for PPP). Both of these are known by kerneld automatically.
  366.  
  367. Network protocol families (IPX, AppleTalk, AX.25)
  368. =================================================
  369. Some network protocols can be loaded as modules as well. The kernel asks
  370. kerneld for a protocol family (e.g. IPX) with a request for "net-pf-X" where
  371. X is a number indicating what family is wanted. E.g. net-pf-3 is AX.25,
  372. net-pf-4 is IPX and net-pf-5 is AppleTalk. (These numbers are determined by
  373. the AF_AX25, AF_IPX etc. definitions in the linux source file
  374. include/linux/socket.h). So to autoload the IPX module, you would need an
  375. entr like this in /etc/conf.modules:
  376.  
  377.   alias net-pf-4 ipx
  378.  
  379. See also the section below on common problems for information about how you
  380. can avoid some annoying boot-time messages related to undefined protocol
  381. families.
  382.  
  383. File systems
  384. ============
  385. kerneld requests for filesystems are simply the name of the filesystem type.
  386. A common use of this would be to load the isofs module for CD-ROM
  387. filesystems, i.e. filesystems of type "iso9660":
  388.  
  389.   alias iso9660 isofs
  390.  
  391. ----------------------------------------------------------------------------
  392.  
  393. Devices requiring special configuration
  394.  
  395. Some devices require a bit on configuration beyond the normal aliasing of
  396. e.g. a device to a module.
  397.  
  398.    * Character devices on major number 10: The miscellaneous devices
  399.    * SCSI devices
  400.    * Devices that require special initialization
  401.  
  402. char-major-10 : Mice, watchdogs and randomness
  403. ==============================================
  404. Hardware devices are usually identified through their major device numbers,
  405. e.g. ftape is char-major-27. However, if you look through the entries in
  406. /dev for char major 10, you will see that this is a bunch of very different
  407. devices, including
  408.  
  409.    * Mice of various sorts (bus mice, PS/2 mice)
  410.    * Watchdog devices
  411.    * The kernel 'random' device
  412.    * APM (Advanced Power Management) interface
  413.  
  414. Obviously, these devices are controlled by several different modules, not a
  415. single one. Therefore, the kerneld configuration for these misc. devices use
  416. the major number and the minor number:
  417.  
  418.         alias char-major-10-1 psaux     # For PS/2 mouse
  419.         alias char-major-10-130 wdt     # For WDT watchdog
  420.  
  421. You need a kernel version 1.3.82 or later to use this; earlier versions do
  422. not pass the minor number to kerneld, making it impossible for kerneld to
  423. figure out which of the misc. device modules to load.
  424.  
  425. Loading SCSI drivers: The scsi_hostadapter entry
  426. ================================================
  427. Drivers for SCSI devices consist of a driver for the SCSI host adapter (e.g.
  428. an Adaptec 1542), and a driver for the type of SCSI device you use, e.g. a
  429. hard disk, a CD-ROM or a tape-drive. All of these can be loaded as modules.
  430. However, when you want to access e.g. the CD-ROM drive that is connected to
  431. the Adaptec card, the kernel and kerneld only knows that it needs to load
  432. the sr_mod module in order to support SCSI CD-ROM's - it does not know what
  433. SCSI controller the CD-ROM is connected to, and hence does not know what
  434. module to load to support the SCSI controller.
  435.  
  436. To resolve this, you can add an entry for the SCSI driver module to your
  437. /etc/conf.modules that tells kerneld which of the many possible SCSI
  438. controller modules it should load:
  439.  
  440.         alias scd0 sr_mod               # sr_mod for SCSI CD-ROM's ...
  441.         alias scsi_hostadapter aha1542  # ... need the Adaptec driver
  442.  
  443. This only works with kernel version 1.3.82 or later.
  444.  
  445. If you have more than one SCSI controller, you are currently out of luck -
  446. there is no way of telling kerneld that your CD-ROM drive needs the Adaptec
  447. driver, but the tape drive needs the BusLogic driver.
  448.  
  449. When loading a module isn't enough: The 'post-install' entry
  450. ============================================================
  451. Sometimes, just loading the module is not enough to get things working. For
  452. instance, if you have your soundcard compiled as a module, it is often
  453. convenient to set a certain volume level. Only problem is, the setting
  454. vanishes the next time the module is loaded. Here is a neat trick from Ben
  455. Galliart (bgallia@luc.edu):
  456.  
  457.    The final solution required installing the setmix-0.1 package
  458.    ( ftp://sunsite.unc.edu/pub/Linux/apps/sound/mixers/setmix-0.1.tar.gz )
  459.  
  460.    And then adding the following lines to my  /etc/conf.modules :
  461.        post-install sound /usr/local/bin/setmix -f /etc/volume.conf
  462.  
  463. What this does is that after the sound module is loaded, kerneld runs the
  464. command indicated by the 'post-install sound' entry. So the sound module
  465. gets configured with the command '/usr/local/bin/setmix -f
  466. /etc/volume.conf'.
  467.  
  468. This may be useful for other modules as well, e.g. the lp module can be
  469. configured with the tunelp program by adding
  470.  
  471.         post-install lp tunelp <options>
  472.  
  473. For kerneld to recognize these options, you will need a version of kerneld
  474. that is 1.3.69f or later. This is currently in beta-testing, and you will
  475. therefore need to pick it up from Bjorn Ekwall's modules-page,
  476. http://www.pi.se/blox/modules/
  477.  
  478. NOTE: An earlier version of this mini-HOWTO mentioned a "pre-remove" option,
  479. that might be used to run a command just before kerneld removed a module.
  480. However, this has never worked and its use is therefore discouraged - most
  481. likely, this option will disappear in a future kerneld release. The whole
  482. issue of module "settings" is undergoing some change at the moment, and may
  483. look different on your system by the time you read this.
  484.  
  485. ----------------------------------------------------------------------------
  486.  
  487. Spying on kerneld
  488.  
  489. If you have tried everything, and just cannot figure out what the kernel is
  490. asking kerneld to do, there is a way of seeing the requests that kerneld
  491. receives, and hence to figure out what should go into /etc/conf.modules: The
  492. kdstat utility.
  493.  
  494. This nifty little program comes with the modules-1.3.57 package, but it is
  495. not compiled or installed by default. To build it:
  496.  
  497.   cd /usr/src/modules-1.3.57/kerneld
  498.   make kdstat
  499.  
  500. Then, to make kerneld display information about what it is doing, run
  501.  
  502.   kdstat debug
  503.  
  504. and kerneld will start spewing messages on the console about what it is
  505. doing. If you then try and run the command that you want to use, you will
  506. see the kerneld requests; these can be put into /etc/conf.modules and
  507. aliased to the module needed to get the job done.
  508.  
  509. To turn off the debugging, run '/sbin/kdstat nodebug' .
  510.  
  511. ----------------------------------------------------------------------------
  512.  
  513. Dial-on-demand networking
  514.  
  515. kerneld also gets a request when the kernel needs to send data to a network
  516. connection for which there is no known route. This is typically the case
  517. when your network access is through a SLIP- or PPP-connection that is only
  518. active part of the time.
  519.  
  520. The request that kerneld gets are of the form "request-route a.b.c.d", where
  521. a.b.c.d is the IP address that the kernel has data for. kerneld will handle
  522. this request by running a shell script, /sbin/request-route, with the IP
  523. address as parameter. The most likely IP address requested the first time is
  524. that of your nameserver (see /etc/resolv.conf) so that will be the address
  525. passed to the request-route script. Unless you have more than one possible
  526. network connection (dial-up or ethernet), you can safely ignore the IP
  527. address; all of your network access has to go the same way, so there is no
  528. need to differentiate between requests for one IP address or another.
  529.  
  530. To implement on-demand dialing, you just need to change the
  531. /sbin/request-route script so that it sets up your SLIP or PPP connection.
  532. For SLIP, this typically involves running 'dip' or some other program to
  533. call the SLIP server and setup the connection; for PPP, you will probably
  534. run chat+pppd. The script does not need to worry about loading the ppp- or
  535. slip-modules; this will happen automatically through kerneld.
  536.  
  537. Calling up your ISP and setting up the SLIP/PPP connection can take a while,
  538. and may not always be succesful. The request-route script therefore has a
  539. built-in timer - by default set for 60 seconds - which is how long it will
  540. keep the kernel waiting for the kerneld request to complete. But often the
  541. network setup does not take 60 seconds, so for the quickest possible
  542. response you should arrange for the request-route timer to be killed as soon
  543. as the network setup is complete. SLIP users can do this with recent version
  544. of dip, by including the command
  545.  
  546.   shell kill `cat /tmp/request-route`
  547.  
  548. just before the "mode SLIP" command in your DIP script.
  549.  
  550. PPP users should have
  551.  
  552.   kill `cat /tmp/request-route`
  553.  
  554. in their /etc/ppp/ip-up script.
  555.  
  556. If your network takes longer than 60 seconds to setup, then you will need to
  557. change the duration of the timer in the /sbin/request-route script. In that
  558. case, you will probably also need to change the kerneld delay for
  559. autocleaning unused modules, by adding a "delay=xxx" option to the line in
  560. /etc/rc.d/rc.S that starts up kerneld. The 'xxx' value is the delay before
  561. modules are removed, in seconds (default is 60). This is especially
  562. necessary if you used ppp: The ppp modules are loaded as soon as pppd
  563. starts, but if you use a command like "/usr/sbin/pppd connect `chat -f
  564. /etc/chat.script` ..." then pppd is idle while the chat-script runs, and the
  565. ppp-modules may have been unloaded by the time the chat-script completes!
  566.  
  567. kerneld does not yet monitor the network activity to shutdown the network
  568. connection; however, PPP users can take advantage of the 'idle-disconnect'
  569. option for pppd introduced in ppp-2.2.0. If you pass the option
  570. 'idle-disconnect 600' to pppd, then the PPP connection will be terminated
  571. after 600 seconds (10 minutes) of inactivity. SLIP users will have to
  572. shutdown the connection manually.
  573.  
  574. ----------------------------------------------------------------------------
  575.  
  576. Special kerneld uses
  577.  
  578. I knew you would ask about how to setup the screensaver module ...
  579.  
  580. The 'kerneld/GOODIES' directory in modules-1.3.57 has a couple of kernel
  581. patches for screensaver- and consolebeep-support in kerneld; these are not
  582. yet part of the official kernel. So you will need to install the
  583. kernel-patches and rebuild the kernel.
  584.  
  585. To install a patch, you use the "patch" command:
  586.  
  587.   cd /usr/src/linux
  588.   patch -s -p1 </usr/src/modules-1.3.57/kerneld/GOODIES/blanker_patch
  589.  
  590. Then rebuild and install the new kernel.
  591.  
  592. When the screensaver triggers, kerneld will run the command
  593. "/sbin/screenblanker" - this may be a shell script that runs your favourite
  594. screensaver.
  595.  
  596. When the kernel wants to unblank the screen, it sends a SIGQUIT signal to
  597. the process running /sbin/screenblanker. Your shell script or screensaver
  598. should trap this, and terminate. Remember to restore the screen to the
  599. original text mode!
  600.  
  601. ----------------------------------------------------------------------------
  602.  
  603. Common problems and things that make you wonder
  604.  
  605. Why do I get "Cannot locate module for net-pf-X" messages when I run
  606. ifconfig
  607. ====================================================================
  608. Around kernel version 1.3.80, the networking code was changed to allow
  609. loading protocol families (e.g. IPX, AX.25 and AppleTalk) as modules. This
  610. caused the addition of a new kerneld request: net-pf-X, where X is a number
  611. identifying the protocol (see /usr/src/linux/include/linux/socket.h for the
  612. meaning of the various numbers).
  613. Unfortunately, ifconfig accidentally triggers these messages, so a lot of
  614. people get a couple of messages logged when the system boots and runs
  615. ifconfig to setup the loopback device. The messages are harmless, and you
  616. can disable them by adding the lines
  617.  
  618.         alias net-pf-3 off      # Forget AX.25
  619.         alias net-pf-4 off      # Forget IPX
  620.         alias net-pf-5 off      # Forget AppleTalk
  621.  
  622. to /etc/conf.modules. Of course, if you do use IPX as a module, you should
  623. not add a line to disable IPX.
  624.  
  625. kerneld does not load my SCSI driver!
  626. =====================================
  627. Add an entry for the SCSI hostadapter to your /etc/conf.modules. See the
  628. description of the scsi_hostadapter entry above.
  629.  
  630. modprobe complains about 'gcc2_compiled' being undefined
  631. ========================================================
  632. This is a bug in the module-utilities, that show up only with binutils
  633. 2.6.0.9 and later, and it is also documented in the releasenote for the
  634. binutils. So read that. Or fetch an upgrade to the module-utilities that fix
  635. this, from Bjorn's modules-page.
  636.  
  637. My sound driver keeps forgetting its settings for volume etc
  638. ============================================================
  639. The settings for a module are stored inside the module itself when it is
  640. loaded. So when kerneld auto-unloads a module, any settings you have made
  641. are forgotten, and the next time the module loads it reverts to the default
  642. settings.
  643.  
  644. You can tell kerneld to configure a module by running a program after the
  645. module has been auto-loaded. See the section above on the 'post-install'
  646. entry.
  647.  
  648. DOSEMU needs some modules - how can I get kerneld to load those
  649. ===============================================================
  650. Right now, you cannot. dosemu - both the 0.60 official release version, and
  651. the 0.63 version currently under development - has no support for loading
  652. its modules through kerneld.
  653.  
  654. Why do I get "Ouch, kerneld timed out, message failed" messages ?
  655. =================================================================
  656. When the kernel sends a request off to to kerneld, it expects to receive an
  657. acknowledgement back within one second. If kerneld does not send this
  658. acknowledgement, this message is logged. The request is retransmitted, and
  659. should get through eventually.
  660.  
  661. This usually happens on systems with a very high load - since kerneld is a
  662. user-mode proces, it is scheduled just like any other proces on the system.
  663. At times of high load, it may not get to run in time to send back the
  664. acknowledgement before the kernel times out.
  665.  
  666. If this happens even when the load is light, try restarting kerneld. (Kill
  667. the kerneld proces, and start it again with the command /usr/sbin/kerneld.
  668. If the problem persists, you should mail a bug report to
  669. linux-kernel@vger.rutgers.edu, but please make sure that your version of the
  670. kernel and kerneld is up-to-date before posting about the problem.
  671.  
  672. mount doesn't wait for kerneld to load the filesystem module
  673. ============================================================
  674. There has been a number of reports that the mount(8) command does not wait
  675. for kerneld to load the filesystem module. lsmod does show that kerneld
  676. loads the module, and if you repeat the mount command immediately it will
  677. succeed. This appears to be a bug in the module-utilities version 1.3.69f
  678. that affects some Debian users - it can be fixed by getting a later version
  679. of the module-utilities.
  680.  
  681. kerneld fails to load the ncpfs module
  682. ======================================
  683. You need to compile the ncpfs utilities with -DHAVE_KERNELD. See the ncpfs
  684. Makefile.
  685.  
  686. kerneld fails to load the smbfs module
  687. ======================================
  688. This is not a problem with kerneld, but a bug in the smbmount program.
  689. smbmount attempts to outsmart kerneld - or to be fair, it was written before
  690. kerneld was widely available - and loads the smbfs module itself.
  691. Unfortunately, it looks for the module in the wrong place: It looks for
  692. /lib/modules/x.y.z/smbfs.o, but the module is kept with the rest of the fs
  693. modules in /lib/modules/x.y.z/fs/smbfs.o If you want to use smbmount and
  694. kerneld together, apply the following patch to smbmount.c:
  695.  
  696. --- smbmount.c.orig     Thu May 30 22:48:18 1996
  697. +++ smbmount.c  Thu May 30 22:49:40 1996
  698. @@ -297,6 +297,9 @@
  699.  static int
  700.  load_smbfs()
  701.  {
  702. +#ifdef HAVE_KERNELD
  703. +       return 0;
  704. +#else
  705.         FILE *fver, *ffs;
  706.         char s[1024];
  707.         char modname[1024];
  708. @@ -365,6 +368,7 @@
  709.                  }
  710.          }
  711.          return status;
  712. +#endif
  713.  }
  714.  
  715.  /* Check whether user is allowed to mount on the specified mount point */
  716.  
  717. I built everything as modules, and now my system cannot boot
  718. kerneld fails to load the root filesystem module
  719. ============================================================
  720. You cannot modularize everything: The kernel must have enough drivers built
  721. in for it to be able to mount your root filesystem, and run the necessary
  722. programs to start kerneld. So you cannot modularize
  723.  
  724.    * the driver for the hard disk where your root filesystem lives
  725.    * the root filesystem driver itself
  726.    * the binary format loader for init, kerneld and other programs
  727.  
  728. [Actually, this is only almost true. Late 1.3.x kernels support the use of
  729. an initial ram-disk that is loaded by LILO or LOADLIN, and it might be
  730. possible to load the root filesystem module from such a ramdisk. But don't
  731. ask me how.]
  732.  
  733. kerneld will not load at boot time - complains about libgdbm
  734. ============================================================
  735. Newer versions of kerneld need the GNU dbm library, libgdbm.so, to run. Most
  736. installations have this file in /usr/lib, but you are probably starting
  737. kerneld before the /usr filesystem is mounted. One symptom of this is that
  738. kerneld will not start during boot-up (from your rc-scripts), but runs fine
  739. if you start it by hand after that system is up. The solution is to either
  740. move the kerneld startup to after your /usr is mounted, or move the gdbm
  741. library to your root filesystem, e.g. to /lib.
  742.  
  743. ----------------------------------------------------------------------------
  744.  
  745. Copyright message
  746.  
  747. This document is Copyright (c) Henrik Storner, 1996.
  748.  
  749. Unless otherwise stated, Linux HOWTO documents are copyrighted by their
  750. respective authors. Linux HOWTO documents may be reproduced and distributed
  751. in whole or in part, in any medium physical or electronic, as long as this
  752. copyright notice is retained on all copies. Commercial redistribution is
  753. allowed and encouraged; however, the author would like to be notified of any
  754. such distributions.
  755.  
  756. All translations, derivative works, or aggregate works incorporating any
  757. Linux HOWTO documents must be covered under this copyright notice. That is,
  758. you may not produce a derivative work from a HOWTO and impose additional
  759. restrictions on its distribution. Exceptions to these rules may be granted
  760. under certain conditions; please contact the Linux HOWTO coordinator at the
  761. address given below.
  762.  
  763. In short, we wish to promote dissemination of this information through as
  764. many channels as possible. However, we do wish to retain copyright on the
  765. HOWTO documents, and would like to be notified of any plans to redistribute
  766. the HOWTOs.
  767.  
  768. If you have questions, please contact Greg Hankins, the Linux HOWTO
  769. coordinator, at gregh@sunsite.unc.edu via email.
  770.