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
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!
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";More importantly,
anacron
, likecron
, 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
add a comment |
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!
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";More importantly,
anacron
, likecron
, 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
add a comment |
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!
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";More importantly,
anacron
, likecron
, 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
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!
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";More importantly,
anacron
, likecron
, 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
laptop unattended-upgrades anacron
asked 21 mins ago
SqerstetSqerstet
183211
183211
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered 21 mins ago
SqerstetSqerstet
183211
183211
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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