A PIDFILE is double-defined for the corosync-notifyd init script

Bug #1437359 reported by Bogdan Dobrelya
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
corosync (Ubuntu)
Fix Released
Undecided
Unassigned
Trusty
Won't Fix
Undecided
Unassigned
Xenial
Won't Fix
Undecided
Unassigned
Bionic
Won't Fix
Wishlist
Miriam España Acebal
Disco
Won't Fix
Undecided
Unassigned
Eoan
Won't Fix
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

[SRU]

[Impact]

 Users that use the sysv services provided by corosync-notifyd and corosync packages
 may find a corosync-notifyd service's misfunction because it uses the pid file
 created by corosync service.

[Test Plan]

 In a new VM with bionic (specifically for this testing):

 #Disabling systemd (this will lead you to a non-usable system at the end for other things, but
 this is only for testing purposes of this bug -systemctl disable <service> didn't work-):
 sudo apt remove --purge systemd

 #Install corosync and corosync-notifyd:
 sudo apt install corosync corosync-notifyd

 #check versions (optional):
 ubuntu@bionic-corosync-sysv:~/Builds$ dpkg -l | grep coro
 ii corosync 2.4.3-0ubuntu1.2 amd64 cluster engine daemon and utilities
 ii corosync-notifyd 2.4.3-0ubuntu1.2 amd64 cluster engine notification daemon
 ii libcorosync-common4:amd64 2.4.3-0ubuntu1.2 amd64 cluster engine common library

 #Start notifyd service:
 ubuntu@bionic-corosync-sysv:/etc/init.d$ sudo ./corosync-notifyd start
 * Starting corosync notifying daemon corosync-notifyd [ OK ]

 #Check that pid filename is not correct:
 ubuntu@bionic-corosync-sysv:/etc/init.d$ l /var/run/coro*
 /var/run/corosync.pid

 #stop de service, check pid file is gone and install new version:
 ubuntu@bionic-corosync-sysv:/etc/init.d$ sudo ./corosync-notifyd stop
 * Stopping corosync notifying daemon corosync-notifyd [ OK ]
 ubuntu@bionic-corosync-sysv:/etc/init.d$ l /var/run/coro*
 ls: cannot access '/var/run/coro*': No such file or directory
 ubuntu@bionic-corosync-sysv:/etc/init.d$ sudo dpkg -i /home/ubuntu/Builds/corosync-notifyd_2.4.3-0ubuntu1.3_amd64.deb
 (Reading database ... 59514 files and directories currently installed.)
 Preparing to unpack .../corosync-notifyd_2.4.3-0ubuntu1.3_amd64.deb ...
 Unpacking corosync-notifyd (2.4.3-0ubuntu1.3) over (2.4.3-0ubuntu1.2) ...
 /var/lib/dpkg/info/corosync-notifyd.postrm: 12: /var/lib/dpkg/info/corosync-notifyd.postrm: systemctl: not found
 Setting up corosync-notifyd (2.4.3-0ubuntu1.3) ...
 Installing new version of config file /etc/init.d/corosync-notifyd ...
 Can't exec "systemctl": No such file or directory at /usr/sbin/update-rc.d line 93.
 /usr/sbin/invoke-rc.d: 282: /usr/sbin/invoke-rc.d: systemctl: not found
 invoke-rc.d: could not determine current runlevel
 invoke-rc.d: WARNING: No init system and policy-rc.d missing! Defaulting to block.
 Processing triggers for dbus (1.12.2-1ubuntu1.2) ...
 Processing triggers for ureadahead (0.100.0-21) ...
 Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

 #Start notifyd service
 ubuntu@bionic-corosync-sysv:/etc/init.d$ sudo ./corosync-notifyd start
 * Starting corosync notifying daemon corosync-notifyd [ OK ]

 #Check pid-filename is now the same as daemon's name (corosync-notifyd):
 ubuntu@bionic-corosync-sysv:/etc/init.d$ l /var/run/coro*
 /var/run/corosync-notifyd.pid

[Where problems could occur]

 The fix is cherrypicked from the Focal's solution, only affects corosync-notifyd and
 corosync services. No other services depend on this pid files. No systemd services affected.

[Other Info]

 This solution follows the example of the same bug fixed in Focal at https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1869622 ,
 alongside bug https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1677684 (in progress to be SRU processed also for Bionic).

 Although the number of users affected by this is a minority, I decided to fix this
 in concordance with that this issue is fixed in Focal and it's a copy/paste error
 easy to understand and without impact in any other application or system.

--------------------------
[Original Description]

A /etc/init.d/corosync-notifyd contains two definitions for the PIDFILE:
> PIDFILE=/var/run/$NAME.pid
> SCRIPTNAME=/etc/init.d/$NAME
> PIDFILE=/var/run/corosync.pid

The first one is correct and the second one is wrong as it refers to the corosync service's pidfile instead

The corosync package version is 2.3.3-1ubuntu1

Related branches

description: updated
Changed in corosync (Ubuntu):
status: New → Triaged
assignee: nobody → Rafael David Tinoco (rafaeldtinoco)
tags: added: ubuntu-ha
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

