Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd and LSB scripts run parallel #172

Closed
ggzengel opened this issue Sep 23, 2015 · 29 comments
Closed

systemd and LSB scripts run parallel #172

ggzengel opened this issue Sep 23, 2015 · 29 comments

Comments

@ggzengel
Copy link

# uname -a
Linux xenserver1 4.1.0-0.bpo.2-amd64 #1 SMP Debian 4.1.6-1~bpo8+1 (2015-09-09) x86_64 GNU/Linux

# cat /etc/apt/sources.list.d/zfsonlinux.list 
deb http://archive.zfsonlinux.org/debian jessie main

On boot I see ZFS pool import twice. One LSB and one Systemd. They run both on same time.

With systemd there is a lot to do. It always import pool by ID:

cat zfs-import-scan.service | grep ExecStart=

ExecStart=/sbin/zpool import -d /dev/disk/by-id -aN

I think this won't work with the code above:
ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id"

Perhaps these are changes from Turbo?
The idea behind this is OK, because I like to import pools by partlabel.

@ggzengel
Copy link
Author

You should make two packages. One for SYSV and one for systemd.

@FransUrbo
Copy link
Contributor

Shouldn't be needed and from what I can tell, no one else is doing that.

There is a recommended, safe way to mix systemd and sysv scripts. This uses the Debian GNU/Linux tools to maintain the two different ways.

Once you enable systemd, the sysv init scripts is disabled. OR, if there is no systemd scripts, the sysv init scripts is converted into systemd config files...

@ggzengel
Copy link
Author

> systemctl cat zfs-import.service 
# /run/systemd/generator.late/zfs-import.service
# Automatically generated by systemd-sysv-generator

[Unit]
SourcePath=/etc/init.d/zfs-import
Description=LSB: Import ZFS pools
DefaultDependencies=no
Before=checkfs.service sysinit.target shutdown.target
After=mtab.service
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=0
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SysVStartPriority=8
ExecStart=/etc/init.d/zfs-import start
ExecStop=/etc/init.d/zfs-import stop
# systemctl list-unit-files | grep zfs
zfs-import-cache.service               static  
zfs-import-scan.service                static  
zfs-mount.service                      static  
zfs-share.service                      static  
xen_zfs.target                         enabled 
zfs.target                             enabled 

I wrote xen_zfs.target:

> systemctl cat xen_zfs.target 
# /etc/systemd/system/xen_zfs.target
[Unit]
Description=Xen needs ZFS/NFS
Requires=zfs-share.service
After=zfs-share.service
Before=xendomains.service

[Install]
RequiredBy=xendomains.service

@ggzengel
Copy link
Author

I forgot this:

> systemctl list-units | grep zfs
zfs-import-cache.service                                                                         loaded active exited    Import ZFS pools by cache file
zfs-import.service                                                                               loaded active exited    LSB: Import ZFS pools
zfs-mount.service                                                                                loaded active exited    Mount ZFS filesystems
zfs-share.service                                                                                loaded active exited    ZFS file system shares
zfs-zed.service                                                                                  loaded active exited    LSB: ZFS Event Daemon
xen_zfs.target                                                                                   loaded active active    Xen needs ZFS/NFS
zfs.target                                                                                       loaded active active    ZFS startup target

@FransUrbo
Copy link
Contributor

The package come with both sysv and systemd scripts included. Don't know why you have a auto-generated script there!

Did you install the packages on a system that didn't use systemd, then changed to systemd and that when the problem started perhaps?

@ggzengel
Copy link
Author

This system was debootstraped from wheezy but with dist jessie early with zfs 2.6.3.
On 2.6.4 I have seen that one package was version wheezy and I changed to jessie later. While changing from wheezy to jessie I was asked something about downgrade.

@ggzengel
Copy link
Author

After bootstraping I booted jessie and after that I added zfs,

@FransUrbo
Copy link
Contributor

Debootstrap don't install systemd for you as far as I know. So somewhere in all that, systemd must have gone active, so my idea sounds plausible.

But that still don't explain why you're running with generated systemd files...

@ggzengel
Copy link
Author

How to get rid of this?
Remove and install again?

@FransUrbo
Copy link
Contributor

I have absolutly no idea!

You could always try using dpkg --purge ….

OR, just move the sysv scripts out the way. Move them to your home directory or something. You can always move them back if it turns out to be a problem.

