前言

本文章是我在学习 Linux 所遇到的问题与解决方法

Arch

No such file or directory

运行命令的时候经常出现类似:
libxxx.so.xxx: cannot open shared object file: No such file or directory
这是因为缺少依赖等问题

可以在 搜索引擎搜索 Archlinux libxxx.so.xxx

在这个Arch AUR 上面可以找到依赖

Ubuntu

WSL apt无法安装软件

执行sudo apt update
apt 无法安装软件的时候会提示
W: Some index files failed to download. They have been ignored, or old ones used instead

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法:

1
2
3
4
5
6
7
8
9
10
11
12
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf
#############################################
# /etc/resolv.conf
nameserver 8.8.8.8
# /etc/wsl.conf
[network]
generateResolvConf = false

参考 Github上的一个issue