Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Software package Fault troubleshooting in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to implement software package troubleshooting in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Package class failures are common in Linux systems, for example, there are no gcc compilation tools installed in the system when you need to compile source package programs, there are unresolved dependencies when installing RPM packages, and the installation path of library files or header files is incorrect. There are many reasons for package class failures. You only need to confirm that the compilation environment is installed and find the required dependent software packages according to the corresponding error messages. Correct the library file or the corresponding header file path.

The following mainly describes the troubleshooting of rpm database corruption and the failure to find the ".so" file.

1. Rpm database is damaged

The failure of rpm database damage is rare, which is generally due to frequent forced shutdown, erroneous deletion of running files, forced replacement of some rpm package files, and so on. After the rpm database is corrupted, it will not function properly when querying or installing the software using the rpm tool.

Eg: simulates a rpm database corruption failure and verifies the error message.

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

Ps: the httpd package of this system has been installed!

Eg: clear corrupted rpm data files and rebuild database information.

Look at the picture and prompt it!

2. Missing * .so files

When installing the software package through source code compilation, the executable files, function libraries, configuration files, etc. of the program will generally be installed by default to the corresponding location under the "/ usr/local'" directory (provided that your program is installed under "/ usr/local", such as / usr/local/mysql/bin, / usr/local/mysql/lib, etc.), in order to distinguish it from the relevant directory of the system program.

* .so files are library files just like .dll files in Windows systems. The normal installation and operation of a program requires the support of specific library files. Because directories like "/ usr/local/mysql/lib" are not included in the default library file path of the Linux system, if you need to use the dynamic link library files in these directories when installing other software packages, you will not be able to find them, resulting in an error message that the ".so" file is missing.

On RHEL5 systems, the configuration file "/ etc/ld.so.conf" records the default search path for dynamic link libraries. When you need to add a new library file search path, you must make corresponding changes in the file, and execute the "ldconfig" command after the modification to re-read the new configuration information.

Eg: add the / usr/local/mysql/lib/mysql' directory to the system's library file search path.

Vi / etc/ld.so.conf / / add a line of records at the end of the file

/ usr/local/mysql/lib/mysql

Ldconfig

When installing a new application, if you are prompted that the ".so" file is missing, you should first use the find command to find out whether the corresponding file exists on the system. If it does not exist, it means that the dependent software that provides the link library is not installed, and you need to obtain the corresponding software package and install it first. If the corresponding ".so" file already exists in the system, the problem of library file search can be solved by modifying the ld.so.conf file mentioned above.

3. Repair the file system

Linux hosts often cause damage to the file system due to abnormal shutdown, sudden power outage, abnormal reading and writing of device data, and so on. The more common is super-block corruption, which is the core "file" of the file system, which records the type, size, free disk blocks and other information of the file system. When the super block data of a file system is corrupted, Linux will not recognize the file system and will not be able to mount it.

When there is an error in the file system loaded automatically through the "/ etc/fstab" configuration file, the Linux system will detect it automatically when it is powered on and prompt the user to repair the file system. For example, when an error occurs in the super block of the "/ dev/sdb1" partition, the system will prompt "Give root password for maintenance" after boot.

At this point, you only need to enter the password of the root user to enter a temporary Shell environment, where the user can fix the wrong file system. To fix general file system errors, you can use the fsck command, specify the file system type with the "- t" option, and select "yes" to automatically answer the found questions with "- y". It is important to note that if the file system is severely damaged, some data may still be lost after repair, so decide carefully whether to repair it or not.

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

Fsck-yt ext3 / dev/sdb1

Exit / / restarts automatically after exiting the temporary Shell environment.

4. Disk data exhaustion failure

Obviously, when the disk space of a file system is exhausted, it is impossible to continue to create new file data in the partition, which leads to failures, for example, when the disk space in the root partition "/" is exhausted, it may cause some programs and even the whole system to fail to start or proceed normally, because some temporary running files will not be able to be created.

When the root partition does not have enough disk space to boot into the Linux system, you can enter the first aid mode through the RHEL5 CD to transfer or clear the files that take up a lot of space in the root partition. The process is no longer described.

In addition, when the ext3 file system, I node as the file index node, determines the storage location of the file data on the disk. When a file system is created, the number of I nodes is fixed, so the number of files that can be used in the file system is fixed. This can happen if the user creates a large number of small files in the partition (running out of I nodes); although there is still a lot of disk space left in the partition, the user can no longer create new files.

4.1. Simulate I node exhaustion failure

Eg:1, take a 20m ext3 file system as an example ("/ dev/sdb2") and mount it to the "/ data" directory. And use the df command with the "- I" option to confirm the usage of the I node of the partition.

Write a script that loops to create an empty file and runs the script until it runs out of I nodes in the sdb2 partition.

4.3. after the I node is exhausted, when you create a new file again, there will be an error message that "there is no space on the device", but you can use the df command to see that there is still available space in the partition, but the number of I nodes has been used up.

4.4. Fix I node exhaustion failure

After understanding the root knot of I node exhaustion failure, the problem is better, as long as you find the small files in the partition that occupy a large number of I nodes, and transfer or delete them.

Rm-rf `find / data-empty-a-type f`

5. Cannot uninstall the mounted device

In Linux systems, when uninstalling devices such as optical drives through the umount command, sometimes the message "device is busy" appears and cannot be uninstalled. This means that "the device is busy", probably due to the data that the user or other program is using the device, and the system will prohibit the direct uninstallation of the device for protective reasons.

Eg: when the user's current feature path is in the directory on the CD, the CD device cannot be uninstalled.

Because the umount command does not tell which user or program is using the resources in the device, it is difficult to locate the process that is using this directory when there are a large number of logged-in users and the process structure is complex. Using the fuser command can help solve this problem

Fuser commands users to find out about users, programs, and so on, who are using a device or file / directory. The "- m" option allows you to specify the appropriate file or directory, and the "- v" option displays details. If you use the "- k" option, you can also force the shutdown of a process that is using the file or directory (of course, you can also use the kill command to terminate the process. )

Eg: view information about users, processes, and so on who are using the "/ media" directory, and then close the processes that are using it.

6. Detect the bad track of the hard disk

Disk bad tracks are divided into logical bad tracks and physical bad tracks, the former is mainly caused by improper software operation and can be repaired by software, while the latter is physical damage, which can only be improved by changing the location of disk partitions or sectors, excluding disk space containing bad blocks. When there is a phenomenon on the disk, it is possible that the disk has a bad track, which needs to be detected and repaired.

>: the disk device makes an abnormal noise when reading the data in the disk.

>: when accessing a file on disk, it is read repeatedly and error occurs, indicating that the file is corrupted.

>: the formatting cannot be completed for the newly created partition.

>: the system crashes frequently when using this disk.

After the occurrence of bad channels in the hard disk, if the hard disk is not replaced or the technology is carried out in time, there will be more and more bad channels, which may cause frequent crashes and data loss. All disks should be checked periodically if necessary to see if there are any bad tracks.

In a Linux system, the badblocks command can be used to detect the bad path of the disk, and it can also be detected with the option of the mkfs command during the creation of the file system. When using the badblocks command, the user of the "- s" option displays progress information, and the "- v" option is used to display details.

Eg: use the mkfs command to format the "/ dev/sdb2" partition and process bad block detection with the "- c" option.

Eg: use the badblocks command to detect whether there are bad blocks in the "/ dev/sdb2" partition.

This is the end of the article on "how to implement package troubleshooting in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report