@ggzengel
Copy link
Author

What's about this? Both should have the same name.

# systemctl list-units | grep zed
zed.service                                                                                      loaded active running   ZFS Event Daemon (zed)
zfs-zed.service                                                                                  loaded active exited    LSB: ZFS Event Daemon

Without LSB ZED it didn't need LSB mount.

@ggzengel
Copy link
Author

I think there should be something about zfs-import.target to have the same name as /etc/init.d/zfs-import.

@ggzengel
Copy link
Author

Why do you not unshare, unmount or export like init.d?

@FransUrbo
Copy link
Contributor

zed.service loaded active running ZFS Event Daemon (zed)

Actually, that is very likely a leftover from an earlier package and shouldn't be there.

I think there should be something about zfs-import.target to have the same name as /etc/init.d/zfs-import.

Yes. And zfs-share and zfs-mount as well!

@ggzengel
Copy link
Author

Sure?

> dpkg -S zfs-zed
zfsutils: /etc/init.d/zfs-zed

 > dpkg -S zed.service
zfsutils: /lib/systemd/system/zed.service

Both have time stamp: Sep 20 10:55

@FransUrbo
Copy link
Contributor

You're right! We must have missed to rename that when the new SYSV init scripts was accepted!

I've opened a different issue about that...

But that was just a side note. It still doesn't explain the original problem you're having.

@FransUrbo
Copy link
Contributor

@dajhorn You've worked with systemd quite a lot, do you have any clue or idea on what could be the problem?

@ggzengel
Copy link
Author

That's exactly the problem. You have 3 active import scripts:

zfs-import-cache.service
zfs-import-scan.service
/etc/init.d/zfs-import

and two off them running at boot time.

@ggzengel
Copy link
Author

Perhaps you rename zfs-import-cache.service to zfs-import.service with all dependencies and the problem is gone.

@FransUrbo
Copy link
Contributor

The two service files do two different things. Or rather, import the pool(s) in different way, so they must both remain. So that isn't the solution either.

@ggzengel
Copy link
Author

Than you have to make a dummy zfs-import.service.

@FransUrbo
Copy link
Contributor

No! You need to take a step back and breath!

We do NOT go around writing code or anything else to fix a possible problem that so far have affected only ONE person out of hundreds, maybe thousands! AND we have not ruled out user error yet!

@ggzengel
Copy link
Author

I don't have only one system.
On the other one with plain jessie installed i have the same:

root@zfs1:~# systemctl list-units | grep zfs
  zfs-import-cache.service                                                                         loaded active exited    Import ZFS pools by cache file
  zfs-import.service                                                                               loaded active exited    LSB: Import ZFS pools
  zfs-mount.service                                                                                loaded active exited    Mount ZFS filesystems
  zfs-share.service                                                                                loaded active exited    ZFS file system shares
● zfs-zed.service                                                                                  loaded failed failed    LSB: ZFS Event Daemon
  zfs.target                                                                                       loaded active active    ZFS startup target

@ggzengel
Copy link
Author

Here is an other system before and after update. Now look and see:

root@xenserver2:~# uname -a
Linux xenserver2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux

root@xenserver2:~# modinfo zfs 
filename:       /lib/modules/3.16.0-4-amd64/updates/dkms/zfs.ko
version:        0.6.4-1.2-1

# dpkg-query -l zfsutils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                Version                Architecture           Description
+++-===================================-======================-======================-============================================================================
ii  zfsutils                            0.6.4-1.2-1            amd64                  command-line tools to manage ZFS filesystems

root@xenserver2:~# ls -la /etc/init.d/z*
-rwxr-xr-x 1 root root 3908 May 28 14:25 /etc/init.d/zed
-rwxr-xr-x 1 root root 5870 May 28 14:25 /etc/init.d/zfs-mount
-rwxr-xr-x 1 root root 2310 May 28 14:25 /etc/init.d/zfs-share

root@xenserver2:~# ls -la /lib/systemd/system/z*
-rw-r--r-- 1 root root 179 Jun 27 13:29 /lib/systemd/system/zed.service
-rw-r--r-- 1 root root 342 Jun 27 13:29 /lib/systemd/system/zfs-import-cache.service
-rw-r--r-- 1 root root 343 Jun 27 13:29 /lib/systemd/system/zfs-import-scan.service
-rw-r--r-- 1 root root 353 Jun 27 13:29 /lib/systemd/system/zfs-mount.service
-rw-r--r-- 1 root root 294 Jun 27 13:29 /lib/systemd/system/zfs-share.service
-rw-r--r-- 1 root root 148 Jun 27 13:29 /lib/systemd/system/zfs.target