For the sysv script this still exists...

Changed in corosync (Ubuntu Focal):
assignee: Rafael David Tinoco (rafaeldtinoco) → nobody
Changed in corosync (Ubuntu Disco):
status: New → Won't Fix
Changed in corosync (Ubuntu Trusty):
status: New → Won't Fix
Changed in corosync (Ubuntu Eoan):
status: New → Triaged
Changed in corosync (Ubuntu Xenial):
status: New → Triaged
Changed in corosync (Ubuntu Bionic):
status: New → Triaged
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Okay, this is a very simple fix but it is tricky... mainly because .. possibly 99% of the users of this package are using systemd and the corosync service unit file... which does not face this issue. I'm not entirely sure a SRU is the right thing to do on all affected Ubuntu versions (Xenial, Bionic, Eoan). Will discuss this with the server team.

Meanwhile, fixing Focal seems appropriate just because its not released yet ... :\ but I'll keep this "on the hand" until I have more fixes so I do the SRU all at once.

Changed in corosync (Ubuntu Focal):
status: Triaged → In Progress
Changed in corosync (Ubuntu Xenial):
status: Triaged → In Progress
status: In Progress → Triaged
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

(c)rafaeldtinoco@clusterdev:~/.../sources/ubuntu/corosync$ git diff HEAD
diff --git a/debian/corosync-notifyd.init b/debian/corosync-notifyd.init
index c908618..837e48a 100644
--- a/debian/corosync-notifyd.init
+++ b/debian/corosync-notifyd.init
@@ -21,7 +21,6 @@ NAME=corosync-notifyd
 DAEMON=/usr/sbin/$NAME
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME
-PIDFILE=/var/run/corosync.pid
 RARUNDIR=/var/run/resource-agents

 # Exit if the package is not installed

If anyone faces this issue, just remove the second PIDFILE as it appears to be a leftover. I'll fix this and point this out to Debian as it also faces the same issue. NEVERTHELESS, remember that this issue would only exist if you are using the "sysv" scripts OR the sysv-generator (making systemd to control the service through sysv scripts).

All others are probably relying in systemd to start/stop/monitor corosync daemon (/lib/systemd/system/corosync.service).

tags: added: server-triage-discuss
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package corosync - 3.0.3-2ubuntu2

---------------
corosync (3.0.3-2ubuntu2) focal; urgency=medium

  [Jorge Niedbalski]
  * d/control: corosync binary depends on libqb-dev (LP: #1677684)

  [Rafael David Tinoco]
  * debian/corosync-notifyd.init: fix for 2 PIDFILEs declared (LP: #1437359)
  * Post v3.0.3 release fixes backported to Ubuntu (LP: #1869622)
    debian/patches/ubuntu-v3.0.3-fixes/:
    - lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch
    - lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch
    - lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch
    - lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch
    - lp1869622-29109683-totemknet-Assert-strcpy-length.patch
    - lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch
    - lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch
    - lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch
    - lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch
    - lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch
    - lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch
    - lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch
    - lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch
    - lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch
    - lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch
    - lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch
    - lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch
    - lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch

 -- Rafael David Tinoco <email address hidden> Sun, 29 Mar 2020 21:50:35 +0000

Changed in corosync (Ubuntu Focal):
status: In Progress → Fix Released
Robie Basak (racb)
tags: removed: server-triage-discuss
Revision history for this message
Brian Murray (brian-murray) wrote :

The Eoan Ermine has reached end of life, so this bug will not be fixed for that release

Changed in corosync (Ubuntu Eoan):
status: Triaged → Won't Fix
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

This is still impacting corosync version 2.4.3-0ubuntu1.2 present in Bionic. As described by Rafael this is affecting only non-systemd users which seem to be the minority of our users, so I am setting the importance to Low in Bionic.

Changed in corosync (Ubuntu Bionic):
importance: Undecided → Low
Changed in corosync (Ubuntu Bionic):
assignee: nobody → Miriam España Acebal (mirespace)
status: Triaged → In Progress
Revision history for this message
Miriam España Acebal (mirespace) wrote :

Xenial is now in Extended Security Maintenance (ESM) and this bug doesn't qualify for it, so this bug will not be fixed for that release.

Changed in corosync (Ubuntu Xenial):
status: Triaged → Won't Fix
description: updated
description: updated
Revision history for this message
Robie Basak (racb) wrote :

Using an alternate init system isn't supported on Ubuntu. We support systemd only. Therefore I'm not sure this bug qualifies for an SRU.

Is there any case where a user using systemd would be affected by this bug?

Given the triviality of the fix, maybe we can accept it anyway given it's already uploaded. We can discuss that out of band. But if the upload needs changing because of my comment in bug 1677684 anyway, maybe we should just drop this fix in Bionic.

Revision history for this message
Miriam España Acebal (mirespace) wrote (last edit ):

I'm agree with you Robie... as I made the change for bug 1677684, I'm dropping this. Sorry for the inconveniences.

Changed in corosync (Ubuntu Bionic):
status: In Progress → Won't Fix
importance: Low → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.