Disable apt upgrades globally

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












1















I know that via apt-mark hold <packagename> you can disable upgrades for a specific package.



Is there a way to disable / freeze the apt upgrade globally?



P.S: I do not want to disable automatic updates; I want to permanently lock the process of apt upgrade.



I am launching a custom AMI on EC2 and the cloudt-init module performs an upgrade which I want to prevent by passing the appropriate command to user-data










share|improve this question
























  • Do you still want to be able to install packages with apt install?

    – Stephen Kitt
    Mar 6 at 16:41











  • no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

    – pkaramol
    Mar 6 at 16:47















1















I know that via apt-mark hold <packagename> you can disable upgrades for a specific package.



Is there a way to disable / freeze the apt upgrade globally?



P.S: I do not want to disable automatic updates; I want to permanently lock the process of apt upgrade.



I am launching a custom AMI on EC2 and the cloudt-init module performs an upgrade which I want to prevent by passing the appropriate command to user-data










share|improve this question
























  • Do you still want to be able to install packages with apt install?

    – Stephen Kitt
    Mar 6 at 16:41











  • no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

    – pkaramol
    Mar 6 at 16:47













1












1








1








I know that via apt-mark hold <packagename> you can disable upgrades for a specific package.



Is there a way to disable / freeze the apt upgrade globally?



P.S: I do not want to disable automatic updates; I want to permanently lock the process of apt upgrade.



I am launching a custom AMI on EC2 and the cloudt-init module performs an upgrade which I want to prevent by passing the appropriate command to user-data










share|improve this question
















I know that via apt-mark hold <packagename> you can disable upgrades for a specific package.



Is there a way to disable / freeze the apt upgrade globally?



P.S: I do not want to disable automatic updates; I want to permanently lock the process of apt upgrade.



I am launching a custom AMI on EC2 and the cloudt-init module performs an upgrade which I want to prevent by passing the appropriate command to user-data







apt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 6 at 15:52









Rui F Ribeiro

41.9k1483142




41.9k1483142










asked Mar 6 at 15:16









pkaramolpkaramol

718621




718621












  • Do you still want to be able to install packages with apt install?

    – Stephen Kitt
    Mar 6 at 16:41











  • no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

    – pkaramol
    Mar 6 at 16:47

















  • Do you still want to be able to install packages with apt install?

    – Stephen Kitt
    Mar 6 at 16:41











  • no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

    – pkaramol
    Mar 6 at 16:47
















Do you still want to be able to install packages with apt install?

– Stephen Kitt
Mar 6 at 16:41





Do you still want to be able to install packages with apt install?

– Stephen Kitt
Mar 6 at 16:41













no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

– pkaramol
Mar 6 at 16:47





no it is a completely static EC2 instance that I spin up periodically; I do not ever want to run apt-anything

– pkaramol
Mar 6 at 16:47










2 Answers
2






active

oldest

votes


















2














If you never need apt, you can remove it — it’s not a required or essential package, “merely” important. apt itself will loudly complain if you try this, and even tell you that it’s essential, but that’s not quite accurate (apt lumps essential and important packages together).



You can also effectively prevent apt from updating, upgrading or installing packages, without removing apt itself, by disabling all its repositories:



sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*


or less drastically



sudo mv /etc/apt/sources.list,.bak
for file in /etc/apt/sources.list.d/*; do if [ -f "$file" ]; then sudo mv "$file" "$file.bak"; fi; done





share|improve this answer






























    0














    Even less drastically: Just put a # in front of every line of /etc/apt/sources.list:



    #deb http://cdn-fastly.deb.debian.org/debian stable main






    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%2f504734%2fdisable-apt-upgrades-globally%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      If you never need apt, you can remove it — it’s not a required or essential package, “merely” important. apt itself will loudly complain if you try this, and even tell you that it’s essential, but that’s not quite accurate (apt lumps essential and important packages together).



      You can also effectively prevent apt from updating, upgrading or installing packages, without removing apt itself, by disabling all its repositories:



      sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*


      or less drastically



      sudo mv /etc/apt/sources.list,.bak
      for file in /etc/apt/sources.list.d/*; do if [ -f "$file" ]; then sudo mv "$file" "$file.bak"; fi; done





      share|improve this answer



























        2














        If you never need apt, you can remove it — it’s not a required or essential package, “merely” important. apt itself will loudly complain if you try this, and even tell you that it’s essential, but that’s not quite accurate (apt lumps essential and important packages together).



        You can also effectively prevent apt from updating, upgrading or installing packages, without removing apt itself, by disabling all its repositories:



        sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*


        or less drastically



        sudo mv /etc/apt/sources.list,.bak
        for file in /etc/apt/sources.list.d/*; do if [ -f "$file" ]; then sudo mv "$file" "$file.bak"; fi; done





        share|improve this answer

























          2












          2








          2







          If you never need apt, you can remove it — it’s not a required or essential package, “merely” important. apt itself will loudly complain if you try this, and even tell you that it’s essential, but that’s not quite accurate (apt lumps essential and important packages together).



          You can also effectively prevent apt from updating, upgrading or installing packages, without removing apt itself, by disabling all its repositories:



          sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*


          or less drastically



          sudo mv /etc/apt/sources.list,.bak
          for file in /etc/apt/sources.list.d/*; do if [ -f "$file" ]; then sudo mv "$file" "$file.bak"; fi; done





          share|improve this answer













          If you never need apt, you can remove it — it’s not a required or essential package, “merely” important. apt itself will loudly complain if you try this, and even tell you that it’s essential, but that’s not quite accurate (apt lumps essential and important packages together).



          You can also effectively prevent apt from updating, upgrading or installing packages, without removing apt itself, by disabling all its repositories:



          sudo rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*


          or less drastically



          sudo mv /etc/apt/sources.list,.bak
          for file in /etc/apt/sources.list.d/*; do if [ -f "$file" ]; then sudo mv "$file" "$file.bak"; fi; done






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 6 at 17:02









          Stephen KittStephen Kitt

          179k25407485




          179k25407485























              0














              Even less drastically: Just put a # in front of every line of /etc/apt/sources.list:



              #deb http://cdn-fastly.deb.debian.org/debian stable main






              share|improve this answer



























                0














                Even less drastically: Just put a # in front of every line of /etc/apt/sources.list:



                #deb http://cdn-fastly.deb.debian.org/debian stable main






                share|improve this answer

























                  0












                  0








                  0







                  Even less drastically: Just put a # in front of every line of /etc/apt/sources.list:



                  #deb http://cdn-fastly.deb.debian.org/debian stable main






                  share|improve this answer













                  Even less drastically: Just put a # in front of every line of /etc/apt/sources.list:



                  #deb http://cdn-fastly.deb.debian.org/debian stable main







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 21 at 23:11









                  äxläxl

                  213




                  213



























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504734%2fdisable-apt-upgrades-globally%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

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay