From 4e2cea3d1a044db91d31eddbfcedf8e80eb67b7e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Feb 2018 08:04:04 +0100 Subject: [PATCH] many: remove snapd.refresh.{timer,service} We used to have an emergency timer that would run a forced refresh once a week to ensure that if something is wrong with our refresh schedule implementation we have a way out. We don't need this anymore because: - we have the monthly schedule now so weekly does not fit anymore - we have repairs for emergencies which are on their own timer - our internal refresh got quite a bit of testing since we introduced it This should be cherry-picked back to 2.31 and 2.32. --- .../spread-tests/regression/lp-1599608/task.yaml | 8 ++++---- data/systemd/snapd.refresh.service.in | 11 ----------- data/systemd/snapd.refresh.timer | 14 -------------- packaging/arch/snapd.install | 9 ++------- packaging/fedora/snapd.spec | 7 +------ packaging/opensuse-42.2/snapd.spec | 4 +--- packaging/ubuntu-14.04/snapd.postinst | 4 ++-- .../interfaces-snapd-control-with-manage/task.yaml | 7 ------- tests/main/ubuntu-core-services/task.yaml | 2 +- 9 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 data/systemd/snapd.refresh.service.in delete mode 100644 data/systemd/snapd.refresh.timer diff --git a/cmd/snap-confine/spread-tests/regression/lp-1599608/task.yaml b/cmd/snap-confine/spread-tests/regression/lp-1599608/task.yaml index c83a15feef..d6872e20b1 100644 --- a/cmd/snap-confine/spread-tests/regression/lp-1599608/task.yaml +++ b/cmd/snap-confine/spread-tests/regression/lp-1599608/task.yaml @@ -17,7 +17,7 @@ prepare: | cd / echo "Install hello-world" snap install hello-world - systemctl stop snapd.refresh.timer snapd.service snapd.socket + systemctl stop snapd.service snapd.socket # all of this ls madness can go away when we have remote environment # variables echo "Unmount original core snap" @@ -31,7 +31,7 @@ prepare: | if [ ! -e $(ls -1 /var/lib/snapd/snaps/ubuntu-core_*.snap | tail -1) ]; then exit 1; fi echo "Mount modified core snap" mount $(ls -1 /var/lib/snapd/snaps/ubuntu-core_*.snap | tail -1) $(ls -1d /snap/ubuntu-core/* | grep -v current | tail -1) - systemctl start snapd.refresh.timer snapd.service snapd.socket + systemctl start snapd.service snapd.socket execute: | exit 0 cd / @@ -51,7 +51,7 @@ restore: | exit 0 echo "Remove hello-world" snap remove hello-world - systemctl stop snapd.refresh.timer snapd.service snapd.socket + systemctl stop snapd.service snapd.socket echo "Unmount the modified core snap" # all of this ls madness can go away when we have remote environment # variables @@ -66,4 +66,4 @@ restore: | udevadm settle udevadm trigger udevadm settle - systemctl start snapd.refresh.timer snapd.service snapd.socket + systemctl start snapd.service snapd.socket diff --git a/data/systemd/snapd.refresh.service.in b/data/systemd/snapd.refresh.service.in deleted file mode 100644 index 524df900df..0000000000 --- a/data/systemd/snapd.refresh.service.in +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Automatically refresh installed snaps -After=network-online.target snapd.socket -Requires=snapd.socket -ConditionPathExistsGlob=@SNAP_MOUNT_DIR@/*/current -Documentation=man:snap(1) - -[Service] -Type=oneshot -ExecStart=/bin/sh -c 'if ! @bindir@/snap refresh --time|grep "schedule:.*managed"; then @bindir@/snap refresh; fi' -Environment=SNAP_REFRESH_FROM_EMERGENCY_TIMER=1 diff --git a/data/systemd/snapd.refresh.timer b/data/systemd/snapd.refresh.timer deleted file mode 100644 index 025791f8ca..0000000000 --- a/data/systemd/snapd.refresh.timer +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Timer to automatically refresh installed snaps - -[Timer] -# do a weekly refresh using the time to ensure that we can still -# fix any potential errors in the internal timer handling -OnCalendar=weekly -RandomizedDelaySec=6h -AccuracySec=10min -Persistent=true -OnStartupSec=15m - -[Install] -WantedBy=timers.target diff --git a/packaging/arch/snapd.install b/packaging/arch/snapd.install index 1f9d303dd9..491b4dbb4b 100644 --- a/packaging/arch/snapd.install +++ b/packaging/arch/snapd.install @@ -4,7 +4,7 @@ post_install() { echo 'To use snapd start/enable the snapd.socket' echo echo 'If you want your apps to be automatically updated' - echo 'from the store start/enable the snapd.refresh.timer' + echo 'from the store start/enable the snapd.service' echo echo 'NOTE: Desktop entries show up after logging in again' echo ' or rebooting after snapd installation' @@ -15,9 +15,7 @@ post_install() { _systemctl_do_for_all() { /usr/bin/systemctl "$@" \ snapd.service \ - snapd.socket \ - snapd.refresh.timer \ - snapd.refresh.service > /dev/null 2>&1 + snapd.socket > /dev/null 2>&1 } _stop_services() { @@ -46,9 +44,6 @@ post_upgrade() { if /usr/bin/systemctl -q is-enabled snapd.socket > /dev/null 2>&1; then /usr/bin/systemctl start snapd.socket > /dev/null 2>&1 || : fi - if systemctl -q is-enabled snapd.refresh.timer > /dev/null 2>&1; then - systemctl start snapd.refresh.timer > /dev/null 2>&1 || : - fi } # vim:set ts=2 sw=2 et: diff --git a/packaging/fedora/snapd.spec b/packaging/fedora/snapd.spec index 310d7f5fac..c6a783c2a8 100644 --- a/packaging/fedora/snapd.spec +++ b/packaging/fedora/snapd.spec @@ -50,7 +50,7 @@ %global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider_prefix} -%global snappy_svcs snapd.service snapd.socket snapd.autoimport.service snapd.refresh.timer snapd.refresh.service +%global snappy_svcs snapd.service snapd.socket snapd.autoimport.service # Until we have a way to add more extldflags to gobuild macro... %if 0%{?fedora} >= 26 @@ -601,8 +601,6 @@ popd %{_unitdir}/snapd.socket %{_unitdir}/snapd.service %{_unitdir}/snapd.autoimport.service -%{_unitdir}/snapd.refresh.service -%{_unitdir}/snapd.refresh.timer %{_unitdir}/var-lib-snapd-snap.mount %{_datadir}/dbus-1/services/io.snapcraft.Launcher.service %{_datadir}/polkit-1/actions/io.snapcraft.snapd.policy @@ -676,9 +674,6 @@ if [ $1 -eq 1 ] ; then if systemctl -q is-enabled snapd.socket > /dev/null 2>&1 ; then systemctl start snapd.socket > /dev/null 2>&1 || : fi - if systemctl -q is-enabled snapd.refresh.timer > /dev/null 2>&1 ; then - systemctl start snapd.refresh.timer > /dev/null 2>&1 || : - fi fi %preun diff --git a/packaging/opensuse-42.2/snapd.spec b/packaging/opensuse-42.2/snapd.spec index 8fa59b0730..a66f00dae5 100644 --- a/packaging/opensuse-42.2/snapd.spec +++ b/packaging/opensuse-42.2/snapd.spec @@ -30,7 +30,7 @@ %global with_test_keys 0 %endif -%define systemd_services_list snapd.refresh.timer snapd.refresh.service snapd.socket snapd.service +%define systemd_services_list snapd.socket snapd.service Name: snapd Version: 2.31.1 Release: 0 @@ -288,8 +288,6 @@ fi %verify(not user group mode) %attr(06755,root,root) %{_libexecdir}/snapd/snap-confine %{_mandir}/man1/snap-confine.1.gz %{_mandir}/man5/snap-discard-ns.5.gz -%{_unitdir}/snapd.refresh.service -%{_unitdir}/snapd.refresh.timer %{_unitdir}/snapd.service %{_unitdir}/snapd.socket %{_unitdir}/snap.mount diff --git a/packaging/ubuntu-14.04/snapd.postinst b/packaging/ubuntu-14.04/snapd.postinst index 192beca817..2356fab983 100644 --- a/packaging/ubuntu-14.04/snapd.postinst +++ b/packaging/ubuntu-14.04/snapd.postinst @@ -17,8 +17,8 @@ case "$1" in # snapd.system-shutdown.service is not strictly needed on 14.04. Its functionality # is limited to core devices, we still include it here for the sake of comppleteness # in comparison to 16.04 setups. - systemctl -f enable snapd.refresh.timer snapd.refresh.service snapd.autoimport.service snapd.socket snapd.service snap.mount.service snapd.system-shutdown.service - systemctl start snapd.refresh.timer snapd.autoimport.service snapd.socket snapd.service snap.mount.service + systemctl -f enable snapd.autoimport.service snapd.socket snapd.service snap.mount.service snapd.system-shutdown.service + systemctl start snapd.autoimport.service snapd.socket snapd.service snap.mount.service fi case ":$PATH:" in diff --git a/tests/main/interfaces-snapd-control-with-manage/task.yaml b/tests/main/interfaces-snapd-control-with-manage/task.yaml index 29294c6779..46ab4303db 100644 --- a/tests/main/interfaces-snapd-control-with-manage/task.yaml +++ b/tests/main/interfaces-snapd-control-with-manage/task.yaml @@ -73,13 +73,6 @@ execute: | fi snap refresh --time | MATCH 'schedule: managed' - echo "Check that the snapd.refresh.service is disabled as well" - systemctl start snapd.refresh.service - if snap changes | MATCH "Refresh all snaps"; then - echo "snapd.refresh.service did refresh, this should not happen" - exit 1 - fi - # make sure we trigger a refresh for hints at least once systemctl stop snapd.socket snapd.service jq ".data[\"last-refresh\"] = \"2007-08-22T09:30:44.449455783+01:00\"" /var/lib/snapd/state.json > /var/lib/snapd/state.json.new diff --git a/tests/main/ubuntu-core-services/task.yaml b/tests/main/ubuntu-core-services/task.yaml index d6e524bfb9..11e6c175d4 100644 --- a/tests/main/ubuntu-core-services/task.yaml +++ b/tests/main/ubuntu-core-services/task.yaml @@ -12,6 +12,6 @@ execute: | systemctl status snapd.service |MATCH active echo "Ensure timers are working" - for timer in snapd.refresh.timer snapd.snap-repair.timer; do + for timer in snapd.snap-repair.timer; do systemctl is-active $timer done