Red Hat Linux Networking , System Administration (P32) potx

30 278 0
Red Hat Linux Networking , System Administration (P32) potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

One example of a resource conflict is that your modem and some other device share an interrupt. COM1 (/dev/ttyS0) and COM3 (/dev/ttyS3) try to share the same interrupt unless told otherwise. Eliminate the conflict by set- ting a jumper for one of the devices that causes it to use another IRQ. Next, use minicom to see if you can communicate with the modem. The following Web pages help you configure a PPP connection: ■■ redhat.com/support/docs/tips/PPP-Client-Tips/PPP- Client-Tips.html ■■ redhat.com/support/docs/tips/Network-Config-Tips/ Network-Config-Tips.html If setserial shows your modem’s UART as unknown, as you see in the following example, the kernel has not detected your serial port or the modem attached to it: /dev/ttyS2, UART: unknown, Port: 0x03f8, IRQ: 10 This problem usually occurs because your PC’s BIOS is set up to expect a plug-and-play (PnP) operating system. To solve the problem, reboot the PC and, as it powers up, press the key that permits you to access the system’s BIOS. Typically, this is a function key, such as F2, but the exact key depends on your PC’s BIOS. In the setup screen, locate the option for PnP operating system (often labeled Plug & Play O/S) and turn off that option. Then save the BIOS settings and exit. Doing so causes the PC to reboot. This time, when Red Hat Linux boots, the kernel should be able to detect the PC’s serial port correctly. If your serial ports are correctly detected, but the modem does not respond, make sure that /dev/modem is linked to the proper device file in /dev. An unresponsive modem is especially common with PCI modem cards, which typ- ically do not use COM1 (/dev/ttyS0) or COM2 (/dev/ttyS1) by default. For example, suppose dmesg | grep ttyS shows the following: ttyS02 at port 0x6800 (irq = 10) is a 16550A In this case, execute the following command to make sure that /dev/modem is linked to the proper device file: # ln -sf /dev/ttyS2 /dev/modem If your modem does not appear to be detected, use the Windows Device Manager to obtain the modem’s IRQ and I/O address, and compare those val- ues to the values the setserial command reports for that port. At present, some modems simply do not work with Linux. These are so-called “WinModems,” which, in order to function, rely on the Windows 894 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 894 operating system and a special, Windows-specific device driver. WinModems, also called software modems, rely on a device driver, rather than hardware, to function. Don’t despair, you may still be able to use your WinModem. You can search for your modem at http://linmodems.org to see if there is a Linux driver available. If there is, you can download, install, and configure it using the instructions provided at the Linmodem site. If you can’t find you modem listed there, or if it is listed as unsupported, your only recourse is to replace the modem with a hardware modem or one that is listed as supported on the Lin- modem site. If you can connect to your ISP but are unable to surf the Web, or if your Fire- fox complains that it cannot connect to remote hosts, the problem is most likely unconfigured or misconfigured Domain Name Server (DNS) information. You need to specify your ISP’s DNS servers in the /etc/resolv.conf file. Con- tact your ISP for this information and edit the file to include those settings. For example: search example.com nameserver 24.8.89.15 nameserver 24.8.89.16 The Boot Process Hangs A network problem exists if your system boots but then seems to hang when starting sendmail, the Sendmail daemon; httpd, the Apache Web server dae- mon; or smb, the Samba daemon. The most common cause is that Linux cannot resolve the host name to an IP address. The apparent hang is a pause while the kernel waits for the name resolver to time out; the boot process will eventually complete. To solve this problem, wait until you can log in, then log in as root to investigate and solve the problem. If you are attached directly to a network with a functioning DNS server, make sure that the file /etc/resolv.conf has the correct values for your system’s DNS server(s). Make sure that the val- ues are correct. If you are using Red Hat Linux on a system attached to a net- work without a DNS server, or if your Red Hat system is destined to be the DNS server, edit the /etc/hosts file and insert your system’s IPaddress and name to have the hostname and IP address so that the lookups occur correctly. The format of the /etc/hosts file is: 127.0.0.1 localhost.localdomain localhost 192.168.0.1 bubba.somedomain.com bubba Replace bubba.somedomain.com with the proper name of your system and the IP address with the IP address of your system. Troubleshooting and Problem Solving 895 44_599496 ch35.qxd 8/30/05 7:17 PM Page 895 Using Two Ethernet Cards To use two Ethernet cards in your Red Hat Linux system, first ensure that both cards are supported. Next, if the two cards use different drivers, you need to set up the second network interface and edit the /etc/modules.conf file to load the proper driver for the second card. If the two cards use the same dri- ver, you may need to recompile your kernel, but several modules now allow for multiple cards. It may be that you just need to use boot arguments, such as: boot: linux ether=11,0x300,eth0 ether=5,0x340,eth1 This option can be made permanent so that you do not have to reenter it every time your system boots. See the GRUB configuration option append= in the grub.conf man page. The Ethernet HOWTO is an excellent source of information for configuring multiple Ethernet cards in the same system. It can be found at.redhat.com/mirrors/LDP/HOWTO/Ethernet-HOWTO.html. Solving NFS Problems In addition to performance degradation, you might encounter other problems with NFS that require resolution. This section discusses some of the typical dif- ficulties system administrators have with NFS and how to resolve them. These tips are only a starting point. NOTE The Linux NFS-HOWTO on the NFS Web page at http://nfs. sourcefource.net/nfs-howto/ dedicates an entire section to troubleshooting NFS. First up are apparent problems that, in reality, are red herrings. Log mes- sages resembling the following are annoying but harmless: kernel: fh_verify: bubba/users: permission failure, acc=4, error=13 kernel: nfs: server localhost not responding, still trying kernel: nfs: task 18273 can’t get a request slot kernel: nfs: localhost OK nfslock: rpc.lockd startup failed kmem_create: forcing word size alignment - nfs_fh The first message occurs when the NFS setattr() RPC call fails because an NFS client is attempting to access a file to which it does not have access. This message is harmless, but many such log entries might indicate a system- atic attempt to compromise the system. The next three messages represent client attempts to contact the NFS server that are timing out. When such timeouts occur, the NFS client reduces the 896 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 896 number of concurrent requests it sends to avoid overloading the server, which results in these messages. Although such messages are usually harmless, if they persist, you might want to investigate possible saturation of the network or the NFS server. The rpc.lockd startup failure message almost always occurs when older NFS startup scripts try to start newer versions of rpc.lockd manually; these attempts fail because the kernel NFS server daemon, knfsd, starts the locking daemon automatically. To make the failure message go away, edit the startup scripts and remove statements that attempt to start lockd manually. The final error message occurs if the kernel detects that an NFS file handle is 16 bits, rather than 32 bits or a multiple thereof. Would that all error messages were as harmless as these! A log message resembling the following, while not dire, demands timely attention: nfs warning: mount version older than kernel This message means exactly what it says: the version of the mount com- mand that you are using is older than the kernel version. So, the solution is to upgrade the mount package so mount can recognize any additional options or features of the new kernel. If you transfer very large files via NFS, and NFS eats all of the available CPU cycles, causing the server to respond at a glacial pace, you are probably running an older version of the kernel that has problems with the fsync() system call that accumulates disk syncs before flushing the buffers. This issue, primarily a problem with 2.2 kernels and early 2.4 kernels, is reportedly fixed in newer 2.4 kernel releases, so upgrading your kernel might solve the problem. Similarly, if you execute commands on an NFS exported file system that do not result in large data transfers from server to client (such as an ls command) and have no problem, but then nevertheless cause severe response problems with large data transfers (such as a cp command), you may be using rsize= or wsize= parameters on the client that are larger than the rsize= or wsize= parameters on the server. Reduce these values on the client side to see if perfor- mance recovers. Also make sure that the firewall for the client and the server permits fragmented packets to pass through. NFS uses packet fragmentation, so firewalls that deny or drop fragmented packets force constant retransmission of data. Reportedly, this is especially a problem on Linux systems still using the 2.2 packet filter, ipchains. Either switch to iptables or rewrite the ipchains filters to accept fragmented packets; performance should improve almost immediately. If you are unable to see files on a mounted file system, check the following items: 1. Make sure that the file system is, in fact, mounted. If the file system is not mounted, mount it. Use one of the following commands to verify that the file system is mounted: Troubleshooting and Problem Solving 897 44_599496 ch35.qxd 8/30/05 7:17 PM Page 897 # cat /proc/mounts # mount -f 2. If the file system is mounted, make sure that another file system is not mounted on top of it. If you have layered a file system on top of an export, unmount and remount both, making sure to mount them on separate mount points. 3. Make sure the client has read privileges to the specified files by verify- ing the file system permissions on the server, the client’s mount point, and that the mount options in /etc/fstab or specified on the com- mand line are correct on the client. If you cannot mount an exported directory, the most common error mes- sage is: mount failed, reason given by server: Permission denied This error message means that the server thinks the client does not have access to the specified export. In this case, do one or more of the following: ■■ Review the export specifications in /etc/exports on the server, mak- ing sure that they are correct and that the client is mounting the export the same way it is exported. For example, an NFS client cannot mount an exported directory read/write (the -o rw option to the mount com- mand) if that directory is exported from the server read-only (using the -o ro option to the mount command). ■■ On the server, execute the following command: # exportfs -ar This command makes sure that any changes made to /etc/exports since the exports were first exported are updated in the server’s exports table and propagated out to NFS clients. Look at the contents of /var/lib/nfs/xtab to review the complete list of all of the export options applied to a given export. If they are incorrect, edit /etc/exports accordingly and then rerun the exportfs -ar command to update the server’s export table with the proper options. Exploring Miscellaneous Problems The tips suggested in this section address some problems and challenges you might face when booting your system, installing on a laptop, and using the X Window system with Fedora Core and Red Hat Enterprise Linux. 898 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 898 Solving Boot Problems If you try to shut down or reboot your Red Hat system using the commands reboot, halt, shutdown -r now, or shutdown -h now and the shutdown process starts to execute correctly but then the display blanks and the system hangs, the only way to recover is to power cycle the system and then try some of the following workarounds. The problem is that at the point the system appears to hang, control of the hardware has been handed back from Linux to the firmware — it is up to the firmware (software embedded in key system hardware components) to reboot the system correctly. Fortunately, Linux enables you to select multiple ways to reboot the system to fix, or at least side- step, buggy or broken BIOSes or hardware. At the GRUB: boot prompt, you can specify: reboot=X,Y X can be one of hard or bios. ■■ hard — Uses the CPU’s reset instruction to restart the system. ■■ bios — Uses a BIOS routine (sometimes called a BIOS vector) to restart the system. Y can be one of warm or cold. ■■ warm —Awarm boot is the type of reboot invoked when you press Ctrl+Alt+Delete. ■■ cold —Acold boot is the type of boot invoked by power cycling the system. So if you boot with the following command, Linux reboots by the BIOS vec- tor with a warm reboot: boot: linux reboot=bios,warm The goal is to find the right combination of X and Y that triggers the bugs in the system BIOS. Once you have found this magic sequence, use GRUB’s append= option to pass these parameters to the kernel each time you boot the system by adding it to /etc/grub.conf as shown in the following example: append=”reboot=bios,warm” If your system installed without incident until it tried to write GRUB infor- mation to the master boot record (MBR), at which point the installer com- plained that it could not write to the MBR, the MBR may be locked by the BIOS. You need to access your system’s BIOS and verify that the MBR is not Troubleshooting and Problem Solving 899 44_599496 ch35.qxd 8/30/05 7:17 PM Page 899 write-protected. Similarly, disable any virus scan enabled in the BIOS that may interfere with writing to the MBR. ht://Dig Won’t Run If you start the rundig program to create ht://Dig’s databases and search indexes, you might see the following error, or one that closely resembles it: # /usr/bin/rundig /usr/bin/rundig: line 101: 21924 Segmentation fault /usr/bin/htfuzzy $verb ose metaphone /usr/bin/rundig: line 102: 21925 Segmentation fault /usr/bin/htfuzzy $verb ose soundex This error occurs if the file /var/www/html/index.html does not exist, even if the directory /var/www/html contains other content. The workaround is to create an index file. At a bare minimum, you can create an empty index.html using the touch command: # touch /var/www/html/index.html The rundig command will then execute properly. Starting cyrus-imapd If you see the following message when you start cyrus-imapd, neither the problem nor the solution actually has anything to do with the mail server, despite what the error message says: # service cyrus-imapd start Starting cyrus-imapd: preparing databases error! [FAILED] The problem occurs because cyrus-imapd converts a binary file, /var/lib /imap/mailboxes.db, to a flat file when it starts. The log file that tells you what happened is /var/lib/imap/rpm/cvt_cyrusdb_all.log: you are using /var/lib/imap/sieve as your sieve directory. fatal error: can’t open old database Converting from /var/lib/imap/mailboxes.db (berkeley) to /var/lib/imap/mailboxes.db.flat (flat) ERROR: unable to convert /var/lib/imap/mailboxes.db from berkeley to flat fatal error: can’t open old database The issue, it turns out, is that the database conversion uses the file utility to determine the file type of the mailboxes.db file. Unfortunately, the file utility incorrectly classifies mailboxes.db as an Apple QuickTime movie! 900 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 900 # file /var/lib/imap/mailboxes.db /var/lib/imap/mailboxes.db: Apple QuickTime movie (modified) file misidentifies mailboxes.db because file’s own database file, /usr/share/file/magic.mgc, has an invalid entry. The good news is that you can easily fix this problem by editing /usr/share/file/magic. The procedure is simple: 1. Edit /usr/share/file/magic, moving the line (near line 6461) that reads: 0 string \241\002\213\015skiplist\ file\0\0\0 Cyrus skiplist DB above the line that reads (near line 819): # Apple Quicktime and ISO types 2. Execute the command file -C to update the binary magic.mgc file that the file command uses: # cd /usr/share/file # file -C # file /var/lib/imap/mailboxes.db /var/lib/imap/mailboxes.db: Cyrus skiplist DB After you have made this change, the cyrus-imapd service should start. As a convenience, you can use the patch file magic,patch and the following patch command to update the magic file without having to edit it manually: # patch -d /usr/share/file < magic.patch patching file magic Whether you use the patch file or edit /usr/share/file/magic manu- ally, you must execute the file -C command (and do so in /usr/share /file) to update the magic.mgc file or the change won’t take effect. For more information about this bug, see https://bugzilla.redhat.com /bugzilla/show_bug.cgi?id=148808. Solving Laptop Video Problems Laptop installations are typically the most difficult type of installation to per- form because the companies that build laptop computers often use proprietary hardware or modify standard PC components to shoehorn desktop PC func- tionality into the confines of a laptop or to meet weight, power, or functional- ity requirements. Aggravating such practical concerns, to protect trade secrets, these engineering decisions are rarely publicly documented. As a result, you often have to use a trial-and-error method and rely on the experiences of others. Troubleshooting and Problem Solving 901 44_599496 ch35.qxd 8/30/05 7:17 PM Page 901 NOTE A few laptop manufacturers actively support Linux. IBM, for example, preinstalls Linux on a select group of laptop computers, and certain dedicated Linux hardware vendors do the same. The lack of support is frustrating, but until manufacturers can be bothered to develop Linux drivers for their products at the same time as they develop Windows drivers, installing Linux on a laptop computer will continue to be a challenge. A good soource of information about running Linux on laptops can be found at linux-laptop.net. While attempting a graphical Red Hat Linux installation from either the CD-ROM or a floppy disk, you may see the laptop screen go blank and you can- not continue. In this case, attempting a text-based installation might work — trying to force a graphical installation rarely works if the installer cannot use your video hardware. With some laptops, the graphical installer might work if you type the following parameter at the boot: prompt: boot: linux vga=2 Similarly, you can try all of the possible VGA modes using the following parameter: boot: linux vga=ask Before giving up completely, have a look at the authoritative reference for Linux and laptops, the Linux Laptop Web site at linux-on-laptops.com. The Signal 7 and Signal 11 Problems Perhaps the most confusing problem people run into when installing Red Hat Enterprise Linux is an error message resembling fatal signal 11 or fatal signal 7. Signal 11s and signal 7s are errors indicating a hardware problem in memory or on the system’s data bus. Red Hat Linux does not cause such errors. Rather, it brings such problems to light because the Linux kernel typi- cally pushes hardware to the fullest extent of its capabilities, much more so than DOS or Windows, often revealing substandard hardware. How should you proceed? The first thing to do is perform memory testing using memtest86, which is included on the Red Hat installation boot disk. Instructions for using memtest86 on the boot disk are included in the release notes. If memtest86 indicates hardware trouble, take your computer to a repair shop and ask them to test the RAM and, possibly, the CPU cache, on a hard- ware tester. Meanwhile, check to see whether you have the latest installation image from Red Hat. If the latest image still fails, the problem may be hardware-related. Common suspects include bad RAM chips or defective CPU cache memory. Try turning off the CPU cache in the BIOS and see if the problem goes away. 902 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 902 Likewise, try swapping memory around in the system’s memory slots to see whether the error is slot or memory related. If that does not solve the problem, the Signal 11 Web site, http://www.bitwizard.nl/sig11, may be able to help you. Using Screensavers and Power Management To disable screen blanking, turn off your screen saver. In text mode, the kernel turns on the screen blanker after 15 minutes, but you can disable this using the following command: # setterm -powersave off -blank 0 If you hear disk drives speed up or other sounds, this is most likely APM (Advanced Power Management) starting up the system after idle time. You can disable APM from starting at boot time by logging in as root and typ- ing system-config-services. Deselect APM, exit system-config- services, and reboot the machine. APM is one of the few Red Hat Linux services that requires a system restart to make it take effect; APM is a low-level kernel function, so a full reset is needed. Starting the X Window System What should you do if you run startx and get a black screen? To get out of the black screen mode, try pressing Ctrl+Alt+Backspace. This keystroke combina- tion causes the X server to exit if possible. If it does not work, reboot the system and reconfigure the X Window system using redhat-config-xfree86 after making sure that all your video hardware is compatible. You may want or need to obtain the latest version of XFree86 from redhat.com/support/errata. Upgrading X is fairly simple, but an upgrade HOWTO is available at the Red Hat Web site at redhat.com/support/docs/howto/XFree86-upgrade /XFree86-upgrade.html. If you get an error message resembling errno 111 when you run startx, an X client (any X program except the X server itself running on your XFree86 X system, such as terminal window or even the window manager) tried to con- nect to the X server but failed to do so for some reason. Unfortunately, you ordinarily see only the last few lines of the error message. To see the complete message, execute the following command: $ X -probeonly >& startx.out This command creates a file named startx.out that contains the complete error message. Review the text of the error message carefully for clues con- cerning the real problem that X is having. Troubleshooting and Problem Solving 903 44_599496 ch35.qxd 8/30/05 7:17 PM Page 903 [...]... filename beginning with b or c $ ls [b-d,f]? cp dd df cut Bash Shell Scripting Table A-1 Examples of Sets SET EXPLANATION [b-f] Denotes any characters in the set b, c, d, e, f [1- 4,7 -9] Denotes any two numbers, the first of which must be 1, 2, 3, or 4 and the second of which must be 7, 8, or 9 [aeiou] Denotes any character that is a vowel [b,aeiou] Denotes any character that is either b or a vowel [aeiou][a-z]... encountered problems installing, configuring, and using Fedora Core and Red Hat Enterprise Linux You first read about how to solve installation problems, such as not being able to mount a CD-ROM after the postinstallation reboot Next, you learned how to work around problems accessing files and using Windows file systems After you explored ways to resolve difficulties getting online using a modem, you... uppercase characters, but this is only a convention, and one not universally followed For purposes of discussion, this section examines user-defined variables, predefined variables, and positional variables 909 910 Appendix A N OT E If you read the Bash manual page, it might seem that the discussion of variables contradicts the manual page, which treats variables as “parameters that have names.” The... named positional parameters, Bash recognizes three special ones, $ #, $ @, and $* $# is the number of positional parameters passed to the script, not counting $0 $* contains a list of all the positional parameters passed to a script, except $ 0, formatted as a string Each parameter is separated from the others by the first character of $IFS, the internal field separator $ @, finally, is a list of all of the... commonly used in shell scripts, and you will see it used throughout this chapter Another commonly used metacharacter is $, used to obtain the value of a variable, as in the command echo $PATH A more readable syntax for command substitution is $( ) This syntax works just like back quotes, with the interesting exception that $( ), unlike ` `, can be nested So, for example, the following commands are exactly... defining a set is [set ], where [ and ] delimit the range and set lists the alphanumeric characters making up the range The range can be inclusive, disjoint, discrete, or a combination of all three An inclusive set includes all the characters in the set and is defined using a hyphen, for example, [b-f] A disjoint set is at least two inclusive ranges separated by a comma (,) , such as [1- 4,7 -0] A discrete set... needs The discussion assumes that you are comfortable using Bash as an end user and concentrates on Bash features from a shell programmer’s perspective As a programming language, Bash has all the features one would expect: wildcards, variables, operators, functions, and input and output capabilities Although Bash’s programming support is not as complete, fully featured, or powerful as traditional programming... parameters stored as separate strings delimited by weak quotes Bash Shell Scripting Using Bash Operators In a programming context, operators are tokens that perform some sort of operation or manipulation For example, many programming languages use the plus sign, +, to indicate addition and the asterisk, *, to indicate multiplication Bash operators behave similarly They fall into several categories, including... operators When comparing strings, keep in mind that A–Z come before a–z in the ASCII character set, so A is “less than” a and foo is “greater than” bar T I P If you are not familiar with the ASCII sort order, Fedora Core and RHEL systems include a manual page (man ascii) that defines the ASCII character set Listings A-3 and A- 4, strcmp.sh and numcmp.sh, respectively, illustrate the use of the string... Otherwise, processing continues with the for loop The for loop processes each file in the directory For each file, the script first tests whether it is a regular file using the -f operator If it is not, it skips to the Bash Shell Scripting next file Otherwise, filetest.sh tests whether the user executing the script has read, write, and execute permission on the file (using the -r, -w, and -x operators, respectively), . for your system s DNS server(s). Make sure that the val- ues are correct. If you are using Red Hat Linux on a system attached to a net- work without a DNS server, or if your Red Hat system is. file system, check the following items: 1. Make sure that the file system is, in fact, mounted. If the file system is not mounted, mount it. Use one of the following commands to verify that the. any two numbers, the first of which must be 1, 2, 3, or 4 and the second of which must be 7, 8, or 9 [aeiou] Denotes any character that is a vowel [b,aeiou] Denotes any character that is either

Ngày đăng: 07/07/2014, 09:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan