[Seek Help] 终端检查更新,提示无法解析主机
Tofloor
poster avatar
wei_sky
deepin
2021-08-23 17:34
Author

升级到最新版20.2.3,修改计算机名为xxx,通过终端执行sudo apt update,提示"sudo: 无法解析主机:xxx: 未知的名称或服务"

Reply Favorite View the author
All Replies
liwl
deepin
2021-08-23 17:45
#1

要修改一下/etc/hosts文件

我测试了一下,通过控制中心和sudo hostnamectl的设置方式都不能修改/etc/hosts,得手动改。

在执行sudo apt相关需要域名解析的时候 ,必然会先解析/etc/hosts,而后是DNS,所以会报错。

解决:

sudo vim /etc/hosts文件,把127.0.1.1 xxx 改为127.0.1.1 你的新主机名,保存退出

 

Reply View the author
海天鹰
deepin
2021-08-23 19:11
#2

被墙了?

Reply View the author
wei_sky
deepin
2021-08-24 01:02
#3
liwl

要修改一下/etc/hosts文件

我测试了一下,通过控制中心和sudo hostnamectl的设置方式都不能修改/etc/hosts,得手动改。

在执行sudo apt相关需要域名解析的时候 ,必然会先解析/etc/hosts,而后是DNS,所以会报错。

解决:

sudo vim /etc/hosts文件,把127.0.1.1 xxx 改为127.0.1.1 你的新主机名,保存退出

 

感谢大佬,修改/etc/hosts后好了

Reply View the author
wei_sky
deepin
2021-08-24 01:03
#4
海天鹰

被墙了?

感谢回复,1楼大佬正解

Reply View the author
犇牛
deepin
2024-11-26 08:39
#5

同问题:感谢各位大侠

Reply View the author