How best to ensure unattended-upgrades runs regularly on a nomadic laptop?How to customize unattended-upgrades notification emails?Cannot get unattended-upgrades to workunattended-upgrades error: “/etc/cron.daily/apt: DB Update failed, database locked”confusion about cron and anacron (setting up backup schedule for rsnapshot)Ubuntu 16.04: Unattended-upgrades runs at random timesUnattended upgrades status?unattended upgrades - which shutdown command works?Configuring unattended-upgrades Helpunattended-upgrades runs twice every day but never installs anythingSet unattended-upgrades non-interactively

Can somebody explain Brexit in a few child-proof sentences?

How do I implement a file system driver driver in Linux?

Has Darkwing Duck ever met Scrooge McDuck?

MAXDOP Settings for SQL Server 2014

Can someone explain how this makes sense electrically?

What is this type of notehead called?

Will adding a BY-SA image to a blog post make the entire post BY-SA?

Confusion on Parallelogram

Bob has never been a M before

Is possible to search in vim history?

In Star Trek IV, why did the Bounty go back to a time when whales are already rare?

Visiting the UK as unmarried couple

Is a model fitted to data or is data fitted to a model?

Why is Arduino resetting while driving motors?

What does the Rambam mean when he says that the planets have souls?

Is it possible to have a strip of cold climate in the middle of a planet?

Difference between -| and |- in TikZ

Should I stop contributing to retirement accounts?

Proof of Lemma: Every nonzero integer can be written as a product of primes

Did US corporations pay demonstrators in the German demonstrations against article 13?

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Can a significant change in incentives void an employment contract?

Is there a conventional notation or name for the slip angle?

Using a siddur to Daven from in a seforim store



How best to ensure unattended-upgrades runs regularly on a nomadic laptop?


How to customize unattended-upgrades notification emails?Cannot get unattended-upgrades to workunattended-upgrades error: “/etc/cron.daily/apt: DB Update failed, database locked”confusion about cron and anacron (setting up backup schedule for rsnapshot)Ubuntu 16.04: Unattended-upgrades runs at random timesUnattended upgrades status?unattended upgrades - which shutdown command works?Configuring unattended-upgrades Helpunattended-upgrades runs twice every day but never installs anythingSet unattended-upgrades non-interactively













0















APT seems to have an enduring blind-spot for computers which are not connected permanently to the internet. These days there are surely a ton of them, mostly laptops.



The general solution is unattended-upgrades. This is installed and run by default with a daily cron job. As a protection, anacron is also installed and run by default, and executes any cron jobs which were missed because the computer was turned off. So far so sensible.



BUT!




  1. Default unattended-upgrades config (/etc/apt/apt.conf.d/50unattended-upgrades or similar) requires the following to be set, else upgrades risk being skipped:



    Unattended-Upgrade::OnlyOnACPower "false";
    Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";


  2. More importantly, anacron, like cron, runs jobs whether or not an internet connection is available! This is clearly a major design bug for non-server Ubuntu, since personal computers are not always connected permanently. With default config, on a nomadic laptop, unattended-upgrades will simply fail much of the time.


(Perhaps there needs to be a separate class of cron job which waits for a network connection until executing. Or failed cron.daily jobs could be switched to cron.hourly until they execute successfully.)



One practical solution is a systemd unit file to execute unattended-upgrades as a user script after the network comes online. But it will only run once per boot.



What is the optimal solution? Does anyone know if there are plans to fix this with a new package or a config improvement?










