How best to ensure unattended-upgrades runs regularly on a nomadic laptop?How to customize...
Is camera lens focus an exact point or a range?
Should I stop contributing to retirement accounts?
Do the concepts of IP address and network interface not belong to the same layer?
Would it be legal for a US State to ban exports of a natural resource?
Reply 'no position' while the job posting is still there
Why does Async/Await work properly when the loop is inside the async function and not the other way around?
How do I repair my stair bannister?
Is a model fitted to data or is data fitted to a model?
Journal losing indexing services
Is it possible to have a strip of cold climate in the middle of a planet?
Difference between -| and |- in TikZ
Is there a conventional notation or name for the slip angle?
Why did the EU agree to delay the Brexit deadline?
Flux received by a negative charge
Can I use my Chinese passport to enter China after I acquired another citizenship?
When quoting, must I also copy hyphens used to divide words that continue on the next line?
Why has "pence" been used in this sentence, not "pences"?
Visiting the UK as unmarried couple
Longest common substring in linear time
Diode in opposite direction?
Ridge Regression with Gradient Descent Converges to OLS estimates
THT: What is a squared annular “ring”?
Can somebody explain Brexit in a few child-proof sentences?
What linear sensor for a keyboard?
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 2 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 2 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