[Bug 2055239] Re: Warning: The unit file, source configuration file or drop-ins of {apt-news, esm-cache}.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Nick Rosbrook 2055239 at bugs.launchpad.net
Thu Aug 8 13:42:52 UTC 2024


I have verified the fix using systemd 255.4-1ubuntu3.3 from noble-
proposed.

In a new container, I can see the issue at first:

nr at six:~$ lxc launch ubuntu:noble lp2055239
Launching lp2055239
nr at six:~$ lxc exec lp2055239 bash
root at lp2055239:~# systemctl enable somethingthatdefinitelydoesnotexist.service
Failed to enable unit: Unit file somethingthatdefinitelydoesnotexist.service does not exist.
root at lp2055239:~# systemctl status systemd-resolved.service
Warning: The unit file, source configuration file or drop-ins of systemd-resolved.service changed on disk. Run>
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-08-08 13:34:53 UTC; 43s ago
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
   Main PID: 176 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 18947)
     Memory: 2.6M (peak: 3.3M)
        CPU: 168ms
     CGroup: /system.slice/systemd-resolved.service
             └─176 /usr/lib/systemd/systemd-resolved

Aug 08 13:34:52 lp2055239 systemd[1]: Starting systemd-resolved.service - Network Name Resolution...
Aug 08 13:34:52 lp2055239 systemd-resolved[176]: Positive Trust Anchors:
Aug 08 13:34:52 lp2055239 systemd-resolved[176]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bb>
Aug 08 13:34:52 lp2055239 systemd-resolved[176]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in-a>
Aug 08 13:34:53 lp2055239 systemd-resolved[176]: Using system hostname 'lp2055239'.
Aug 08 13:34:53 lp2055239 systemd[1]: Started systemd-resolved.service - Network Name Resolution.
root at lp2055239:~# apt update
Warning: The unit file, source configuration file or drop-ins of apt-news.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Warning: The unit file, source configuration file or drop-ins of esm-cache.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Get:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:3 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages [15.0 MB]
0% [5 Packages 8229 kB/15.0 MB 55%]^C            

Then, I enabled noble-proposed, upgraded systemd, and the issue was gone:
                 
root at lp2055239:~# cat > /etc/apt/sources.list.d/noble-proposed.sources << EOF
> Types: deb
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: noble-proposed
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
> EOF
root at lp2055239:~# apt update

... SNIP ...

root at lp2055239:~# apt policy systemd
systemd:
  Installed: 255.4-1ubuntu8.2
  Candidate: 255.4-1ubuntu8.2
  Version table:
     255.4-1ubuntu8.3 100
        100 http://us.archive.ubuntu.com/ubuntu noble-proposed/main amd64 Packages
 *** 255.4-1ubuntu8.2 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     255.4-1ubuntu8 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
root at lp2055239:~# apt install systemd -t noble-proposed

... SNIP ...

root at lp2055239:~# apt policy systemd
systemd:
  Installed: 255.4-1ubuntu8.3
  Candidate: 255.4-1ubuntu8.3
  Version table:
 *** 255.4-1ubuntu8.3 100
        100 http://us.archive.ubuntu.com/ubuntu noble-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     255.4-1ubuntu8.2 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
     255.4-1ubuntu8 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages
root at lp2055239:~# systemctl enable somethingthatdefinitelydoesnotexist.service
Failed to enable unit: Unit file somethingthatdefinitelydoesnotexist.service does not exist.
root at lp2055239:~# systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-08-08 13:37:39 UTC; 12s ago
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
             https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
   Main PID: 1681 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 18947)
     Memory: 2.6M (peak: 3.3M)
        CPU: 102ms
     CGroup: /system.slice/systemd-resolved.service
             └─1681 /usr/lib/systemd/systemd-resolved

Aug 08 13:37:38 lp2055239 systemd[1]: Starting systemd-resolved.service - Network Name Resolution...
Aug 08 13:37:39 lp2055239 systemd-resolved[1681]: Positive Trust Anchors:
Aug 08 13:37:39 lp2055239 systemd-resolved[1681]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409b>
Aug 08 13:37:39 lp2055239 systemd-resolved[1681]: Negative trust anchors: home.arpa 10.in-addr.arpa 16.172.in->
Aug 08 13:37:39 lp2055239 systemd-resolved[1681]: Using system hostname 'lp2055239'.
Aug 08 13:37:39 lp2055239 systemd[1]: Started systemd-resolved.service - Network Name Resolution.
root at lp2055239:~# apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu noble-proposed InRelease
Hit:2 http://archive.ubuntu.com/ubuntu noble InRelease                                                     
Hit:3 http://security.ubuntu.com/ubuntu noble-security InRelease             
Hit:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.


** Tags removed: verification-needed verification-needed-noble
** Tags added: verification-done verification-done-noble

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2055239

Title:
  Warning: The unit file, source configuration file or drop-ins of {apt-
  news,esm-cache}.service changed on disk. Run 'systemctl daemon-reload'
  to reload units.

Status in snapd:
  New
Status in systemd package in Ubuntu:
  Fix Released
Status in ubuntu-advantage-tools package in Ubuntu:
  Invalid
Status in systemd source package in Noble:
  Fix Committed
Status in ubuntu-advantage-tools source package in Noble:
  Invalid

Bug description:
  [Impact]

  systemd may incorrectly mark units as needing a daemon reload,
  therefore unnecessarily printing the warning that a daemon-reload is
  needed for the changes to take effect. This is misleading to users,
  and particularly visible in cases like running apt update, since there
  is an apt hook (/etc/apt/apt.conf.d/20apt-esm-hook.conf) that starts
  two systemd services.

  [Test Plan]

  This bug can be triggered by running systemctl enable/disable on a non-existent unit. After that, calling systemctl start/status/etc. will show a false warning
  that the unit changed on disk. Hence, to test, simply:

  $ systemctl enable somethingthatdefinitelydoesnotexist.service
  $ systemctl status systemd-resolved.service 
  $ apt update

  On an effected system, warnings will be shown when calling both
  commands after the "enable non-existent unit" step.

  [Where problems could occur]

  This patch fixes a previous commit by ensuring that the
  manager->unit_file_state_outdated flag is set *only* when some
  modifications succeeded, but the overall operation failed. In cases
  where everything fails, it is not necessary to set the flag.

  Since the patch is restricted to this area, any regressions from this
  patch would most likely also be related to the NeedDaemonReload
  property of units.

  [Other information]

  The patch is from upstream:
  https://github.com/systemd/systemd/pull/32610/commits/d69cba3bfffc7b1e3197e2a34b459db13b1e1cb7#diff-84bbf3361da4139a5620a035ebd24f50a0e4d4ece7952dc2d8b4325e6ebdf6e0L2320

  [Original Description]

  I recently started seeing the following warning messages when I run
  `apt update`.

  $ sudo apt update
  Warning: The unit file, source configuration file or drop-ins of apt-news.service changed on disk. Run 'systemctl daemon-reload' to reload units.
  Warning: The unit file, source configuration file or drop-ins of esm-cache.service changed on disk. Run 'systemctl daemon-reload' to reload units.
  ...

  apt-news.service for example is in /lib/systemd/system/apt-
  news.service and it's a static file managed by the package. Does the
  package maintenance script call systemd related hooks to reload the
  config whenever the package gets updated?

  $ systemctl cat apt-news.service
  # /usr/lib/systemd/system/apt-news.service
  # APT News is hosted at https://motd.ubuntu.com/aptnews.json and can include
  # timely information related to apt updates available to your system.
  ...

  $ dpkg -S /lib/systemd/system/apt-news.service
  ubuntu-pro-client: /lib/systemd/system/apt-news.service

  ProblemType: BugDistroRelease: Ubuntu 24.04
  Package: ubuntu-pro-client 31.1
  ProcVersionSignature: Ubuntu 6.6.0-14.14-generic 6.6.3
  Uname: Linux 6.6.0-14-generic x86_64
  NonfreeKernelModules: zfs
  ApportVersion: 2.28.0-0ubuntu1
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Wed Feb 28 13:06:35 2024
  InstallationDate: Installed on 2024-01-08 (51 days ago)
  InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Daily amd64 (20240104)
  ProcEnviron:
   LANG=en_US.UTF-8
   PATH=(custom, no user)
   SHELL=/bin/bash
   TERM=xterm-256color
   XDG_RUNTIME_DIR=<set>SourcePackage: ubuntu-advantage-tools
  UpgradeStatus: No upgrade log present (probably fresh install)
  apparmor_logs.txt:

  cloud-id.txt-error:
   Failed running command 'cloud-id' [exit(2)]. Message: REDACTED config part /etc/cloud/cloud.cfg.d/99-installer.cfg, insufficient permissions
   REDACTED config part /etc/cloud/cloud.cfg.d/90-installer-network.cfg, insufficient permissions
   REDACTED config part /etc/cloud/cloud.cfg.d/99-installer.cfg, insufficient permissions
   REDACTED config part /etc/cloud/cloud.cfg.d/90-installer-network.cfg, insufficient permissions
  livepatch-status.txt-error: Invalid command specified '/snap/bin/canonical-livepatch status'.
  uaclient.conf:
   contract_url: https://contracts.canonical.com
   log_level: debug

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/2055239/+subscriptions




More information about the foundations-bugs mailing list