sudo not found and can't be installed












3














I just installed Debian 9.3.0 and I tried to run command sudo apt-get update but this error came up :



sudo: command not found


so I turned to superuser and run command apt-get update in superuser mode and that worked fine but after that this error is appearing after every command which I'm trying to do in terminal :



E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


I searched for this and I figured out that I have to command sudo kill -9 <process id> but I can't install sudo cause after I'm commanding apt install -y sudo I'm getting this error:



E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


does anyone know how can I fix this?










share|improve this question




















  • 4




    Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
    – DopeGhoti
    Sep 24 at 16:10






  • 1




    After every command?
    – ctrl-alt-delor
    Sep 24 at 16:21
















3














I just installed Debian 9.3.0 and I tried to run command sudo apt-get update but this error came up :



sudo: command not found


so I turned to superuser and run command apt-get update in superuser mode and that worked fine but after that this error is appearing after every command which I'm trying to do in terminal :



E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


I searched for this and I figured out that I have to command sudo kill -9 <process id> but I can't install sudo cause after I'm commanding apt install -y sudo I'm getting this error:



E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


does anyone know how can I fix this?










share|improve this question




















  • 4




    Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
    – DopeGhoti
    Sep 24 at 16:10






  • 1




    After every command?
    – ctrl-alt-delor
    Sep 24 at 16:21














3












3








3







I just installed Debian 9.3.0 and I tried to run command sudo apt-get update but this error came up :



sudo: command not found


so I turned to superuser and run command apt-get update in superuser mode and that worked fine but after that this error is appearing after every command which I'm trying to do in terminal :



E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


I searched for this and I figured out that I have to command sudo kill -9 <process id> but I can't install sudo cause after I'm commanding apt install -y sudo I'm getting this error:



E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


does anyone know how can I fix this?










share|improve this question















I just installed Debian 9.3.0 and I tried to run command sudo apt-get update but this error came up :



sudo: command not found


so I turned to superuser and run command apt-get update in superuser mode and that worked fine but after that this error is appearing after every command which I'm trying to do in terminal :



E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


I searched for this and I figured out that I have to command sudo kill -9 <process id> but I can't install sudo cause after I'm commanding apt install -y sudo I'm getting this error:



E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


does anyone know how can I fix this?







debian software-installation sudo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 10 at 17:19









Rui F Ribeiro

39k1479129




39k1479129










asked Sep 24 at 16:01









Shakib Karami

1184




1184








  • 4




    Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
    – DopeGhoti
    Sep 24 at 16:10






  • 1




    After every command?
    – ctrl-alt-delor
    Sep 24 at 16:21














  • 4




    Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
    – DopeGhoti
    Sep 24 at 16:10






  • 1




    After every command?
    – ctrl-alt-delor
    Sep 24 at 16:21








4




4




Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
– DopeGhoti
Sep 24 at 16:10




Since you're logged in as root already, you don't need sudo anymore for this task: what happens if, when logged in as root, you run apt install -y sudo?
– DopeGhoti
Sep 24 at 16:10




1




1




After every command?
– ctrl-alt-delor
Sep 24 at 16:21




After every command?
– ctrl-alt-delor
Sep 24 at 16:21










1 Answer
1






active

oldest

votes


















9














On a fresh Debian install sudo does not work by default.



You need to add your user to the sudo group in order to get the sudo command working.



1. Get root first




su




Enter your password to get the root prompt



2. Add your user to the sudo group



adduser <username> sudo



This will add your user to the sudo group



After this start a new shell or logout and login again.
Try running the commands with sudo now and they will surely work with your own user.



Additionally in some cases like the minimal installations of Debian, the sudo program/command itself might not be present. In that case you will also need to install sudo




apt install sudo




About the issue with the permission denied errors.



When apt invokes dpkg while installing or updating packages.
Whenever there is an operation going on which involves dpkg, dpkg places a lock file in




/var/lib/dpkg/lock




To tell other process that it is performing a package management.



If you want to perform package management at the same time when the lock file is present. You can still do it if you remove the lock file manually.




rm /var/lib/dpkg/lock




