1. Trang chủ
  2. » Công Nghệ Thông Tin

Red Hat Linux Networking and System Administration Third Edition phần 10 pptx

107 343 0

Đ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

Thông tin cơ bản

Định dạng
Số trang 107
Dung lượng 1,4 MB

Nội dung

Cannot Mount a Partition If you are unable to mount one or more partitions after an upgrade, the prob- lem could be due to the use of partition labels. Red Hat Linux uses partition labels to help prevent problems that occur when moving hard drives around in a system. For example, if / is on /dev/sdb and a new drive is added to the system with a lower SCSI ID, the drive that was previously /dev/sdb becomes /dev/sdc. This change causes the mount command to generate errors when it tries mount /. Partition labels address this problem because mount tries to mount the partition identified by its labels as / instead of trying to mount /dev/sdb1 and expecting it to be /. The idea is great in theory as long as you keep partition labels less than 16 characters. Avoiding File System Checks at Each System Reboot If you constantly have to run fsck each time you boot your system, the most likely suspect is that your partitions are not being unmounted properly when you last shut down the machine. The most important thing you can do is make sure that you are shutting down the machine properly. Shutdown is done through one of two methods: ■■ If you are in text mode — run level 3 — you should log in as root and type the following command: # sync;sync;sync;shutdown -r now ■■ If you are using the graphical login — run level 5 — click Actions ➪ Log Out ➪ Shutdown. Eventually, you see a line that reads Power Down, indicating it is safe to turn off the machine. In either case, if you are running APM or ACPI, Linux tries to stop the machine using the BIOS. Solving Networking Problems There are many possible causes of problems with your network and trou- bleshooting them can be a tough task. But if you follow a systematic procedure as explained earlier in this chapter you can get through it and solve your prob- lem. Some general guidelines to follow for troubleshooting network problems are presented here: 1. Don’t overlook the simple things. For example, if a user calls complain- ing that he cannot log in, be sure that the user is using the proper login procedure with the correct username and password. Does the user have the correct rights assigned for the service? Check the cable connections and look for link and collision lights. Troubleshooting and Problem Solving 891 44_599496 ch35.qxd 8/30/05 7:17 PM Page 891 2. Determine whether the problem is software or hardware related. A hardware problem usually appears when some device stops working. Software problems may give an error message indicating the problem. 3. Does the problem affect one workstation or a group of them? If the problem affects just one user, the problem is most likely at that work- station. If many users are affected, the problem could be at the server. 4. After you have eliminated physical connections as the source of the problem, you can then begin checking workstation and server configu- ration files. If you are unable to access hosts on a network, make sure you have at least one name server listed in /etc/resolv.conf. If an external system cannot con- nect to your system, remember the order in which the hosts.allow and hosts.deny files are read and applied. The program that starts Internet ser- vices consults /etc/hosts.allow first. If TCP wrappers does not find a matching rule, it applies the first matching rule, if any, in /etc/hosts.deny. If neither file contains a match, access is granted. If you performed an upgrade of Red Hat Linux from an earlier version, it may appear that the upgrade did not preserve the contents of your network service configuration files. This is not the case, however. The configuration files were renamed with the extension .rpmsave and can be found in the network ser- vice’s directory. For example, you might find that the old /etc/httpd/conf /httpd.conf file was renamed /etc/httpd/conf/httpd.conf.rpmsave. Changes should be copied to the new version of the configuration file. The fol- lowing list explains the meaning of the saved files. ■■ Files with an .rpmorig extension are configuration files not in an RPM package that was upgraded or installed. ■■ Files with an .rpmsave extension are configuration files that were in an RPM package that was upgraded or installed. ■■ Files with an .rpmnew extension are new versions of files installed by an upgraded package. Affected network services configuration files include, but are not limited to: ■■ /etc/httpd/conf/httpd.conf ■■ /etc/samba/smb.conf ■■ /etc/sendmail.cf ■■ /etc/named.conf ■■ /etc/dhcpd.conf To avoid unfortunate accidents and needless panic or confusion, remember to back up your data before upgrading or installing the latest version of Fedora Core or Red Hat Enterprise Linux. 892 Chapter 35 44_599496 ch35.qxd 8/30/05 7:17 PM Page 892 Getting Online with a Modem If you are having trouble getting your modem to work, first verify that it is sup- ported by checking the Hardware Compatibility List at http://hardware .redhat.com/. CROSS-REFERENCE Refer to Chapter 11 for instructions on using the graphical tool to configure your modem. Next, see if the modem is being detected by the system and make sure that it does not conflict with other resources. You can check this using the following commands: # cat /proc/ioports 0000-001f : dma1 0020-003f : pic1 0040-005f : timer 0060-006f : keyboard 0070-007f : rtc 00a0-00bf : pic2 00c0-00df : dma2 00f0-00ff : fpu 0170-0177 : ide1 01f0-01f7 : ide0 0220-022f : soundblaster 02f8-02ff : serial(auto) 0330-0333 : MPU-401 UART 0376-0376 : ide1 03c0-03df : vga+ 03f6-03f6 : ide0 03f8-03ff : serial(auto) d000-d07f : eth0 d800-d807 : ide0 d808-d80f : ide1 # cat /proc/interrupts CPU0 0: 1296380 XT-PIC timer 1: 30736 XT-PIC keyboard 2: 0 XT-PIC cascade 5: 1 XT-PIC soundblaster 8: 1 XT-PIC rtc 0: 73593 XT-PIC eth0 2: 159669 XT-PIC PS/2 Mouse 3: 1 XT-PIC fpu 4: 246863 XT-PIC ide0 5: 584998 XT-PIC ide1 NMI: 0 Troubleshooting and Problem Solving 893 44_599496 ch35.qxd 8/30/05 7:17 PM Page 893 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 [...]... You should already be familiar with redirecting input and output and using pipes, but you will see examples of all three operations later in the chapter Input and output redirection should be familiar to you Commands in a block, that is, delimited by { and } elicit different behavior from Bash than commands executed in a subshell, that is, commands delimited by ( and ) (You will read about subshells... 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 typing system- config-services Deselect APM, exit system- configservices, and reboot the machine APM is one of the few Red Hat Linux services that... 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... Execute command in background ( Start subshell ) End subshell * Multicharacter wildcard ; Command separator ? Single-character wildcard \ Interpret the next character literally ` Command substitution { Start command block | Pipe } End command block ~ Home directory < Redirect input Redirect output >> Append output The commands between two ` characters cause command substitution (that is,... following: $ /predef.sh PPID = BASH_VERSION = RANDOM = SHELLOPTS = IFS = 9205 3.00.13(1) -release 29852 braceexpand:hashall:interactive-comments:posix HISTSIZE = 100 0 The value of $PPID and $RANDOM will surely vary on your system Bash has another group of predefined variables, positional parameters Positional parameters are variables that contain the arguments, if any, passed to a script on its command line... ways to use if 921 922 Appendix A To make sense of conditional execution, you will find it helpful to understand how Bash uses the test and [ commands and the [[ compound command Yes, [ and [[ are commands, not operators test and [, which are equivalent commands, evaluate conditional expressions and return true or false (zero or nonzero, respectively), depending on how the conditional expression evaluates... 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... techniques for overcoming commonly 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... power management and working through problems starting the X Window system APPENDIX A Bash Shell Scripting IN THIS CHAPTER ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ Using Wildcards and Special Characters Using Variables Using Bash Operators Understanding Flow Control Using Shell Functions Processing Input and Output Working with Command Line Arguments Using Processes and Job Control System administration is... programming languages such as C and C++ or advanced scripting languages such as Perl and Python, Bash is nevertheless surprisingly capable and well suited to the task 905 906 Appendix A Using Wildcards and Special Characters Wildcards are single characters that stand for or substitute for one or more values Bash uses the familiar * and ? as wildcards * stands for one or more characters and ? represents any single . 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. 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. 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

Ngày đăng: 14/08/2014, 12:20

TỪ KHÓA LIÊN QUAN