I'm trying to add a ppa
but get error: 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'
same happens when trying to run as root instead of using sudo:
~$ sudo su -
~# add-apt-repository ppa:otto-kesselgulasch/gimp-edge
The source file of the ppa is created, but is empty:
~$ 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
Owner of that google-earth.list
is root with u:rw
access.
~$ 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--
There is also enough free space:
~$ df -h /etc/apt/sources.list.d/
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 902G 252G 604G 30% /
apt update
/ apt upgrade
are working fine.
What is going on here ?
(PS: I don't need a workaround, I know that I can add the deb manually.)
lsattr /etc/apt/sources.list.d/
? – Zanna May 03 '18 at 13:37google-earth.list
was set immutable ...----i--------e-- /etc/apt/sources.list.d/google-earth.list
. A simplesudo chattr -i /etc/apt/sources.list.d/google-earth.list
fixed the problem. Do you want to write an answer that I can accept or should I write the answer myself? – pLumo May 03 '18 at 13:42apt-add-repository
needs to opengoogle-earth.list
with 'w' option ... – pLumo May 03 '18 at 13:47"w"
in line 413) should be considered a bug inadd-apt-repository
. I would have thought the existing files could be read, and then a new file written, but I don't know Python. I am willing to write an answer, but it might be better if you do, since you can probably explain better how it happened – Zanna May 03 '18 at 14:14