Local "howto" information

[still in the process of updating this. -- rgr, 19-Dec-04.]

Home : Linux resources : "Howto"


This page contains "howto" information for random bits of hardware and software. Some of it is general, but some is very specific to my configuration, so it may break for yours; use caution when trying any of this stuff.

Table of contents

Related pages: These used to be subsections of this page.

Contents of this page:

  1. Local "howto" information
    1. Table of contents
      1. Terminology
    2. Networking
      1. Ethernet
      2. General IP networking
      3. If the network doesn't come up after booting
      4. DNS tricks using perl
    3. Servers
      1. Server logs
      2. Samba
    4. Linux guts
      1. Memory management
      2. rpm and rpmfind
      3. XFree86
    5. Hardware
      1. Zip drive
      2. Floppy disk

Terminology

In what follows, I've tried to use the following words consistently:


Networking

See also the SSH: Secure Shell and Linux firewall script pages.

Ethernet

See my
Ethernet Cheat Sheet for Ethernet pinouts and wire color code conventions. (This is on a page of its own for easy printing.)

See also /usr/doc/HOWTO/Ethernet-HOWTO, comp.dcom.lans.ethernet_FAQ and http://www.scyld.com/network/eepro100.html. The /sbin/mii-diag and /sbin/eepro-diag commands (downloaded from the latter) report on detailed Ethernet NIC status.

General IP networking

If the network doesn't come up after booting

Sometimes the external network configuration fails when booting, possibly due to slow DHCP server response. When that happens, there is no connectivity to the outside world, and a number of bad consequences follow:
  1. The host IP address is unknown, so the firewall script can't configure itself.
  2. DNS name resolution is unavailable.
  3. Because the world is unreachable (not to mention DNS), ntpd can't so much as ask anyone for the time of day.
So to fix all of this, the following things must be done, in this order:
  1. Bring up the interface. Do this via
           # ifup eth0
           
    as root, of course. This may take a while, and it may fail again, especially if a power outage just ended and the DHCP server is swamped with requests (and may still be booting up itself). Do "ifconfig eth0" to verify that eth0 really has an IP address.

  2. Bring up the firewall. You will want to do this before starting other services.
           # /etc/init.d/firewall
           

  3. Start the time daemon manually.
           # /etc/init.d/xntpd restart
           
    The system clock will get reset almost immediately, which may make the screen go blank, if it moves further ahead than your screen saver delay interval (mine is 10 minutes).

  4. Start the remaining services manually.
           # /etc/init.d/apache2 start
           

DNS tricks using perl

Reverse DNS in perl:

    rgr> perl -e 'use Socket; $iaddr = inet_aton("128.197.54.20"); print join(" ", gethostbyaddr($iaddr, AF_INET)), "\n";'
    DARWIN.BU.EDU  2 4 \200Å6^T
    rgr> 
Reverse DNS from a shell (using perl to trim just the host name out of the nslookup output):
    % nslookup -q=PTR 19.200.128.24.in-addr.arpa | perl -ne 'print "$1\n" if /in-addr.arpa\s+name = (.*)$/;'
    h0050da615e79.ne.mediaone.net
    % 


Servers

Use the links in the next section for server-specific pages.

Server logs

[this does not cover the "modern" logrotate package. -- rgr, 7-Jul-13.]

The various servers I run keep their log files in the following places:

What Where
NIS Uses syslog (/var/log/messages).
SSH Uses syslog (/var/log/messages).
dhcpd Uses syslog (/var/log/messages).
xntpd Writes to /var/log/ntp via syslog in the default configuration supplied by SuSE, but this is controlled by the "logfile" directive in /etc/ntpd.conf. (The default tarball installation uses /var/log/messages).
Apache Under SuSE, the Apache log files are under /var/log/apache2 (or /var/log/httpd if you are running Apache 1.3). These are called access_log and error_log. If you run an HTTPS server, there will also be an ssl_request_log file.
Subversion Subversion runs within Apache, so will need to look in your Apache logs (particularly ssl_request_log).
Samba /var/log/samba/log.nmb and /var/log/samba/log.smbd. Note that by default, SuSE configures Samba to keep a separate log file for each client machine.

Samba

Samba is configured on this machine, but not started by default, since I don't often use my Windows machine (at least not for Windows; it also runs SuSE Linux). To start it, I must do "/etc/init.d/samba start" as root.