After this you can continue the operation you wanted to do






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471118%2fsudo-not-found-and-cant-be-installed%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    9














    On a fresh Debian install sudo does not work by default.



    You need to add your user to the sudo group in order to get the sudo command working.



    1. Get root first




    su




    Enter your password to get the root prompt



    2. Add your user to the sudo group



    adduser <username> sudo



    This will add your user to the sudo group



    After this start a new shell or logout and login again.
    Try running the commands with sudo now and they will surely work with your own user.



    Additionally in some cases like the minimal installations of Debian, the sudo program/command itself might not be present. In that case you will also need to install sudo




    apt install sudo




    About the issue with the permission denied errors.



    When apt invokes dpkg while installing or updating packages.
    Whenever there is an operation going on which involves dpkg, dpkg places a lock file in




    /var/lib/dpkg/lock




    To tell other process that it is performing a package management.



    If you want to perform package management at the same time when the lock file is present. You can still do it if you remove the lock file manually.




    rm /var/lib/dpkg/lock




    After this you can continue the operation you wanted to do






    share|improve this answer




























      9














      On a fresh Debian install sudo does not work by default.



      You need to add your user to the sudo group in order to get the sudo command working.



      1. Get root first




      su




      Enter your password to get the root prompt



      2. Add your user to the sudo group



      adduser <username> sudo



      This will add your user to the sudo group



      After this start a new shell or logout and login again.
      Try running the commands with sudo now and they will surely work with your own user.



      Additionally in some cases like the minimal installations of Debian, the sudo program/command itself might not be present. In that case you will also need to install sudo




      apt install sudo




      About the issue with the permission denied errors.



      When apt invokes dpkg while installing or updating packages.
      Whenever there is an operation going on which involves dpkg, dpkg places a lock file in




      /var/lib/dpkg/lock




      To tell other process that it is performing a package management.



      If you want to perform package management at the same time when the lock file is present. You can still do it if you remove the lock file manually.




      rm /var/lib/dpkg/lock




      After this you can continue the operation you wanted to do






      share|improve this answer


























        9












        9








        9






        On a fresh Debian install sudo does not work by default.



        You need to add your user to the sudo group in order to get the sudo command working.



        1. Get root first




        su




        Enter your password to get the root prompt



        2. Add your user to the sudo group



        adduser <username> sudo



        This will add your user to the sudo group



        After this start a new shell or logout and login again.
        Try running the commands with sudo now and they will surely work with your own user.



        Additionally in some cases like the minimal installations of Debian, the sudo program/command itself might not be present. In that case you will also need to install sudo




        apt install sudo




        About the issue with the permission denied errors.



        When apt invokes dpkg while installing or updating packages.
        Whenever there is an operation going on which involves dpkg, dpkg places a lock file in




        /var/lib/dpkg/lock




        To tell other process that it is performing a package management.



        If you want to perform package management at the same time when the lock file is present. You can still do it if you remove the lock file manually.




        rm /var/lib/dpkg/lock




        After this you can continue the operation you wanted to do






        share|improve this answer














        On a fresh Debian install sudo does not work by default.



        You need to add your user to the sudo group in order to get the sudo command working.



        1. Get root first




        su




        Enter your password to get the root prompt



        2. Add your user to the sudo group



        adduser <username> sudo



        This will add your user to the sudo group



        After this start a new shell or logout and login again.
        Try running the commands with sudo now and they will surely work with your own user.



        Additionally in some cases like the minimal installations of Debian, the sudo program/command itself might not be present. In that case you will also need to install sudo




        apt install sudo




        About the issue with the permission denied errors.



        When apt invokes dpkg while installing or updating packages.
        Whenever there is an operation going on which involves dpkg, dpkg places a lock file in




        /var/lib/dpkg/lock




        To tell other process that it is performing a package management.



        If you want to perform package management at the same time when the lock file is present. You can still do it if you remove the lock file manually.




        rm /var/lib/dpkg/lock




        After this you can continue the operation you wanted to do







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 18 at 15:22

























        answered Sep 24 at 16:59









        Raju Devidas

        1437




        1437






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471118%2fsudo-not-found-and-cant-be-installed%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre