Ubuntu apt
更新时出现报错:
Setting up base-passwd (3.5.52build1) ...
Changing home-directory of irc from /var/run/ircd to /run/ircd
1 changes have been made, rewriting files
Writing passwd-file to /etc/passwd
Error making backupfile /etc/passwd.org: Invalid cross-device link
dpkg: error processing package base-passwd (--configure):
installed base-passwd package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
base-passwd
E: Sub-process /usr/bin/dpkg returned an error code (1)
由于是 postinst hook 阶段出现问题,想到需要检查这个 hook:
apt download base-passwd
dpkg-deb -xv base-passwd_*.deb base-passwd_extracted/
dpkg-deb -e base-passwd_*.deb base-passwd_extracted/DEBIAN
cat base-passwd_extracted/DEBIAN/postinst
发现其中有
update-passwd --verbose
这个命令。
因此,执行
sudo update-passwd --verbose
命令输出:
Changing home-directory of irc from /var/run/ircd to /run/ircd
1 changes have been made, rewriting files
Writing passwd-file to /etc/passwd
Error making backupfile /etc/passwd.org: Invalid cross-device link
这就是产生错误的原因。
要知道 update-passwd
命令会执行什么操作,使用:
sudo update-passwd --verbose --dry-run
命令输出:
Reading passwd from /usr/share/base-passwd/passwd.master
Reading group from /usr/share/base-passwd/group.master
Reading passwd from /etc/passwd
Reading shadow from /etc/shadow
Reading group from /etc/group
Changing home-directory of irc from /var/run/ircd to /run/ircd
Would commit 1 changes
由此可见,该命令执行失败的操作是
Changing home-directory of irc from /var/run/ircd to /run/ircd
因此,我手动使用 vi
命令修改:文章来源:https://www.toymoban.com/news/detail-817585.html
vi /etc/passwd
根据上面的提示,找到 irc,将对应的 /var/run/ircd
改为 /run/ircd
。修改后 apt
恢复正常。文章来源地址https://www.toymoban.com/news/detail-817585.html
到了这里,关于Ubuntu `apt` 报错 “Errors were encountered while processing: base-passwd“ 的解决方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!