In order to get Samba up and running at my site, I found the following resources helpful:

  1. SAMBA - opening windows to a wider world (a US mirror of the Samba home site).
  2. SMB HOWTO
  3. Using Samba (online version of the O'Reilly Using Samba book, November 1999).
  4. Windows NT SP3 and 98 Client SAMBA Problem Page
  5. LanMan and NT Password Encryption in Samba 2.x [part of the source distribution; I can't seem to find an online version right now. -- rgr, 1-Dec-01.]


Linux guts

Memory management

Doing "cat /proc/meminfo" generates a report of current usage. See "man vmstat" for a tool to keep an eye on memory usage.

rpm and rpmfind

Installing
rpm -ivh *.rpm
Query a single package
rpm -qi tripwire
List package files
rpm -ql tripwire
Recently installed packages
rpm -qa --last | head

RPM links:

XFree86

The "DontZap" option in the "ServerFlags" section of the /etc/X11/XF86Config file disables the Crtl-Alt-Backspace server abort sequence, letting it through to clients. This option is essential for keeping us Zmacs alumni (who expect C-M-DEL to be bound to backward-kill-sexp) from going postal. -- rgr, 19-Mar-00.


Hardware

See also the Burning CD-R disks page.

Zip drive

Mounting:
Use "mount /mnt/zip". If this fails with an error message that looks like this
       mount: the kernel does not recognize /dev/sda4 as a block device
              (maybe `insmod driver'?)
then this is probably because the machine was booted with the Zip drive off. If that's the case, then
       modprobe imm
will probably be sufficient to get /dev/sda4 recognized, after which the drive can be power cycled without needing to repeat the modprobe. (The boot-time modprobe is done in the
/etc/rc.d/rc.modules script. -- rgr, 28-Dec-99.)

If /var/log/messages says

       modprobe: can't locate module block-major-8
and lsmod shows imm already loaded, then do
       rmmod imm; modprobe imm
to force reloading. -- rgr, 2-Jul-00.

Unmounting:
"umount /mnt/zip", and then hit the button to eject. Doing "eject /mnt/zip" seems to work, but only for root.
Formatting:
mke2fs /dev/sda4

You can add the "-c" option to check for bad blocks, but I haven't found a bad block yet, and this is what takes most of the time (about 4.5 minutes), as it has to read the entire drive. (My guess is that bad blocks are detected and "repaired" by the drive, so it's no surprise that I never found one. -- rgr, 7-Aug-01.)

Checking for bad blocks:
When doing badblocks on Zip, use 98288 for number of blocks -- this is (- (/ (* 2048 96) 2) 16), for 96 cyl, 2048 blocks/cyl, 0.5k/block, minus some magic factor. If there is some reason to suspect the existence of a bad block, one can also use the "-c" option to e2fsck when checking disk integrity (but see the comment under "Formatting" above).
Checking file system integrity:
Periodically, when mounting Zip disks, the following warning will appear in /var/log/messages:
       EXT2-fs warning: maximal mount count reached, running e2fsck is recommended
To address this, before mounting the disk, do
       e2fsck -f /dev/sda4
The "-f" option will "Force checking even if the file system seems clean" (from the man page); without it, e2fsck does a quick check, so "-f" is more thorough. You can also add the "-c" option to request bad block checking (but see the comment under "Formatting" above).
Erasing:
To erase a Zip disk thoroughly (or any other disk device or partition for that matter), you can do a "write" test to check for bad blocks:
       badblocks -w /dev/sda4 98288
This takes a while, as it writes a number of patterns across the whole disk, and then rereads them. Each read/write pass takes about nine minutes; the whole process is more than half an hour.

Note the existence of the mzip command.

[The "Zip drive backup" section that was here has been renamed and given its own page. -- rgr, 7-Aug-01.]

Floppy disk

Formatting:
For a 1.44MB floppy, use:
       fdformat /dev/fd0H1440
Other densities use different magical device names.
Building an ext2 file system:
mkfs.ext2 -c /dev/fd0H1440
Making a boot image:
dd if=/mnt/cdrom/images/boot.img of=/dev/fd0 bs=1440k


Bob Rogers <rogers@rgrjr.dyndns.org>
$Id$