Hi All:
There is an iscsi service that does nothing but create the
initiatorname.iscsi file in /etc/iscsi if it does not yet exist called
iscsi-init.service.
For iscsi boot situations, this service can run quite early, in the
initrd image before the root pivot. Because of this the
DefaultDependencies=no line was added, so it could run earlier. But
because of this change, it can now run too early in the real root. The
problem is that it can actually try to create the initiatorname.iscsi
file before /etc/iscsi is writable! So it generates an error message,
fails to create the initiator name, and it makes the rest of iscsi
services fail, since they depend on iscsi-init.service.
In order to address this, I added this line to the service file:
>
> [Unit]
> ...
> After=root.mount
>
This was an error. I mean to wait for the root disc, not "/root". :( In
testing, this just happened to work on my systems because we use btrfs
by default for the root disc, and btrfs creates a "/root" subvolume
(i.e. mount point).
The mount point target for the root mount is actually called "-.mount".
But even adding this didn't fix my problem with iscsi-init running too
early, and it's because iscsi-init was waiting for the root disc to be
mounted, but it turns out it's mounted read-only for a short time,
before it's remounted read/write. So it was getting an error trying to
create the initiator name file.
Long story shorter, I consulted a systemd expert, and he suggested the
following:
[Unit]
# this adds both Requires= and After=
RequiresMountsFor=/etc/iscsi
# systemd-remount-fs.service is optionally pulled in by
# local-fs.target, don't start it here (no Wants=) but if it's
# running wait for it to finish (After=)
After=systemd-remount-fs.service
and, to keep iscsi-init.service from running before systemd-remote-fs is
scheduled:
[Install]
# just to ensure being in same transaction with
# systemd-remount-fs.service
WantedBy=systemd-remount-fs.service
Testing has show this works on several different systems, but before I
"fix" this again, I thought I'd ask for input, in case anyone has
systemd insight I do not.
Suggestions? If I don't hear anything I'll go with the above
recommendations.
If I can't figure this out my next suggestion is going to be doing away
with this service. Once should not ever be in the situation where there
is no initiator name, since that should be generated when the RPM is
installed IMHO (which is what we do).
--
Lee Duncan
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/open-iscsi/d72a3055-5375-de38-d286-8e88fc6c9487%40suse.com.