Ser*_*gey 5 filesystem permissions resolv.conf
在今天升级到 12.04 的过程中,我在运行resolvconf包的安装后挂钩时出现错误:
Setting up resolvconf (1.63ubuntu11) ...
resolvconf.postinst: Error: Cannot replace the current /etc/resolv.conf with a symbolic link because it is immutable. To correct this problem, gain root privileges in a terminal and run 'chattr -i /etc/resolv.conf' and then 'dpkg --configure resolvconf'. Aborting.
Run Code Online (Sandbox Code Playgroud)
好吧,当然我试过运行chattr -i /etc/resolv.conf,但dpkg --configure resolvconf产生了同样的错误。
我尝试手动移动或删除文件,但即使以 root 身份也无法执行此操作:
sudo mv /etc/resolv.conf /etc/resolv.conf.old
mv: cannot move `/etc/resolv.conf' to `/etc/resolv.conf.old': Operation not permitted
sudo rm /etc/resolv.conf
rm: cannot remove `/etc/resolv.conf': Operation not permitted
Run Code Online (Sandbox Code Playgroud)
我能够在 /etc 中创建然后删除一个文件(以 root 身份),所以 root 分区不是以只读方式或任何方式安装的。还:
lsattr /etc/resolv.conf
-----a--------- /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
根据帮助文件 ( man chattr),
A file with the `a' attribute set can only be open in append mode for writing.
Run Code Online (Sandbox Code Playgroud)
在您的情况下,该文件具有此属性
The operator `+' causes the selected attributes to be added to the
existing attributes of the files; `-' causes them to be removed;
Run Code Online (Sandbox Code Playgroud)
所以要尝试的命令是
sudo chattr -a /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
并尝试使用再次列出属性
lsattr /etc/resolv.conf
Run Code Online (Sandbox Code Playgroud)
然后尝试删除文件
| 归档时间: |
|
| 查看次数: |
9105 次 |
| 最近记录: |