root@xenserver2:~# systemctl list-units | grep -e ^z
zed.service                                                                                                   loaded active running   ZFS Event Daemon (zed)
zfs-import-cache.service                                                                                      loaded active exited    Import ZFS pools by cache file
zfs-mount.service                                                                                             loaded active exited    Mount ZFS filesystems
zfs-share.service                                                                                             loaded active exited    ZFS file system shares
zfs.target                                                                                                    loaded active active    ZFS startup target

root@xenserver2:~# systemctl list-unit-files | grep -e ^z
zed.service                            static  
zfs-import-cache.service               static  
zfs-import-scan.service                static  
zfs-mount.service                      static  
zfs-share.service                      static  
zfs.target                             enabled 
root@xenserver2:~# uname -a
Linux xenserver2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux

root@xenserver2:~# modinfo zfs 
filename:       /lib/modules/3.16.0-4-amd64/updates/dkms/zfs.ko
version:        0.6.5.1-4

root@xenserver2:~# dpkg-query -l zfsutils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                Version                Architecture           Description
+++-===================================-======================-======================-============================================================================
ii  zfsutils                            0.6.5.1-4              amd64                  command-line tools to manage ZFS filesystems

root@xenserver2:~# ls -la /etc/init.d/z*
-rwxr-xr-x 1 root root 5549 Sep 23 14:45 /etc/init.d/zfs-import
-rwxr-xr-x 1 root root 5362 Sep 23 14:45 /etc/init.d/zfs-mount
-rwxr-xr-x 1 root root 2252 Sep 23 14:45 /etc/init.d/zfs-share
-rwxr-xr-x 1 root root 2802 Sep 23 14:45 /etc/init.d/zfs-zed


root@xenserver2:~# ls -la /lib/systemd/system/z*
-rw-r--r-- 1 root root 179 Sep 23 14:45 /lib/systemd/system/zed.service
-rw-r--r-- 1 root root 342 Sep 23 14:45 /lib/systemd/system/zfs-import-cache.service
-rw-r--r-- 1 root root 343 Sep 23 14:45 /lib/systemd/system/zfs-import-scan.service
-rw-r--r-- 1 root root 353 Sep 23 14:45 /lib/systemd/system/zfs-mount.service
-rw-r--r-- 1 root root 294 Sep 23 14:45 /lib/systemd/system/zfs-share.service
-rw-r--r-- 1 root root 148 Sep 23 14:45 /lib/systemd/system/zfs.target

root@xenserver2:~# systemctl list-units | grep -e ^..z
  zed.service                                                                                      loaded active running   ZFS Event Daemon (zed)
  zfs-import-cache.service                                                                         loaded active exited    Import ZFS pools by cache file
  zfs-import.service                                                                               loaded active exited    LSB: Import ZFS pools
  zfs-mount.service                                                                                loaded active exited    Mount ZFS filesystems
  zfs-share.service                                                                                loaded active exited    ZFS file system shares
● zfs-zed.service                                                                                  loaded failed failed    LSB: ZFS Event Daemon
  zfs.target                                                                                       loaded active active    ZFS startup target


@FransUrbo
Copy link
Contributor

My point is that this more and more seems like an upstream problem. SYSV init scripts and systemd should not run at the same time.

Could you take this to either the Debian GNU/Linux bug tracker or, preferable, to their mailing lists.

Granted, ZFS isn't supported by them (yet), but it seems to be a problem with their tools or something.

@ggzengel
Copy link
Author

No, you are absolutely wrong.,
If you add /etc/init.d/zfs-import and don't add zfs-import.service it will use /etc/init.d.

@FransUrbo
Copy link
Contributor

You're completely missing my point and isn't listening to what I'm saying.

I can't reproduce this (and no one else seems to have ever seen this problem) so I'm going to close this as an upstream (Debian GNU/Linux) issue - OR user error.

If you come back with references from their bug tracker and/or mailing list that's stating that it's something I have done, we can reopen it.

@ggzengel
Copy link
Author

I bet everybody with plain jessie with systemd will have this issue.

@ggzengel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants