[Bug 1621846] [NEW] Type=idle does not actually wait for all running jobs

Martin Pitt martin.pitt at ubuntu.com
Fri Sep 9 11:58:59 UTC 2016


Public bug reported:

In some cases there are running jobs after the default target is reached
(bug 1620780). In this case, commands from Type=idle services are
already started after multi-user.target is reached, not after all
running jobs are finished. This is contrary to what the manpage says:
"execution of the service binary is delayed until all jobs are
dispatched".

This is reproducible with a standard images:ubuntu/yakkety/amd64 lxd
container; add an idle unit with

# cat <<EOF > /etc/systemd/system/xxx.service 
[Unit]
Description=XXX

[Service]
Type=idle
ExecStart=/bin/sh -c 'echo WASHERE; systemctl is-system-running; systemctl list-jobs'

[Install]
WantedBy=multi-user.target
EOF
systemctl enable xxx.service


Then reboot a couple of times until you hit bug 1620780:

● xxx.service - XXX
   Loaded: loaded (/etc/systemd/system/xxx.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2016-09-09 11:49:15 UTC; 1s ago
 Main PID: 221 (code=exited, status=0/SUCCESS)

Sep 09 11:49:15 y1 systemd[221]: xxx.service: Executing: /bin/sh -c 'echo WASHERE; systemctl is-system-running; systemctl list-jobs'
Sep 09 11:49:15 y1 sh[221]: WASHERE
Sep 09 11:49:15 y1 sh[221]: starting
Sep 09 11:49:15 y1 sh[221]: JOB UNIT            TYPE  STATE
Sep 09 11:49:15 y1 sh[221]:   4 dev-sda3.device start running
Sep 09 11:49:15 y1 sh[221]: 1 jobs listed.

So there is still a running job but xxx.service's command already ran.
This breaks assumptions like in bug 1576692.

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: yakkety

** Tags added: yakkety

-- 
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/1621846

Title:
  Type=idle does not actually wait for all running jobs

Status in systemd package in Ubuntu:
  New

Bug description:
  In some cases there are running jobs after the default target is
  reached (bug 1620780). In this case, commands from Type=idle services
  are already started after multi-user.target is reached, not after all
  running jobs are finished. This is contrary to what the manpage says:
  "execution of the service binary is delayed until all jobs are
  dispatched".

  This is reproducible with a standard images:ubuntu/yakkety/amd64 lxd
  container; add an idle unit with

  # cat <<EOF > /etc/systemd/system/xxx.service 
  [Unit]
  Description=XXX

  [Service]
  Type=idle
  ExecStart=/bin/sh -c 'echo WASHERE; systemctl is-system-running; systemctl list-jobs'

  [Install]
  WantedBy=multi-user.target
  EOF
  systemctl enable xxx.service

  
  Then reboot a couple of times until you hit bug 1620780:

  ● xxx.service - XXX
     Loaded: loaded (/etc/systemd/system/xxx.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Fri 2016-09-09 11:49:15 UTC; 1s ago
   Main PID: 221 (code=exited, status=0/SUCCESS)

  Sep 09 11:49:15 y1 systemd[221]: xxx.service: Executing: /bin/sh -c 'echo WASHERE; systemctl is-system-running; systemctl list-jobs'
  Sep 09 11:49:15 y1 sh[221]: WASHERE
  Sep 09 11:49:15 y1 sh[221]: starting
  Sep 09 11:49:15 y1 sh[221]: JOB UNIT            TYPE  STATE
  Sep 09 11:49:15 y1 sh[221]:   4 dev-sda3.device start running
  Sep 09 11:49:15 y1 sh[221]: 1 jobs listed.

  So there is still a running job but xxx.service's command already ran.
  This breaks assumptions like in bug 1576692.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1621846/+subscriptions



More information about the foundations-bugs mailing list