В доступе отказано: '/etc/apt/sources.list.d/google-earth.list'

Я пытаюсь добавить 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'

То же самое происходит при попытке запуска от имени root вместо использования sudo:

~$ sudo su -
~# add-apt-repository ppa:otto-kesselgulasch/gimp-edge

Исходный файл 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

Владелец этого google-earth.list является пользователем root с доступом u:rw.

~$ 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--

Также достаточно свободного места:

~$ df -h /etc/apt/sources.list.d/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       902G  252G  604G  30% /

apt update / apt upgrade работают нормально.

Что здесь происходит?
(PS: мне не нужен обходной путь, я знаю, что могу добавить деб вручную.)

6
задан 3 May 2018 в 16:16

1 ответ

Благодаря подсказке от Zanna я нашел проблему:

lsattr вывод показал это google-earth.list был установлен неизменный.

~$ lsattr /etc/apt/sources.list.d/google-earth.list
----i--------e-- /etc/apt/sources.list.d/google-earth.list

С этим набором атрибута, даже root может записать файл.
Для фиксации его я просто использовал chattr -i удалить неизменный атрибут на файле:

~$ sudo chattr -i /etc/apt/sources.list.d/google-earth.list

Я сделал тот файл неизменным сам, потому что после каждого Обновления Google Earth, [arch=amd64] удален из исходного файла (Google вины!). Я первоначально нашел, что "неизменный закрепляют" на webupd8.

3
ответ дан 23 November 2019 в 08:04

Другие вопросы по тегам:

Похожие вопросы: