Troubleshooting of software packages in Linux

Source: Internet
Author: User

Troubleshooting of software packages in Linux

Software Package faults are common in Linux systems. For example, if the gcc compilation tool is not installed in the system when you need to compile the source code package, there are unresolved dependencies when installing the RPM software package, the installation path of library files or header files is incorrect. There are many causes of Software Package faults. Generally, you only need to confirm the installation of the compiling environment according to the corresponding error message, find the required dependent software package and correct the path of the library file or the corresponding header file.

The following describes how to solve the damage to the rpm database and the failure of the ". so" file.

1. the rpm database is damaged.

The rpm database is rarely damaged. The cause of the failure is generally due to frequent forced shutdown, accidental deletion of running files, and forced replacement of some rpm package files. If the rpm database is damaged, it cannot run properly when you use the rpm tool to query or install software.

Eg: Simulate an rpm database corruption fault and verify the error message.

As a software package management mechanism in Linux, RPM maintains an independent file database, which is used to store the installed rpm package information in the system. When the data file is corrupted, you cannot use the rpm command or yum command to query, install, upgrade, or delete the rpm software package. To solve this problem, you only need to execute the "rpm -- rebuilddb" command to recreate the database.

Ps: The httpd package has been installed!

Eg: Clear corrupted rpm data files and recreate database information.

You can see the figure!

2. The *. so class file is missing.

When installing a software package through source code compilation, the executable files, function libraries, and configuration files of the program are usually installed in the "/usr/local' directory by default (If your program is installed in"/usr/local "Oh, for example,/usr/local/mysql/bin,/usr/local/mysql/lib, etc.) to distinguish it from the related directories of the system program.

* The. so file is a library file, just like the. dll file in Windows. The normal installation and running of a program requires the support of specific library files. Because the directory similar to "/usr/local/mysql/lib" is not included in the default library file path of the Linux system, when other software packages are installed, if you need to use the dynamic link library files in these directories, they will not be found, and thus the missing ". so "file error message.

In the RHEL5 system, the configuration file "/etc/ld. so. conf" records the default search path of the dynamic link library. When you need to add a new library file search path, you must modify the path in the file. After the modification, run the "ldconfig" command to read the new configuration information again.

Eg: add the "/usr/local/mysql/lib/mysql" directory to the system library file search path. Vi/etc/ld. so. conf // Add a record at the end of the file/usr/local/mysql/lib/mysqlldconfig

If ". so "file, you should first use the find command to find whether the corresponding file exists in the system. If not, it indicates that the dependent software of The Link Library is not installed, you need to obtain the corresponding software package and install it first. If the corresponding ". so" file already exists in the system, you can solve the library file search problem by modifying the ld. so. conf file.

3. File System Repair

Linux Hosts often cause file system damage due to abnormal shutdown, sudden power failure, and abnormal reading and writing of device data. It is common that the super block is damaged, and the super block is the core "file" of the file system ", it records the type, size, and idle disk block of the file system. When the file system's super block data is corrupted, Linux will not be able to identify the file system and will not be able to mount and use it.

When an error occurs in the file system automatically loaded through the "/etc/fstab" configuration file, the Linux system usually performs automatic detection after it is started and prompts you to perform file system repair, for example, when a super block in the "/dev/sdb1" partition is incorrect, the system prompts "Give root password for maintenance"

In this case, you only need to enter the password of the root user to enter a temporary Shell environment. Here, you can fix the file system that has encountered an error. To fix common file system errors, you can use the fsck command, specify the file system type with the "-t" option, and select "yes" for the detected question in combination with "-y ". Note that, if the file system is seriously damaged, some data may still be lost after the repair is completed. Therefore, Please carefully decide whether to fix it.

Eg: Use the fsck command to fix the ext3 file system located in the "/dev/sdb1" partition.

Fsck-yt ext3/dev/sdb1exit // The system restarts automatically after exiting the temporary Shell environment.

4. Disk Data depletion fault

Obviously, when the disk space of a file system is exhausted, new file data cannot be created in the partition, resulting in failure. For example: when the disk space in the root partition "/" is exhausted, some programs or even the entire system may fail to start or run normally, because some temporary running files cannot be created.

When the root partition disk space is insufficient and cannot start to enter the Linux system, you can use the RHEL5 disc to enter emergency mode, transfer or clear the files that occupy a large amount of space in the root partition. The process is not described.

In addition, when the ext3 file system uses the I node as the file index node, the storage location of the file data in the disk is determined. After a file system is created, the number of I nodes is fixed, and the number of files that can be used in the file system is fixed. If a user creates a large number of small files in the partition (consuming I nodes), this may happen. Although the partition still has a large amount of disk space, however, you cannot create new files.

4.1 simulate I node depletion failure

Example: 1. mount a 20 m ext3 File System ("/dev/sdb2") to the "/data" directory. Run the df command with the "-I" option to check the I node usage of the partition.

4.2 compile a script program that cyclically creates null files, run the script until the I nodes in the sdb2 partition are exhausted.

4.3 When the I node is exhausted and a new file is created again, the error message "no space on the device" appears, however, using the df command, we can see that there is still available space in the partition, but the number of I nodes is used up.

4.4. Fixed the I node depletion fault

After understanding the root cause of the I node depletion failure, the problem will be better. You only need to find the small files that occupy a large number of I nodes in the partition and transfer or delete them.

Rm-rf 'Find/data-empty-a-type F'

5. Unable to uninstall mounted devices

In Linux, when you run the umount command to detach a drive or other devices, a message "device is busy" is displayed, but the device cannot be detached. This indicates that "the device is busy", probably because the user or other programs are using the device's information. The system will prohibit the device from being detached Based on protective considerations.

Eg: when the current function path of the user is in the directory of the CD, the CD device cannot be detached.

6

Because the umount command does not tell the user that the program is using the resources on the device, therefore, it is difficult to locate the processes that are using this directory when the number of users currently logged on is large and the process structure is complex. You can use the fuser command to solve this problem.

The fuser command is used to find information about users and programs that are using a device or file/directory. The "-m" option can be used to specify the corresponding file or directory, and the "-v" option can display details. If you use the "-k" option, you can also force the process that is using the file or directory to close (of course, you can also use the kill command to terminate the process .)

Eg: view the user, process, and other information that is using the "/media" directory, and then close the process that is using the directory.

6. Check hard drive sectors

Disk Bad Sectors are divided into logical and physical bad sectors. The former is mainly caused by improper software operations and can be repaired using software. The latter is physical damage, you can only change the disk partition or the position occupied by the sector to eliminate the disk space that contains bad blocks. When a disk appears, it may be a bad track on the disk and needs to be detected and repaired.

>: When reading data from a disk, the disk device makes an exception.

>: When you access a file on the disk, the file is read repeatedly and an error occurs, prompting that the file is damaged.

>: The newly created partition cannot be formatted.

>: The system frequently crashes when using the disk.

If a bad track occurs on the hard disk, if it is not replaced or technically available in time, the bad track will become more and more, and may cause frequent crashes and data loss. When necessary, the disk should be periodically checked to check whether any bad track exists.

In Linux, The badblocks command can be used to detect the disk's bad sectors. During file system creation, mkfs Command Options can also be used for detection. When the badblocks command is used, the "-s" option displays the progress information, and the "-v" option is used to display details.

Eg: Use the mkfs command to format the "/dev/sdb2" partition and check the process Bad blocks with the "-c" option.

Eg: Use the badblocks command to check whether Bad blocks exist in the "/dev/sdb2" partition.

These are FAQs ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.