linux运维服务常见故障,linux常见故障处理⽬录
⼀. ⽂件和⽬录类
1.1 File exist ⽂件已经存在
1.2 No such file or directory 没有这个⽂件或⽬录(这个东西不存在)
1.3 command not found 命令不到(没有这个命令)
1.4 invalid option ⽆效的参数(不可⽤的参数)
1.5 overwrite 覆盖
1.6 remove regular empty file 是否删除普通⽂件(空的)
1.7 is a directory xxx是⼀个⽬录
1.8 descend into directory 是否进⼊⽬录
1.10 Can‘t open file for writing ⽆法打开这个⽂件
1.11 No write since last change
1.12 xx column window is too narrow 窗⼝只有xx列太窄了 ⽆法完全显⽰
⼆. ⽹络连接类
2.1 远程连接错误 Connection Failed 连接失败
2.2 yum安装软件故障提⽰ Could not resolve host⽆法解析主机
2.3 yum安装软件提⽰:Nothing to do (没事做)无法打开文件
2.4 Name or service not known 域名⽆法识别(⽆法上⽹)
三. 修改系统基础配置类
3.1 重启⽹卡报错 device not present
3.2 修改主机名过程中,命令⾏中主机名没有变化
1 hostname命令修改主机名(临时 重启服务器之后失效)
2 修改⽂件内容(写合同 永久 重启服务器之后⽣效)
3 检查
命令⾏中的主机名部分没有改变?
⼀. ⽂件和⽬录类
1.1 File exist ⽂件已经存在
[[email protected] ~]# mkdir /data /lidao
[[email protected] ~]# mkdir /data /lidao
mkdir: cannot create directory ‘/data’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
⽆法 创建 ⽬录 因为这个⽬录已经存在
1.2 No such file or directory 没有这个⽂件或⽬录(这个东西不存在)
没有这个⽬录:⽂件或路径书写错误
[[email protected] ~]# mkdir /oldboy
[[email protected] ~]# cd oldboy
-bash: cd: oldboy: No such file or directory
mkdir命令本⾝问题:mkdir 命令默认只能创建1层⽬录 创建多层报错
-p解决
[[email protected] ~]# mkdir /data/oldboy/lidao/
mkdir: cannot create directory ‘/data/oldboy/lidao/’: No such file or directory touch命令只能创建⽂件,⽬录不存在则会报错
解决:先创建⽬录,再创建⽂件
[[email protected] ~]# ls /oldboy/
<
[[email protected] ~]# touch /oldboy/lidao/
touch: cannot touch ‘/oldboy/lidao/’: No such file or directory 排错思路:
1、ls命令检查对应的⽬录是否存在?
2、⽬录不存在 先创建⽬录在创建⽂件/
1.3 command not found 命令不到(没有这个命令)
[[email protected] ~]# mkdiy
-bash: mkdiy: command not found
1.书写错误
2.没有安装
1.4 invalid option ⽆效的参数(不可⽤的参数)
[[email protected] ~]# touch -p /
touch: invalid option -- 'p'
Try 'touch --help' for more information.
1.5 overwrite 覆盖
cp复制如果已经存在这个⽂件会提⽰是否覆盖
[[email protected] ~]# cp / /tmp/
cp: overwrite ‘/’?
1.6 remove regular empty file 是否删除普通⽂件(空的)
[[email protected] ~]# rm /
rm: remove regular empty file ‘/’?
1.7 is a directory xxx是⼀个⽬录
rm默认⽆法删除⽬录
解决:加上-r 或-rf
[[email protected] ~]# rm /data/
rm: cannot remove ‘/data/’: Is a directory
vi命令中 使⽤vi编辑⽬录也会报错
"/oldboy"
E502: "/oldboy" is a directory
Press ENTER or type command to continue
1.8 descend into directory 是否进⼊⽬录
[[email protected] ~]# rm -r /data/
rm: descend into directory ‘/data/’? y
rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove regular empty file ‘/’? n rm: remove directory ‘/data/’? n
1.9 Invalid level ⽆效的层数,层数必须⼤于0
注意参数位置
[[email protected] ~]# tree -L -F 2 /
tree: Invalid level, must be greater than 0.
1.10 Can‘t open file for writing ⽆法打开这个⽂件
vi中 如果⽬录不存在就会提⽰
"/"
"/" E212: Can't open file for writing Press ENTER or type command to continue
1.11 No write since last change
E37: No write since last change (add ! to override)
粘包赖(你修改了内容就⽆法使⽤:q退出 需要使⽤:q!
1.12 xx column window is too narrow 窗⼝只有xx列太窄了 ⽆法完全显⽰
这是w的坑 空间太⼩施展不开.
[[email protected] ~]# w
w: 39 column window is too narrow
⼆. ⽹络连接类
2.1 远程连接错误 Connection Failed 连接失败
使⽤Xshell远程连接失败提⽰,检查端⼝是否开启或正确
[c:\~]$
Connecting to 10.0.0.
Could not connect to '10.0.0.200' (port 233): Connection failed.
Type `help' to learn how to use Xshell prompt.
使⽤telnet测试端⼝是否打开
[c:\~]$ telnet 10.0.0.200 233
Connecting to 10.0.0.
Could not connect to '10.0.0.200' (port 233): Connection failed. #233端⼝没有开启Type `help' to learn how to use Xshell prompt.
端⼝开启
[c:\~]$ telnet 10.0.0.200 22
Connecting to 10.0.0.
Connection established. #端⼝开启
To escape to local shell, press 'Ctrl+Alt+]'.
SSH-2.0-OpenSSH_7.4
Protocol mismatch.
Connection closed by foreign host.
Disconnected from remote host(10.0.0.200:22) at 12:22:54.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
2.2 yum安装软件故障提⽰ Could not resolve host⽆法解析主机
Could not resolve host⽆法解析主机
主要是系统能否上⽹和DNS问题.
"Could not resolve host: mirrors.tuna.tsinghua.edu; Unknown error"
Trying other mirror.
2.3 yum安装软件提⽰:Nothing to do (没事做)
有两种情况:
情况1:软件已经安装并且最新如下:
Package tree-1.6.0-10.el7.x86_64 already installed and latest version
tree软件包已经安装并且是最新版本
Package 2:vim-enhanced-7.4.160-5.el7.x86_64 already installed and latest version Package 1:bash-completion-2.arch already installed and latest version Nothing to do
情况2:软件名字写错或没有配置yum源导致不到这个软件包
[[email protected] ~]# yum install treea -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu
* extras: mirrors.nwsuaf.edu
* updates: mirrors.nwsuaf.edu
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
No package treea available.
#没有到叫treea的软件包
Error: Nothing to do
2.4 Name or service not known 域名⽆法识别(⽆法上⽹)
原因:
1:DNS配置错误原因
2:Linux⽆法上⽹原因
[[email protected] ~]# ping baidu
ping: baidu: Name or service not known
域名⽆法识别(⽆法将域名---->ip地址)
三. 修改系统基础配置类
3.1 重启⽹卡报错 device not present
[[email protected] ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
查看详细错误原因
·journalctl -xe·
发布评论