iscsid autostarts on all servers when it has nothing to do
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
open-iscsi (Debian) |
Fix Released
|
Unknown
|
|||
open-iscsi (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Xenial |
New
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
High
|
Unassigned |
Bug Description
[Impact]
* Service is running uselessly which is consuming a few cycles/memory as
well as raising general concerns e.g. on minimizing attack surface of
a system.
* This is also the only service in a default server install which pulls in the network-
* Fix by switching to socket activation
[Test Case]
* After installing open-iscsi (which is default installed) the service
iscsid is running which is mostly useless
- this is a bit critical, as we don't want to stop a running service.
- so you have two cases
1. uninstall the package before upgrade; then install the new version.
should be service off, socket on
2. upgrade install, should have service (still) on, socket enabled.
3. after 2. reboot should be service off, socket on
* Also ensure that iscsid.service should come up as needed
# should be off
$ systemctl status iscsid.service iscsid.socket
$ iscsiadm -m discovery -t sendtargets -p 127.0.0.1
# should be enabled now
$ systemctl status iscsid.service iscsid.socket
[Regression Potential]
* We were discussing if we shall SRU this. First of all the change should
work as in the new version, abstract sockets are not super new.
* We were concerned that one would have e.g. scripts and other upper
level code that does like:
if service-
This would give up before socket-triggering it which might be too much
to SRU. On a Upgrade to a newer release such minor adaptions are usual,
but for SRUs?
But in any config using it it will run, and as slangasek outlined " I
think anyone checking for the running status of an open-iscsi service,
on a system that does not have any iscsi targets configured, is writing
buggy code and that should not be catered to in the face of the
significant impact this bug has on all other users of Ubuntu Server."
* But also we don't stop the service on upgrade (for safety of the data),
so you'd have four different Bionics
a) old iscsid.service runnign by default
b) upgraded, but not rebooted iscsid.service still running
c) upgraded, rebooted iscid.service disabled,
iscsid.socket running
d) new deploy after this (e.g. new cloud image) iscid.service disabled,
iscsid.socket running
a+b are similar as well as c+d.
* If anyone strictly needs the old behavior it is a config, so one can
"systemctl enable iscsid.service" and is done.
* OTOH in our discussion it was agreed that the upgrade regression we fix
outweighs the potential regression.
[Other Info]
* The SRU of this change caused a regression described in bug 1802354.
---
In bionic, the open-iscsi systemd unit has the following guards to keep it from running on systems with no iscsi targets configured:
# Must have some pre-defined targets to login to
ConditionDirect
# or have a session to use via iscsid
ConditionDirect
However, iscsid starts from a separate unit and does not include this check. Thus, iscsid starts on every Ubuntu Server install, whether or not it has anything to do.
We should replicate these unit conditionals to the iscsid unit, to ensure the daemon doesn't run (consuming memory, and slowing boot) when not needed.
Related bugs:
* bug 1630946: ubuntu-server depends on open-iscsi and runs iscsid
* bug 1802354: iscsid does not run if there are only initramfs initiated targets
Related branches
- Bryce Harrington (community): Approve
- Canonical Server: Pending requested
- Rafael David Tinoco: Pending requested
-
Diff: 24923 lines (+4835/-457)29 files modifieddebian/changelog (+987/-0)
debian/control (+4/-2)
debian/extra/initramfs.hook (+1/-1)
debian/extra/initramfs.local-bottom (+20/-0)
debian/extra/initramfs.local-top (+30/-2)
debian/extra/net-interface-handler (+80/-0)
debian/iscsi-network-interface.rules (+3/-0)
debian/iscsid.service (+1/-1)
debian/open-iscsi.finalrd (+40/-0)
debian/open-iscsi.postinst (+25/-40)
debian/open-iscsi.service (+6/-6)
debian/patches/lp1755858-default-iscsid_conf-to-iscsid_socket.patch (+30/-0)
debian/patches/series (+1/-0)
debian/rules (+27/-8)
debian/tests/README-boot-test.md (+139/-0)
debian/tests/control (+4/-0)
debian/tests/get-image (+227/-0)
debian/tests/install (+5/-2)
debian/tests/patch-image (+374/-0)
debian/tests/test-open-iscsi.py (+426/-0)
debian/tests/testlib.py (+1153/-0)
debian/tests/testsuite (+7/-0)
debian/tests/tgt-boot-test (+534/-0)
debian/tests/xkvm (+704/-0)
dev/null (+0/-395)
iscsiuio/src/.gitignore (+1/-0)
iscsiuio/src/unix/.gitignore (+1/-0)
test/.gitignore (+3/-0)
test/harness/.gitignore (+2/-0)
- Christian Ehrhardt (community): Approve
- git-ubuntu developers: Pending requested
-
Diff: 220 lines (+97/-17)9 files modifieddebian/changelog (+18/-0)
debian/iscsid.service (+1/-0)
debian/iscsid.socket (+9/-0)
debian/open-iscsi.postinst (+26/-6)
debian/open-iscsi.service (+6/-6)
debian/patches/iscid-conf-use-systemd.socket-patch (+28/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-3)
debian/tests/install (+5/-2)
- Christian Ehrhardt (community): Approve
- git-ubuntu developers: Pending requested
-
Diff: 269 lines (+90/-87)8 files modifieddebian/changelog (+16/-0)
debian/iscsid.socket (+9/-0)
debian/open-iscsi.postinst (+26/-77)
debian/open-iscsi.service (+2/-6)
debian/patches/iscid-conf-use-systemd.socket-patch (+28/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-2)
debian/tests/install (+5/-2)
- Robie Basak: Approve
- Canonical Server: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 269 lines (+90/-87)8 files modifieddebian/changelog (+16/-0)
debian/iscsid.socket (+9/-0)
debian/open-iscsi.postinst (+26/-77)
debian/open-iscsi.service (+2/-6)
debian/patches/iscid-conf-use-systemd.socket-patch (+28/-0)
debian/patches/series (+1/-0)
debian/rules (+3/-2)
debian/tests/install (+5/-2)
Changed in open-iscsi (Ubuntu): | |
importance: | Undecided → High |
status: | New → Triaged |
assignee: | nobody → Mathieu Trudel-Lapierre (cyphermox) |
description: | updated |
description: | updated |
Changed in open-iscsi (Debian): | |
status: | Unknown → New |
Changed in open-iscsi (Ubuntu Bionic): | |
status: | Won't Fix → Triaged |
description: | updated |
description: | updated |
Changed in open-iscsi (Ubuntu Bionic): | |
assignee: | nobody → Dimitri John Ledkov (xnox) |
description: | updated |
description: | updated |
description: | updated |
Changed in open-iscsi (Debian): | |
status: | New → Fix Released |
Status of a clean install in a VM and/or Container, so testable rather trivial:
$ systemctl status iscsid open-iscsi system/ iscsid. service; enabled; vendor preset: enabled) /sbin/iscsid (code=exited, status=0/SUCCESS) /lib/open- iscsi/startup- checks. sh (code=exited, status=0/SUCCESS) slice/iscsid. service
● iscsid.service - iSCSI initiator daemon (iscsid)
Loaded: loaded (/lib/systemd/
Active: active (running) since Wed 2018-05-23 10:52:11 UTC; 7min ago
Docs: man:iscsid(8)
Process: 751 ExecStart=
Process: 721 ExecStartPre=
Main PID: 759 (iscsid)
Tasks: 2 (limit: 548)
CGroup: /system.
├─754 /sbin/iscsid
└─759 /sbin/iscsid
May 23 10:52:11 b1 systemd[1]: Starting iSCSI initiator daemon (iscsid)...
May 23 10:52:11 b1 systemd[1]: iscsid.service: Failed to parse PID from file /run/iscsid.pid: Invalid argument
May 23 10:52:11 b1 iscsid[754]: iSCSI daemon with pid=759 started!
May 23 10:52:11 b1 systemd[1]: Started iSCSI initiator daemon (iscsid).
● open-iscsi.service - Login to default iSCSI targets system/ open-iscsi. service; enabled; vendor preset: enabled) oryNotEmpty= |/etc/iscsi/ nodes was not met oryNotEmpty= |/sys/class/ iscsi_session was not met
man: iscsid( 8)
Loaded: loaded (/lib/systemd/
Active: inactive (dead)
Condition: start condition failed at Wed 2018-05-23 10:52:11 UTC; 7min ago
├─ ConditionDirect
└─ ConditionDirect
Docs: man:iscsiadm(8)
It is important to note that these are not "the same" service twice. system/ open-iscsi. service /lib/systemd/ system/ iscsid. service system/ open-iscsi. service system/ iscsid. service
both belong to the same package:
dpkg -S /lib/systemd/
open-iscsi: /lib/systemd/
open-iscsi: /lib/systemd/
But the two are doing rather different things:
open-iscsi.service: logs into iSCSI targets if some are configured (Condition stops it from doing so) - this is more a one-shot configure-devices and not a real service
iscsi.service: the basic service daemone, required by the service above
I think here we might learn from Fedora: systemd/ system/ iscsid. socket; enabled; vendor preset: disabled)
man: iscsiadm( 8) ABSTRACT_ NAMESPACE (Stream)
Default is:
[root@fedora ~]# systemctl status iscsid.socket iscsid.service
● iscsid.socket - Open-iSCSI iscsid Socket
Loaded: loaded (/usr/lib/
Active: active (listening) since Wed 2018-05-23 11:26:37 UTC; 9s ago
Docs: man:iscsid(8)
Listen: @ISCSIADM_
May 23 11:26:37 fedora systemd[1]: Listening on Open-iSCSI iscsid Socket.
● iscsid.service - Open-iSCSI systemd/ system/ iscsid. service; disabled; vendor preset: disabled)
man: iscsiadm( 8)
Loaded: loaded (/usr/lib/
Active: inactive (dead)
Docs: man:iscsid(8)
May 23 11:26:09 fedora systemd[1]: iscsid.service: Failed to reset devices.list: Operation not permitted
May 23 11:26:09 fedora systemd[1]: Starting Open-iSCSI...
And the related config in /etc/iscsid.conf says:
# Use socket activation, but try to make sure the socket units are listening
iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket
(We don't have the uio, but you get the idea - initially only ensure the socket runs.)
The socket then does:
# syste...