所以我以 root 身份运行了一个愚蠢的命令(不要运行)
# chown -R root:root /{usr,lib,var,etc,bin,sbin,tools}
所以……哎呀。我碰巧打开了一个root shell(从我造成这个的时候开始),所以我可以sudo
通过做
# chown root:root /usr/bin/sudo
# chmod 4755 /usr/bin/sudo
耶,sudo
又工作了。我想安装一个包(ncdu
),所以我跑了sudo apt-get install ncdu
。
$ sudo apt-get install ncdu
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
ncdu
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/43.4 kB of archives.
After this operation, 106 kB of additional disk space will be used.
Selecting previously unselected package ncdu.
(Reading database ... 233654 files and directories currently installed.)
Preparing to unpack .../ncdu_1.15.1-1_amd64.deb ...
Unpacking ncdu (1.15.1-1) ...
Setting up ncdu (1.15.1-1) ...
Processing triggers for man-db (2.9.4-2) ...
/usr/bin/mandb: can't chmod /var/cache/man/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/es/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/es/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/es/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/zh_TW/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/zh_TW/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/zh_TW/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/fi/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/fi/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/fi/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/de/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/de/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/de/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/uk/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/uk/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/uk/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/sr/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/sr/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/sr/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/sl/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/sl/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/sl/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/nb/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/nb/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/nb/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/pt/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/pt/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/pt/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/ru/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/ru/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/ru/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/ko/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/ko/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/ko/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/it/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/it/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/it/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/fr/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/fr/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/fr/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/et/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/et/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/et/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/ca/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/ca/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/ca/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/tr/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/tr/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/tr/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/nl/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/nl/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/nl/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/fr.UTF-8/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/fr.UTF-8/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/fr.UTF-8/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/hu/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/hu/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/hu/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/fr.ISO8859-1/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/fr.ISO8859-1/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/fr.ISO8859-1/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/sv/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/sv/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/sv/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/id/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/id/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/id/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/el/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/el/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/el/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/pt_BR/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/pt_BR/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/pt_BR/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/ro/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/ro/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/ro/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/zh_CN/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/zh_CN/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/zh_CN/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/cs/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/cs/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/cs/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/gl/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/gl/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/gl/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/da/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/da/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/da/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/pl/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/pl/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/pl/1053532: Permission denied
/usr/bin/mandb: can't chmod /var/cache/man/ja/CACHEDIR.TAG: Operation not permitted
/usr/bin/mandb: can't remove /var/cache/man/ja/CACHEDIR.TAG: Permission denied
/usr/bin/mandb: fopen /var/cache/man/ja/1053532: Permission denied
显然我没有做足够的事情来修复我的系统。如果可能的话,我不想重新安装操作系统,但我有一个 root shell(它是我面前的一台物理笔记本电脑),所以我想知道如何修复apt
,以便我可以再次安装包。我正在使用 Kubuntu 21.10。
如评论中所述,您仍然会遇到问题,因此最容易重新安装。
man:man
但是,对于这个特定问题,您可以通过运行以下命令将所有权归还: