Permission denied: '/etc/apt/sources.list.d/google-earth.list'

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
5
down vote

favorite












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.)







share|improve this question
















  • 1




    Anything look odd in lsattr /etc/apt/sources.list.d/?
    – Zanna
    May 3 at 13:37






  • 2




    Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
    – RoVo
    May 3 at 13:42






  • 1




    I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
    – RoVo
    May 3 at 13:44






  • 1




    Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
    – RoVo
    May 3 at 13:47











  • Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14














up vote
5
down vote

favorite












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.)







share|improve this question
















  • 1




    Anything look odd in lsattr /etc/apt/sources.list.d/?
    – Zanna
    May 3 at 13:37






  • 2




    Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
    – RoVo
    May 3 at 13:42






  • 1




    I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
    – RoVo
    May 3 at 13:44






  • 1




    Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
    – RoVo
    May 3 at 13:47











  • Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14












up vote
5
down vote

favorite









up vote
5
down vote

favorite











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.)







share|improve this question












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.)









share|improve this question











share|improve this question




share|improve this question










asked May 3 at 13:16









RoVo

5,2241135




5,2241135







  • 1




    Anything look odd in lsattr /etc/apt/sources.list.d/?
    – Zanna
    May 3 at 13:37






  • 2




    Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
    – RoVo
    May 3 at 13:42






  • 1




    I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
    – RoVo
    May 3 at 13:44






  • 1




    Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
    – RoVo
    May 3 at 13:47











  • Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14












  • 1




    Anything look odd in lsattr /etc/apt/sources.list.d/?
    – Zanna
    May 3 at 13:37






  • 2




    Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
    – RoVo
    May 3 at 13:42






  • 1




    I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
    – RoVo
    May 3 at 13:44






  • 1




    Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
    – RoVo
    May 3 at 13:47











  • Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14







1




1




Anything look odd in lsattr /etc/apt/sources.list.d/?
– Zanna
May 3 at 13:37




Anything look odd in lsattr /etc/apt/sources.list.d/?
– Zanna
May 3 at 13:37




2




2




Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
– RoVo
May 3 at 13:42




Great, thanks, that's it ... google-earth.list was set immutable ... ----i--------e-- /etc/apt/sources.list.d/google-earth.list. A simple sudo 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?
– RoVo
May 3 at 13:42




1




1




I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
– RoVo
May 3 at 13:44




I remember that I made that file immutable some weeks ago because webupd8 told me to do it... webupd8.org/2016/03/fix-failed-to-fetch-google-chrome_3.html --> Update 2
– RoVo
May 3 at 13:44




1




1




Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
– RoVo
May 3 at 13:47





Another question would the be, why apt-add-repository needs to open google-earth.list with 'w' option ...
– RoVo
May 3 at 13:47













Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14




Sorry for the slow response - good to know you found the problem and fixed it, but, yeah I am pretty baffled as to why you adding a new PPA requires a write action on an old one. I wonder if that ("w" in line 413) should be considered a bug in add-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 3 at 14:14










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










Thanks to the hint from Zanna I found the issue:



lsattr output showed that google-earth.list was set immutable.



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


With this attribute set, not even root can write the file.

To fix it, I just used chattr -i to remove the immutable attribute on the file:



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



I made that file immutable myself, because after each Google Earth Update, [arch=amd64] gets removed from the source file (blame Google !). I originally found that "immutable fix" on webupd8.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1031553%2fpermission-denied-etc-apt-sources-list-d-google-earth-list%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    Thanks to the hint from Zanna I found the issue:



    lsattr output showed that google-earth.list was set immutable.



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


    With this attribute set, not even root can write the file.

    To fix it, I just used chattr -i to remove the immutable attribute on the file:



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



    I made that file immutable myself, because after each Google Earth Update, [arch=amd64] gets removed from the source file (blame Google !). I originally found that "immutable fix" on webupd8.






    share|improve this answer
























      up vote
      2
      down vote



      accepted










      Thanks to the hint from Zanna I found the issue:



      lsattr output showed that google-earth.list was set immutable.



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


      With this attribute set, not even root can write the file.

      To fix it, I just used chattr -i to remove the immutable attribute on the file:



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



      I made that file immutable myself, because after each Google Earth Update, [arch=amd64] gets removed from the source file (blame Google !). I originally found that "immutable fix" on webupd8.






      share|improve this answer






















        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        Thanks to the hint from Zanna I found the issue:



        lsattr output showed that google-earth.list was set immutable.



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


        With this attribute set, not even root can write the file.

        To fix it, I just used chattr -i to remove the immutable attribute on the file:



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



        I made that file immutable myself, because after each Google Earth Update, [arch=amd64] gets removed from the source file (blame Google !). I originally found that "immutable fix" on webupd8.






        share|improve this answer












        Thanks to the hint from Zanna I found the issue:



        lsattr output showed that google-earth.list was set immutable.



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


        With this attribute set, not even root can write the file.

        To fix it, I just used chattr -i to remove the immutable attribute on the file:



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



        I made that file immutable myself, because after each Google Earth Update, [arch=amd64] gets removed from the source file (blame Google !). I originally found that "immutable fix" on webupd8.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 3 at 14:25









        RoVo

        5,2241135




        5,2241135






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1031553%2fpermission-denied-etc-apt-sources-list-d-google-earth-list%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491