最近下载了 Ubuntu 24.04 版本,然后在Vmware 里面进行了安装,在安装软件的时候速度很慢,发现apt 源长这样:
Types: deb
URIs: http://cn.archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
然后在网上找修改方案,搜出来的结果和我以前修改方式也类似,基本上都是这样(阿里云的源):
deb https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
但是在我替换掉
/etc/apt/sources.list.d/ubuntu.sources 文件的内容之后,尝试更新源时竟然报错了:
E: Malformed stanza 1 in source list /etc/apt/sources.list.d/ubuntu.sources (type)
E: The list of sources could not be read.
然后我看来一下原始文件和以前(好几年没碰ubuntu了,不知道哪个版本该的)不一样了。然后修改成以下这样就可以了,就是替换成了阿里云源的URL,其他保持不变:
Types: deb
URIs: https://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: https://mirrors.aliyun.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
再执行 sudo apt update 就不会报错了。仅此记录一下。