Linux 异常问题记录

执行sudo命令时,出现如下错误

sudo: /usr/libexec/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins

原因是/usr文件夹中的文件权限被更改了,重新给相关文件赋予4755的权限,4代表其他用户执行文件时,具有与所有者相同的权限

chown root:root  /usr/bin/sudo  
chmod 4755 /usr/bin/sudo  
chmod 4755 /usr/libexec/sudoers.so
reboot

fatal: remote origin already exists.

git remote rm origin

在使用Git Push代码到数据仓库时,提示如下错误:

[remote rejected] master -> master (branch is currently checked out)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To [email protected]:/var/git.server/.../web
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '[email protected]:/var/git.server/.../web'

这是由于git默认拒绝了push操作,需要进行设置,修改.git/config添加如下代码:

[receive]
denyCurrentBranch = ignore

建议初始化远程库的时候直接使用命令 git --bare init 这样在远程库就不会生成 worktree

ssh 登录内网服务器巨慢

在使用 ssh 的时候,如果用IP地址登陆内网服务器,系统会试图通过DNS反查相应的域名,如果DNS中没有这个IP的域名解析,就会等到DNS查询超时才会进行下一步。

解决办法:

vim /etc/ssh/sshd_config
# 添加一条记录,默认为 yes
UseDNS no

# 重启ssh服务
service sshd restart

cannot access Input/output error

参考

ls: cannot access  Input/output error
ls: cannot open directory .: Input/output erro

查看磁盘,对于硬盘故障,只读或只写,dmesg | grep sddmesg | grep error可以看到详细报错信息

# 查看分区文件系统类型
$ df -aT
Filesystem              Type         1K-blocks      Used Available Use% Mounted on
/dev/sdb                xfs         1073217536 464903324 608314212  44% /hadoop

# file system check,用来检查和维护不一致的文件系统,比如系统断电或者磁盘发生问题可以使用该命令对文件系统进行检查
# 该命令只能用 root 用户
# -t 指定磁盘文件系统类型
$ fsck -t xfs -r /hadoop
fsck from util-linux 2.23.2
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_repair(8).
/dev/sdb: status 0, rss 1468, real 0.001635, user 0.000839, sys 0.000839

$ xfs_repair -L /dev/sdb
xfs_repair: cannot open /dev/sdb: Device or resource busy

# 重启进入 emergency mode
$ reboot
# 重启后查看磁盘分区会发现损坏的分区没有挂载在目录下,这样 Device or resource 就不 buzy 了
$ df -aT
$ xfs_repair -L /dev/sdb
$ mount -a
# 退出 emergency mode
$ reboot

qin

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏

打开支付宝扫一扫,即可进行扫码打赏哦