解决问题:Ubuntu22.04 Jammy新装之后apt不起作用
新安装好Ubuntu22.04 Jammy版本后,发现apt无法使用。
先在个人账户里sudo apt search nvidia
没有显示
跑到root账户apt search nvidia
还是没有显示
测试安装wget:
root@fb14:/# apt install wget
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package wget
看这个报错信息,没有找到wget包,考虑是不是软件源配置问题,
修改/etc/apt/source.list文件:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
还是没有显示
网上查资料,发现要先执行apt update
执行完之后再执行apt search nvidia终于有反应了!
比如执行:
apt search nvidia-driver-550
输出:
nvidia-driver-550/jammy-updates,jammy-security 550.67-0ubuntu1.22.04.2 amd64
NVIDIA driver metapackage
nvidia-driver-550-open/jammy-updates,jammy-security 550.67-0ubuntu1.22.04.2 amd64
NVIDIA driver (open kernel) metapackage
nvidia-driver-550-server/jammy-updates,jammy-security 550.54.15-0ubuntu0.22.04.2 amd64
NVIDIA Server Driver metapackage
nvidia-driver-550-server-open/jammy-updates,jammy-security 550.54.15-0ubuntu0.22.04.2 amd64
NVIDIA driver (open kernel) metapackage
nvidia-headless-550/jammy-updates,jammy-security 550.67-0ubuntu1.22.04.2 amd64
NVIDIA headless metapackage
安装nvidia驱动:
apt install nvidia-driver-550
总结:
如果apt install wget 或者apt search nvidia 等语句没反应或报错,先考虑执行apt update 试试。