A brief analysis on troubleshooting of Linux system

Source: Internet
Author: User
Tags system log file permissions


Ideas for dealing with Linux system failures:
1. Pay attention to the error message.
2. Review the log file. Message (System log) service log error (Application log)
3. Analysis, positioning problems.
4. Solve the problem.
Forgot root password?
Reset: CENTOS5 or 6 when booting the Grub boot menu, press ESC to locate the current system boot option.
Press the arrow keys to find the desired system boot kernel and press "E" to enter the editing state.
Then select the line with the kernel directive by the arrow key to continue pressing "e" after adding ' single ' at the end of the row price space to complete
Press ENTER to enter the previous level menu. Then press "B". Enter single user mode, passwd enter the same password 2 times.
Then reboot the system (reboot or Init 3)
Reset the password under CENTOS7:
Also enter kernel line end add init=/bin/sh
Ctrl +X starts the shell boot and enters single-user mode.
Mount Root partition:
Mount-o REMOUNT,RW/
If the system is turned on, SELinux needs to create a Autorelabel file (Touch/.autorelabel) on the root partition
passwd Enter the same password 2 times
Restart: exec/sbin/init
Linux won't start?
Rescue mode to start the system.
Analog failure: Modify/etc/fstab # \mv/etc/fstab/etc/fstab.bak
Boot system: Error occurred;
Starting system Logger:can ' t open or create/var/run/syslogd.pid. Can ' t write pid.
Workaround: Put the system disk in the optical drive. Reboot boot with system disk.
Enter Repair mode: Rescue installed system
Boot into the shell and eventually enter the bash-4.1# command prompt:
can see the system partition condition: # fdisk-l
To view the location of the root partition: Tune2fs-l/dev/sda2 | More
(/dev/sda2 This parameter is based on the specific partition situation to find/directory because fstab in the root directory)
Mount the root partition after locating the root partition. Then refactor the Fstab file
Restart the system. See if Read fstab succeeded.
File system is compromised (typically a power outage occurs when reading and writing frequently.) Easy to cause file system errors)
How to view the file decency type:
1. File-s/dev/sda2
2. Mount
3. Df-t/dev/sda2
4. More/etc/fstab
If the system cannot be repaired, it needs to be repaired manually:
1. Unmount the partition Umount
2. Repair Fsck.ext4-y/dev/sda5
Linxu network problems?
1. Network hardware exceptions. (Network cable, network card, router, switch)
2. Check that the network card is working correctly (NIC profile is correct)
3. Check DNS settings/etc/resolv.conf/etc/hosts (Domain name resolution service conflict)
4. The service is open normally. You can see whether the service is working by using Telnet or the netstat command.
5. Whether access rights are turned on, from native Iptalbes firewall, the Linux kernel enforces access control policy SELinux.
6. If the connection between LAN hosts is normal, you can ping your own IP. Ping LAN other host ip,ping Gateway
The address determines that the LAN connection is normal.
View network routing information. Dynamic monitoring:
MTR Domain name or IP
Traceroute Domain name or IP
Check if the service is working: for example, the SSHD service:
# telnet 192.168.1.123 22
(After successfully entering Telnet.) How do I exit? CTRL +] Enter telnet> quit quit
Check that the LAN hosts are online properly:
Ping IP | Telnet IP Port
Error Resolution: When operating the file system generally. For example, when executing mkdir: "Read-only file System"
This may be caused by inconsistencies in file system data blocks, or by disk failures.
For simple errors, the file system is generally self-repairing, when the fatal error can not be repaired, the file system in order to ensure data consistency and security, will temporarily block the file system write operation, the file system becomes read-only, and then the above "Read-only file systems" phenomenon.
FIX: The fsck command fixes
Unmount the partition. Umount
You can view the pid:fuser that the file occupies
Execute fsck (fsck automatically recognizes file system types)
File Permissions Issues:
# Su-swa
Su:warning:cannot Change Directory To/home/swa:permission denied
SU:/bin/bash:permission denied
To view permissions under/home/:
# Ls-al
Drwxr-xr-x. 3 root root 4096 Jan 29 04:03.
drw-rw-rw-. Root root 4096 Jan 29 01:41..
DRWX------2 swa swa 4096 Jan 04:03 SWA
Found here. Directory does not have X (Execute permission)
# chmod 755.. (Modify permissions)
Successfully switched logins.
You can also view permissions through stat
Stat..
File: '. '
size:4096 blocks:8 IO block:4096 Directory
device:802h/2050d inode:1046530 Links:3
Access: (0755/drwxr-xr-x) Uid: (0/root) Gid: (0/root)
access:2017-01-29 04:03:28.585978590 +0800
modify:2017-01-29 04:03:08.505176624 +0800
change:2017-01-29 04:03:08.505176624 +0800

Service startup problem: Unable to start service:
You can view disk space when it is full. Or whether the Innode is full.
The log is written to the service when it is started. If the disk is full, the log file cannot be written. Service cannot start.

This article is from the "Shong Linux Tour" blog, make sure to keep this source http://12042068.blog.51cto.com/12032068/1897993

A brief analysis on troubleshooting of Linux system

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.