In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly analyzes the relevant knowledge points of how to start the Linux system and login troubleshooting, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "how to start the Linux system and log in to troubleshoot".
System boot exception:
1. Some centos starts with black screen and no abnormal error is reported. You can fsck the system disk.
2, root partition space is full and inode is exhausted
3. Startup exception caused by upgrading kernel or migrating from old shared instance to exclusive specification
3.1Manual injection driver (mkinitrd virtio related driver)
3.2 modify the boot sequence of grub and give priority to trying to boot using the old kernel
3.3 whether the associated files of the kernel under the boot directory are complete (the following is only demo, the files of different kernel versions are different, and the i386 directory under some kernel versions of boot is also useful)
Config-4.9.0-7-amd64 initrd.img-4.9.0-7-amd64 System.map-4.9.0-7-amd64 vmlinuz-4.9.0-7-amd64
3.4The hda in boot/grub/device.map is changed to vda
4the uuid in grub is wrong. You can change it directly to / dev/vda1.
If the data disk partition is abnormal and cannot be loaded, you can comment on all the lines of ftab and add a startup item similar to the following attempt. It is also applicable to the startup exception caused by uuid consistency after you create a cloud disk mount with a snapshot of the system disk. Change it to a non-UUID mount.
/ dev/vda1 / ext4 defaults 1 1
5, root directory 777 (partial directory 777) will also cause startup exception, or ssh login exception
6. Common key directories are missing, some are soft chains, and you can also take a look at the number of files under the corresponding directory (the number of files should be compared with the same kernel version or similar version), and make a simple judgment.
/ bin / sbin / lib / lib32 / lib64 / etc / boot / usr/bin / usr/sbin / usr/lib / usr/lib64 or other directories or files missing for i in / bin / sbin / lib / lib32 / lib64 / etc / boot / usr/bin / usr/sbin / usr/lib / usr/lib64; do ls-l $I | wc-l; done
7. Parameters that affect startup
If the parameters are not set properly, it will lead to startup exceptions, such as / etc/sysctl.conf and checking the configuration of rc.local and profile.
Vm.nr_hugepages vm.min_free_kbytes
8centos needs selinux needs to be closed, let's go
# cat / etc/selinux/config # This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing-SELinux security policy is enforced.# permissive-SELinux prints warnings instead of enforcing.# disabled-No SELinux policy is loaded.SELINUX=disabled change this line to disabled# SELINUXTYPE= can take one of three values:# targeted-Targeted processes are protected,# minimum-Modification of targeted policy. Only selected processes are protected.# mls-Multi Level Security protection.SELINUXTYPE=targeted actual combat case 1-grub repair
Background information: / boot/grub/grub.conf is emptied by misoperation, and the system starts to enter grub state (centos 6.8)
1,find / boot/grub/stage1
Show as (hd0,0)
2. Confirm the specific version of the kernel ls-l / boot to see
3. Set grub manually. Specific steps
Grub > root (hd0,0) # means that the first partition with the partition on the first hard disk is actually the file that comes out of the previous find
Grub > kernel / boot/vmlinuz-2.6.32-696.3.2.el6.x86_64 ro root=/dev/vda1 # indicates the kernel path and root partition, note that ro is read-only
Grub > initrd / boot/initramfs-2.6.32-696.3.2.el6.x86_64.img # indicates the initramfs path to start the system load driver
Grub > boot # start the system specified above. If it is reboot, you will restart the whole system. The previous setting will be invalid.
If no error is reported, it can be started successfully. After entering the system, you need to continue to perform the following operations.
4Magnetic mount-e remount,rw / remount partition for read and write
5,service network restart
If you prompt that eth0 eth2 failed and ifconfig cannot see the network card
6 grep net lsmod
Check to see if there is a virtio_net driver, if not (there will be no network card error report)
seven,
Insmod / lib/modules/2.6.32-696.3.2.el6.x86_64/kernel/drivers/net/virtio_net.ko
8, restart the network service, hi ~ Netcom
9. Log in to ssh, find a grub.conf of the same version of the system, and make a copy, otherwise you will enter grub again after reboot.
Practical case 2-exception handling of missing files
Background information: the customer feedback system can not log in remotely, and there is a problem with the actual system startup itself.
According to the error message, there is a problem with reading user in the system, which needs to be checked on disk.
1. After mounting the disk, the chroot is as follows: ihave no name. There is a problem here, indicating what files are missing in the system that cause the exception.
2. Chroot tracking the process and looking at the missing files.
Strace-F-ff-t-tt-s 256-o ch.out chroot / mntgrep-I "no such" ch.out.pid | grep "so"
3. Check the relationship of the corresponding files (test machine complement)
4. Confirm that the final libnss_files-2.12.so is missing on the system and try to copy one.
Ifconfig eth2 ip netmask maskroute add default gw gwip
Now that you can surf the Internet, try copying a file of the same version.
Root login exception class:
1MagneActionActionPasswd / etc/shadow (user name root polikt dbus and other key users exist or not, the file is empty, the format is disordered (dos2unix)
2whether there are empty files in the pam.d directory and whether the parameter settings are normal, such as the common system-auth passwd
3 so files involved in all the files under pam.d to see if the files exist and whether they are empty / usr/lib64/security
4. Check / etc / lib64 / bin / sbin / usr/bin / usr/sbin and other directories to see if there are any files with size 0
5 whether the files related to login environment settings, such as etc/profile.d / etc/profile.d (print list) / etc/bashrc / root/.bash_profile / root/.bashrc, are abnormal
6. Pay attention to the kernel version, whether there are new and old kernels, and replace a few more kernels.
7. The system log is also an important check item (how to check if you can't log in later)
9futher ubuntu 1204 login exception caused by incorrect ERASECHAR configuration in / etc/login.defs, you can restore the default 0177.
Configuration error-cannot parse erasechar value
10. Direct login failed three times after entering root. The log is as follows.
Compare it with the kernel version of the machine and find that / etc/pam.d/login has a login.defs.
Check the rpm package, confirm that the login is gone, create one manually and copy the content over. All right.
[root@iZbp1cabe6lyx26ikmjie2Z pam.d] # rpm-V util-linuxmissing c / etc/pam.d/login [root@iZbp1cabe6lyx26ikmjie2Z pam.d] # rpm-ql util-linux | egrep-vi "gz | mo | share" / etc/mtab/etc/pam.d/chfn/etc/pam.d/chsh/etc/pam.d/login/etc/pam.d/runuser/etc/pam.d/runuser-l/etc/pam.d/su/etc/pam.d/su-l
12Jet _ xetcamp _ SSHD _ pound _ config related parameters such as LoginGraceTime/Allowusers/PermitRootLogin
13. When the problem is difficult to confirm, you can clear the shadow password field to see if the login is normal, and you can judge whether it has reached the password verification stage.
The actual combat case 3-ssh can log in to root, but the management terminal cannot log in to root users
Ssh can log in, but the management terminal cannot log in to root.
Prompt login in...
Cat / var/log/secureJun 2 09:26:48 iZbp1begsz1x269nxhtip4Z login: FAILED LOGIN 1 FROM tty1 FOR root, Authentication failure
Look at the log is a problem with the login verification module. Check the settings of the relevant modules.
# cat / etc/pam.d/login #% PAM-1.0auth required pam_succeed_if.so user! = root quietauth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.soauth substack system-authauth include postloginaccount required pam_nologin.soaccount include system-authpassword include system-auth# pam_selinux.so close should be the first session rulesession required pam_selinux.so closesession required pam_loginuid.sosession optional pam_ Console.so# pam_selinux.so open should only be followed by sessions to be executed in the user contextsession required pam_selinux.so opensession required pam_namespace.sosession optional pam_keyinit.so force revokesession include system-authsession include postlogin-session optional pam_ck_connector.so
This is a crucial line of business.
Auth required pam_succeed_if.so user! = root quiet
Local login is prohibited, just comment it out.
Actual combat case 4-centos login "stuck"
Background: login is stuck. You need ctrl + c to enter, as shown in the figure.
If you keep waiting, you will be prompted.
Reason:
/ etc/profile contains source / etc/profile that causes an endless loop. Comment is fine.
The system can not log in, how to operate without hanging the disk?
Ariyun's new uninstall system disk function uninstalls the system disk and mounts it to a new machine as a data disk, so that the above check can be performed.
For more information, please see: uninstall and mount the system disk on CVM ECS
Scene coverage:
The Linux system FAQ diagnostics service covers the following scenarios:
The repair of common startup problems in Linux systems covers the following scenarios:
About "how to start the Linux system and login troubleshooting" is introduced here, more related content can be searched for previous articles, hope to help you answer questions, please support the website!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.