share|improve this question


























    0















    APT seems to have an enduring blind-spot for computers which are not connected permanently to the internet. These days there are surely a ton of them, mostly laptops.



    The general solution is unattended-upgrades. This is installed and run by default with a daily cron job. As a protection, anacron is also installed and run by default, and executes any cron jobs which were missed because the computer was turned off. So far so sensible.



    BUT!




    1. Default unattended-upgrades config (/etc/apt/apt.conf.d/50unattended-upgrades or similar) requires the following to be set, else upgrades risk being skipped:



      Unattended-Upgrade::OnlyOnACPower "false";
      Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";


    2. More importantly, anacron, like cron, runs jobs whether or not an internet connection is available! This is clearly a major design bug for non-server Ubuntu, since personal computers are not always connected permanently. With default config, on a nomadic laptop, unattended-upgrades will simply fail much of the time.


    (Perhaps there needs to be a separate class of cron job which waits for a network connection until executing. Or failed cron.daily jobs could be switched to cron.hourly until they execute successfully.)



    One practical solution is a systemd unit file to execute unattended-upgrades as a user script after the network comes online. But it will only run once per boot.



    What is the optimal solution? Does anyone know if there are plans to fix this with a new package or a config improvement?










    share|improve this question
























      0












      0








      0








      APT seems to have an enduring blind-spot for computers which are not connected permanently to the internet. These days there are surely a ton of them, mostly laptops.



      The general solution is unattended-upgrades. This is installed and run by default with a daily cron job. As a protection, anacron is also installed and run by default, and executes any cron jobs which were missed because the computer was turned off. So far so sensible.



      BUT!




      1. Default unattended-upgrades config (/etc/apt/apt.conf.d/50unattended-upgrades or similar) requires the following to be set, else upgrades risk being skipped:



        Unattended-Upgrade::OnlyOnACPower "false";
        Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";


      2. More importantly, anacron, like cron, runs jobs whether or not an internet connection is available! This is clearly a major design bug for non-server Ubuntu, since personal computers are not always connected permanently. With default config, on a nomadic laptop, unattended-upgrades will simply fail much of the time.


      (Perhaps there needs to be a separate class of cron job which waits for a network connection until executing. Or failed cron.daily jobs could be switched to cron.hourly until they execute successfully.)



      One practical solution is a systemd unit file to execute unattended-upgrades as a user script after the network comes online. But it will only run once per boot.



      What is the optimal solution? Does anyone know if there are plans to fix this with a new package or a config improvement?










      share|improve this question














      APT seems to have an enduring blind-spot for computers which are not connected permanently to the internet. These days there are surely a ton of them, mostly laptops.



      The general solution is unattended-upgrades. This is installed and run by default with a daily cron job. As a protection, anacron is also installed and run by default, and executes any cron jobs which were missed because the computer was turned off. So far so sensible.



      BUT!




      1. Default unattended-upgrades config (/etc/apt/apt.conf.d/50unattended-upgrades or similar) requires the following to be set, else upgrades risk being skipped:



        Unattended-Upgrade::OnlyOnACPower "false";
        Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";


      2. More importantly, anacron, like cron, runs jobs whether or not an internet connection is available! This is clearly a major design bug for non-server Ubuntu, since personal computers are not always connected permanently. With default config, on a nomadic laptop, unattended-upgrades will simply fail much of the time.


      (Perhaps there needs to be a separate class of cron job which waits for a network connection until executing. Or failed cron.daily jobs could be switched to cron.hourly until they execute successfully.)



      One practical solution is a systemd unit file to execute unattended-upgrades as a user script after the network comes online. But it will only run once per boot.



      What is the optimal solution? Does anyone know if there are plans to fix this with a new package or a config improvement?







      laptop unattended-upgrades anacron






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 21 mins ago









      SqerstetSqerstet

      183211




      183211




















          1 Answer
          1






          active

          oldest

          votes


















          0














          If connecting to internet with network-manager, the current default on Ubuntu, then create a dispatcher script to launch unattended-upgrades after connecting to the network:



          sudo touch /etc/NetworkManager/dispatcher.d/20-myconnectionscript
          sudo chmod +x /etc/NetworkManager/dispatcher.d/20-myconnectionscript


          In 20-myconnectionscript:



          #!/bin/sh

          if [ "$2" = "up" ];
          # only proceed if unattended-upgrades was last run more than a day ago
          ELAPSEDSINCEUU=$(($(date +%s) - $(date +%s -r /var/lib/apt/periodic/unattended-upgrades-stamp)))
          if [ $ELAPSEDSINCEUU -gt 86400 ]; then
          /usr/bin/unattended-upgrades
          fi
          fi





          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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f1128433%2fhow-best-to-ensure-unattended-upgrades-runs-regularly-on-a-nomadic-laptop%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









            0














            If connecting to internet with network-manager, the current default on Ubuntu, then create a dispatcher script to launch unattended-upgrades after connecting to the network:



            sudo touch /etc/NetworkManager/dispatcher.d/20-myconnectionscript
            sudo chmod +x /etc/NetworkManager/dispatcher.d/20-myconnectionscript


            In 20-myconnectionscript:



            #!/bin/sh

            if [ "$2" = "up" ];
            # only proceed if unattended-upgrades was last run more than a day ago
            ELAPSEDSINCEUU=$(($(date +%s) - $(date +%s -r /var/lib/apt/periodic/unattended-upgrades-stamp)))
            if [ $ELAPSEDSINCEUU -gt 86400 ]; then
            /usr/bin/unattended-upgrades
            fi
            fi





            share|improve this answer



























              0














              If connecting to internet with network-manager, the current default on Ubuntu, then create a dispatcher script to launch unattended-upgrades after connecting to the network:



              sudo touch /etc/NetworkManager/dispatcher.d/20-myconnectionscript
              sudo chmod +x /etc/NetworkManager/dispatcher.d/20-myconnectionscript


              In 20-myconnectionscript:



              #!/bin/sh

              if [ "$2" = "up" ];
              # only proceed if unattended-upgrades was last run more than a day ago
              ELAPSEDSINCEUU=$(($(date +%s) - $(date +%s -r /var/lib/apt/periodic/unattended-upgrades-stamp)))
              if [ $ELAPSEDSINCEUU -gt 86400 ]; then
              /usr/bin/unattended-upgrades
              fi
              fi





              share|improve this answer

























                0












                0








                0







                If connecting to internet with network-manager, the current default on Ubuntu, then create a dispatcher script to launch unattended-upgrades after connecting to the network:



                sudo touch /etc/NetworkManager/dispatcher.d/20-myconnectionscript
                sudo chmod +x /etc/NetworkManager/dispatcher.d/20-myconnectionscript


                In 20-myconnectionscript:



                #!/bin/sh

                if [ "$2" = "up" ];
                # only proceed if unattended-upgrades was last run more than a day ago
                ELAPSEDSINCEUU=$(($(date +%s) - $(date +%s -r /var/lib/apt/periodic/unattended-upgrades-stamp)))
                if [ $ELAPSEDSINCEUU -gt 86400 ]; then
                /usr/bin/unattended-upgrades
                fi
                fi





                share|improve this answer













                If connecting to internet with network-manager, the current default on Ubuntu, then create a dispatcher script to launch unattended-upgrades after connecting to the network:



                sudo touch /etc/NetworkManager/dispatcher.d/20-myconnectionscript
                sudo chmod +x /etc/NetworkManager/dispatcher.d/20-myconnectionscript


                In 20-myconnectionscript:



                #!/bin/sh

                if [ "$2" = "up" ];
                # only proceed if unattended-upgrades was last run more than a day ago
                ELAPSEDSINCEUU=$(($(date +%s) - $(date +%s -r /var/lib/apt/periodic/unattended-upgrades-stamp)))
                if [ $ELAPSEDSINCEUU -gt 86400 ]; then
                /usr/bin/unattended-upgrades
                fi
                fi






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 21 mins ago









                SqerstetSqerstet

                183211




                183211



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f1128433%2fhow-best-to-ensure-unattended-upgrades-runs-regularly-on-a-nomadic-laptop%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

                    Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                    Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                    Torre de la Isleta Índice Véase también Referencias Bibliografía Enlaces externos Menú de navegación38°25′58″N 0°23′02″O / 38.43277778, -0.3838888938°25′58″N 0°23′02″O / 38.43277778, -0.38388889Torre de la Illeta de l’Horta o Torre Saleta. Base de datos de bienes inmuebles. Patrimonio Cultural. Secretaría de Estado de CulturaFicha BIC Torre de la Illeta de l’Horta. Dirección General de Patrimonio Cultural. Generalitat ValencianaLugares de interés. Ayuntamiento del CampelloTorre de la Isleta en CastillosNet.org