pLu*_*umo 7 permissions apt 16.04
我正在尝试添加一个ppa
但出现错误Permission denied: '/etc/apt/sources.list.d/google-earth.list'
::
~$ sudo add-apt-repository ppa:otto-kesselgulasch/gimp-edge
[...]
Press [ENTER] to continue or ctrl-c to cancel adding it
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 168, in <module>
if not sp.add_source_from_shortcut(shortcut, options.enable_source):
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 768, in add_source_from_shortcut
self.set_modified_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 492, in set_modified_sourceslist
self.save_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 658, in save_sourceslist
self.sourceslist.save()
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 413, in save
files[source.file] = open(source.file, "w")
PermissionError: [Errno 13] Permission denied: '/etc/apt/sources.list.d/google-earth.list'
Run Code Online (Sandbox Code Playgroud)
尝试以 root 身份运行而不是使用 sudo 时也会发生同样的情况:
~$ sudo su -
~# add-apt-repository ppa:otto-kesselgulasch/gimp-edge
Run Code Online (Sandbox Code Playgroud)
ppa 的源文件已创建,但为空:
~$ ll /etc/apt/sources.list.d/otto-kesselgulasch-ubuntu-gimp-edge-xenial.list*
-rw-r--r-- 1 root root 0 Apr 3 10:26 /etc/apt/sources.list.d/otto-kesselgulasch-ubuntu-gimp-edge-xenial.list
-rw-r--r-- 1 root root 0 Mai 3 15:03 /etc/apt/sources.list.d/otto-kesselgulasch-ubuntu-gimp-edge-xenial.list.save
Run Code Online (Sandbox Code Playgroud)
它的所有者google-earth.list
是具有u:rw
访问权限的root 。
~$ ll /etc/apt/sources.list.d/google-earth.list
-rw-r--r-- 1 root root 188 Apr 3 10:27 /etc/apt/sources.list.d/google-earth.list
~$ getfacl /etc/apt/sources.list.d/google-earth.list
getfacl: Removing leading '/' from absolute path names
# file: etc/apt/sources.list.d/google-earth.list
# owner: root
# group: root
user::rw-
group::r--
other::r--
Run Code Online (Sandbox Code Playgroud)
还有足够的可用空间:
~$ df -h /etc/apt/sources.list.d/
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 902G 252G 604G 30% /
Run Code Online (Sandbox Code Playgroud)
apt update
/apt upgrade
工作正常。
这里发生了什么 ?
(PS:我不需要解决方法,我知道我可以手动添加 deb。)
Thanks to the hint from Zanna I found the issue:
lsattr
输出显示google-earth.list
设置为不可变的。
~$ lsattr /etc/apt/sources.list.d/google-earth.list
----i--------e-- /etc/apt/sources.list.d/google-earth.list
Run Code Online (Sandbox Code Playgroud)
有了这个属性集,甚至root
不能写文件。
为了修复它,我只是用来chattr -i
删除文件上的不可变属性:
~$ sudo chattr -i /etc/apt/sources.list.d/google-earth.list
Run Code Online (Sandbox Code Playgroud)
我自己使该文件不可变,因为在每次 Google 地球更新后,[arch=amd64]
都会从源文件中删除(责怪 Google !)。我最初在webupd8上发现了“不可变修复” 。
归档时间: |
|
查看次数: |
3612 次 |
最近记录: |