Linux-遇到的问题
参考文献
Ubuntu
安装Ubuntu 18.04
系统,网卡驱动问题
-
现象:
-
使用
ip address
查看网络信息,发现没有网卡信息1
2
3
4
5
6
7
8# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
-
-
使用
lspci |grep net
查看网卡型号1
2# lspci |grep net
00:1f.6 Ethernet controller: Intel Corporation Device 15f9 (rev 11) -
找到对应的网卡驱动
-
安装步骤
1
2
3
4
5tar zxvf e1000e-3.8.4.tar.gz
cd e1000e-3.8.4/src/
sudo make install
sudo modprobe -r e1000e
sudo modprobe e1000e
-
安装完成后,重新查看网络情况
1
2
3
4
5
6
7
8
9
10
11
12
13
14# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
4: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 30:d0:42:e9:30:71 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.72/24 brd 192.168.11.255 scope global dynamic noprefixroute enp0s31f6
valid_lft 5704sec preferred_lft 5704sec
inet6 fe80::4b24:8074:eac0:6970/64 scope link noprefixroute
valid_lft forever preferred_lft forever
解决umount: /xxx: device is busy
-
原因是因为有程序在使用
/xxx
目录,我们可以使用fuser
查看那些程序的进程1
2
3
4
5
6fuser -m /xxx
#
fuser -kvm /xxx
# 或者直接强行解除挂载
umount -l /xxx
无法识别extFat
格式的硬盘
-
在线情况下
1
2sudo apt update
sudo apt install exfat-fuse exfat-utils -
离线情况下
- 下载
exfat-fuse
和exfat-utils
- 可通过 https://pkgs.org/查找下载
1
2dpkg -i exfat-fuse_1.3.0-1_amd64.deb
dpkg -i exfat-utils_1.3.0-1_amd64.deb - 下载
dpkg frontend is locked by another process
-
使用
dpkg -i *deb
安装包时上述错误 -
解决办法
-
找到保存锁文件的进程
1
2lsof /var/lib/dpkg/lock
lsof /var/lib/dpkg/lock-fontend -
终止进程
1
kill -9 PID
-
移除锁定并重新配置
dpkg
1
2sudo rm /var/lib/dpkg/lock-fontend
sudo dpkg --configure -a
-
linux
用户登录时无法默认进入bash
的解决办法
1 | sudo vim /etc/passwd |
-
在对应用户信息后面,补充
:/bin/bash
1
holelin:x:1001:1001::/home/hollein:/bin/bash
Ubuntu
设置DNS
后自动重置问题
-
Linux
系统通常通过修改/etc/resolv.conf
来设置DNS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
search lan
# 以下为新增内容
nameserver 114.114.114.114
nameserver 114.114.115.115
nameserver 223.5.5.5 -
但是在使用过程中,
reboot
重启之后,/etc/resolv.conf
也会被重置,主要原因是/etc/resolv.conf
是一个动态生成的文件 -
使用
man systemd-resolved
-
解决办法
-
修改
/etc/systemd/resolved.conf
,保存并退出1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details
[Resolve]
# 此处修改
DNS=114.114.114.114 114.114.115.115 8.8.8.8 8.8.4.4
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes -
以
root
身份执行以下命令1
2
3
4
5
6
7sudo systemctl restart systemd-resolved
sudo systemctl enable systemd-resolved
# 将/etc/resolv.conf指向新生成的文件
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
-
Ubuntu 20.04
查看crontab
的日志
-
Ubuntu
系统默认不生成cron
日志文件 -
在终端输入以下命令
1
2$ sudo vim /etc/rsyslog.d/50-default.conf
# 然后找到 cron.* ,把前面的 # 去掉,保存退出. -
重启系统日志,在终端输入命令
1
sudo service rsyslog restart
-
稍等片刻进入
/var/log/
即可看到cron.log
文件,这个文件就是crontab
的日志文件.如果还没出现该文件,可以试试重启cron
服务1
$ sudo service cron restart
zsh
在scp
时不能使用通配符的原因和解决方案
1 | echo "setopt nonomatch" >> ~/.zshrc |
执行 systemctl restart
服务时报错Failed to add /run/systemd/ask-password to directory watch: No space left on device
1 | cat /proc/sys/fs/inotify/max_user_watches |
常用的DNS服务器信息
DNSPod Public DNS+
1 | IPv4 地址 |
AliDNS
阿里公共DNS
解析服务
1 | 首选: 223.5.5.5 |
114 DNS
1 | 常规公共 DNS (干净无劫持) |
百度 BaiduDNS
1 | ipv4 180.76.76.76 |
Google Public DNS
1 | IPv4 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 HoleLin's Blog!