当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 12 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : 无法升级软件
帖子发表于 : 2016-05-17 13:56 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
第一步:sudo apt-get update
第二步:sudo apt-get dist-upgrade
结果弹出以下:

root@test:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up sudo (1.8.9p5-1ubuntu1.2) ...
chown: changing ownership of ‘/etc/sudoers’: Operation not permitted
dpkg: error processing package sudo (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
sudo
E: Sub-process /usr/bin/dpkg returned an error code (1)

求高人指点小白 :Adore


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 14:10 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
spreadtrum 写道:
结果弹出以下:
Setting up sudo (1.8.9p5-1ubuntu1.2) ...
chown: changing ownership of ‘/etc/sudoers’: Operation not permitted

先查看 sudoers 现状
代码:
ls -l /etc/sudoers

将结果全部复制贴上来

再尝试
代码:
pkexec chmod 0440 /etc/sudoers
pkexec chown root:root /etc/sudoers


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 14:21 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
vickycq 写道:
spreadtrum 写道:
结果弹出以下:
Setting up sudo (1.8.9p5-1ubuntu1.2) ...
chown: changing ownership of ‘/etc/sudoers’: Operation not permitted

先查看 sudoers 现状
代码:
ls -l /etc/sudoers

将结果全部复制贴上来

再尝试
代码:
pkexec chmod 0440 /etc/sudoers
pkexec chown root:root /etc/sudoers



root@test:~# ls -l /etc/sudoers
-r--r----- 1 root root 1112 4月 16 2014 /etc/sudoers
root@test:~# pkexec chmod 0440 /etc/sudoers
/bin/chmod: changing permissions of ‘/etc/sudoers’: Operation not permitted
root@test:~# pkexec chown root:root /etc/sudoers
/bin/chown: changing ownership of ‘/etc/sudoers’: Operation not permitted


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 17:04 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
spreadtrum 写道:
root@test:~# ls -l /etc/sudoers
-r--r----- 1 root root 1112 4月 16 2014 /etc/sudoers

执行以下命令将结果全部复制贴上来
代码:
lsattr /etc/sudoers


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 17:53 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
vickycq 写道:
spreadtrum 写道:
root@test:~# ls -l /etc/sudoers
-r--r----- 1 root root 1112 4月 16 2014 /etc/sudoers

执行以下命令将结果全部复制贴上来
代码:
lsattr /etc/sudoers


执行结果如下:
test@test:~$ lsattr /etc/sudoers
lsattr: Permission denied While reading flags on /etc/sudoers


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 17:56 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
执行 cat /etc/group | grep sudo,执行结果如下:

test@test:~$ cat /etc/group | grep sudo
sudo:x:27:test


页首
 用户资料  
 
7 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 18:00 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
最早我安装的是12.04,执行过以下一个.sh文件,功能是使用sudo命令不用再输密码,会不会是这个有影响
#!/bin/bash
chattr -i /etc/sudoers
chmod 777 /etc/sudoers
rm -rf /etc/sudoers
rsync -av --progress /mnt/IT/software/ubuntu/1204Ubuntu/sudoers /etc/
chmod 0440 /etc/sudoers
chattr +i /etc/sudoers


页首
 用户资料  
 
8 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 18:06 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
spreadtrum 写道:
以下一个.sh文件会不会是这个有影响chattr +i /etc/sudoers

是的。/etc/sudoers 被赐予免死金牌 (immutable)
需要设法执行 chattr -i /etc/sudoers
如果 root 都不能 chattr -i 只好动用 RecoveryMode 或单用户模式


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户



_________________
评价: 3.7% spreadtrum
 
页首
 用户资料  
 
9 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-17 18:34 

注册: 2011-02-14 17:46
帖子: 907
送出感谢: 3
接收感谢: 124
:Hehe


页首
 用户资料  
 
10 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-19 8:53 

注册: 2016-04-27 15:45
帖子: 51
系统: Ubuntu 16.04
送出感谢: 7
接收感谢: 0 次
vickycq 写道:
spreadtrum 写道:
以下一个.sh文件会不会是这个有影响chattr +i /etc/sudoers

是的。/etc/sudoers 被赐予免死金牌 (immutable)
需要设法执行 chattr -i /etc/sudoers
如果 root 都不能 chattr -i 只好动用 RecoveryMode 或单用户模式


root下执行chattr -i /etc/sudoers,没有报错

root@test:~# chattr -i /etc/sudoers
root@test:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
fcitx-libs-gclient libgif4 libgnome-desktop-2-17 libmono-web4.0-cil
linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic
linux-image-3.13.0-32-generic linux-image-extra-3.13.0-32-generic
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
libcgi-fast-perl libcgi-pm-perl libfcgi-perl
The following packages will be upgraded:
libparse-debianchangelog-perl
1 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 278 kB of archives.
After this operation, 604 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.zju.edu.cn/ubuntu xenial/main amd64 libcgi-pm-perl all 4.26-1 [185 kB]
Get:2 http://mirrors.zju.edu.cn/ubuntu xenial/main amd64 libfcgi-perl amd64 0.77-1build1 [32.3 kB]
Get:3 http://mirrors.zju.edu.cn/ubuntu xenial/main amd64 libcgi-fast-perl all 1:2.10-1 [10.2 kB]
Get:4 http://mirrors.zju.edu.cn/ubuntu xenial/main amd64 libparse-debianchangelog-perl all 1.2.0-8 [50.4 kB]
Fetched 278 kB in 0s (381 kB/s)
Selecting previously unselected package libcgi-pm-perl.
(Reading database ... 252668 files and directories currently installed.)
Preparing to unpack .../libcgi-pm-perl_4.26-1_all.deb ...
Unpacking libcgi-pm-perl (4.26-1) ...
Selecting previously unselected package libfcgi-perl.
Preparing to unpack .../libfcgi-perl_0.77-1build1_amd64.deb ...
Unpacking libfcgi-perl (0.77-1build1) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../libcgi-fast-perl_1%3a2.10-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.10-1) ...
Preparing to unpack .../libparse-debianchangelog-perl_1.2.0-8_all.deb ...
Unpacking libparse-debianchangelog-perl (1.2.0-8) over (1.2.0-1ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up sudo (1.8.16-0ubuntu1.1) ...
Removing obsolete conffile /etc/init.d/sudo ...
Setting up ubuntu-minimal (1.361) ...
Setting up libcgi-pm-perl (4.26-1) ...
Setting up libfcgi-perl (0.77-1build1) ...
Setting up libcgi-fast-perl (1:2.10-1) ...
Setting up libparse-debianchangelog-perl (1.2.0-8) ...
root@test:~#

更新完成

BTW,啥叫免死金牌


页首
 用户资料  
 
11 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-19 9:51 

注册: 2009-08-04 16:33
帖子: 16893
送出感谢: 21
接收感谢: 1827
引用:
啥叫免死金牌

http://manpages.ubuntu.com/manpages/xen ... ttr.1.html
chattr - change file attributes on a Linux file system
The following attributes are read-only, and may be listed by lsattr(1) but not modified by chattr: compression error (E), huge file (h), indexed directory (I), inline data (N), compression raw access (X), and compressed dirty file (Z).

read-only 只能讀取 無法編輯 / 刪除 / 移動 / ...


页首
 用户资料  
 
12 楼 
 文章标题 : Re: 无法升级软件
帖子发表于 : 2016-05-19 9:59 
头像

注册: 2011-03-20 13:12
帖子: 4522
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 997
spreadtrum 写道:
root下执行chattr -i /etc/sudoers,没有报错BTW,啥叫免死金牌

参考
https://en.wikipedia.org/wiki/Chattr#Attributes
http://xmodulo.com/make-file-immutable-linux.html
http://linux.die.net/Linux-CLI/file-permissions.html
https://ask.fedoraproject.org/en/question/7091/how-to-protect-a-file-even-from-root/
http://www.cyberciti.biz/tips/linux-password-trick.html


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户



_________________
评价: 3.7% spreadtrum
 
页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 12 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译