ngircd refuses to start automatically through sysv init

Bug #85266 reported by Markus Bertheau
10
Affects Status Importance Assigned to Milestone
ngircd (Ubuntu)
Fix Released
Medium
Adrien Cunin
Hardy
Fix Released
Medium
Adrien Cunin

Bug Description

Binary package hint: ngircd

Reason seems to be that the init script uses /var/run/ngircd/ngircd.pid as pidfile, but the /var/run/ngircd directory doesn't exist, so start-stop-daemon complains.

Note that directly after installation the daemon started correctly, just not after a reboot.

Proposed fix: use /var/run/ngircd.pid as pidfile, as a lot of other daemons do.

-- SRU for hardy

This bug makes the daemon fail to start after each reboot of the computer, because the init script doesn't create /var/run/ngircd/ and /var/run/ is a tmpfs in Ubuntu. The fix is pretty safe, it's a one-liner creating that directory with mkdir -p. It is exactly the same as the one in intrepid.

TEST CASE: install ngircd, reboot your computer, see it fails to start. install the -proposed ngircd, reboot your computer, see it starts successfully.

Revision history for this message
Kevin Otte (nivex) wrote :

Still seeing this as of the gutsy upgrade. Alternate workaround is this in /etc/rc.local:

# ngircd lock directory workaround
mkdir /var/run/ngircd/

and then making sure rc.local runs at priority 11.

This bug was seen with both mrtg and smokeping. I believe their final fixes were to do detection of the lockfile directory as part of the initscript and create it if it did not exist.

Kevin Otte (nivex)
Changed in ngircd:
status: New → Confirmed
Revision history for this message
Kevin Otte (nivex) wrote :

I just verified on a newly upgraded Hardy machine that the ngircd pid directory is being created properly by the initscript. This bug is probably safe to close.

Revision history for this message
Kevin Otte (nivex) wrote :

Perhaps I spoke too soon. I just rebooted my hardy server last night and there was a complaint about /var/run/ngircd not existing during bootup.
( I hate intermittent bugs :-/ )

Revision history for this message
m4v (m4v) wrote :

I just edited the /etc/init.d/ngircd initscript so It would use /var/run/ngircd.pid as a pidfile

@@ -28,7 +28,7 @@
        echo -n "Starting Next generation IRC server: "
        start-stop-daemon --start --chuid irc:irc \
        --make-pidfile --background \
- --pidfile /var/run/ngircd/ngircd.pid \
+ --pidfile /var/run/ngircd.pid \
        --exec /usr/sbin/ngircd -- -n
        echo "ngircd."
        ;;
@@ -36,16 +36,16 @@
   stop)
        echo -n "Stopping Next generation IRC server: "
        start-stop-daemon --stop --quiet \
- --pidfile /var/run/ngircd/ngircd.pid \
+ --pidfile /var/run/ngircd.pid \
        --exec /usr/sbin/ngircd
- rm -f /var/run/ngircd/ngircd.pid
+ rm -f /var/run/ngircd.pid
        echo "ngircd."
        ;;

   reload|force-reload)
        echo -n "Reloading Next generation IRC server configuration: "
        start-stop-daemon --stop --quiet --oknodo --signal 1 \
- --pidfile /var/run/ngircd/ngircd.pid \
+ --pidfile /var/run/ngircd.pid \
        --exec /usr/sbin/ngircd
        echo "ngircd."
        ;;

Adrien Cunin (adri2000)
Changed in ngircd:
assignee: nobody → adri2000
Adrien Cunin (adri2000)
Changed in ngircd:
importance: Undecided → Medium
status: Confirmed → In Progress
assignee: nobody → adri2000
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ngircd - 0.10.3-2ubuntu1

---------------
ngircd (0.10.3-2ubuntu1) intrepid; urgency=low

  * debian/ngircd.init: create /var/run/ngircd/ before starting the daemon
    (LP: #85266)

 -- Adrien Cunin <email address hidden> Sat, 06 Sep 2008 17:18:04 +0200

Changed in ngircd:
status: In Progress → Fix Released
Revision history for this message
Adrien Cunin (adri2000) wrote :

Fixed in intrepid, will be fixed in hardy. For older releases, use a work-around, eg. just apply the following one-liner patch to the init script:

@@ -26,6 +26,7 @@

   start)
        echo -n "Starting Next generation IRC server: "
+ mkdir -p /var/run/ngircd/
        start-stop-daemon --start --chuid irc:irc \
        --make-pidfile --background \
        --pidfile /var/run/ngircd/ngircd.pid \

Adrien Cunin (adri2000)
description: updated
Revision history for this message
Adrien Cunin (adri2000) wrote :

Attached is what I just uploaded to hardy-proposed.

Revision history for this message
Martin Pitt (pitti) wrote :

Needs approval from motu-sru.

Revision history for this message
Luca Falavigna (dktrkranz) wrote :

ACK from motu-sru

Changed in ngircd:
status: In Progress → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in ngircd:
status: Confirmed → Fix Committed
Revision history for this message
Cesare Tirabassi (norsetto) wrote :

This should also close bug 127496. Will verify both cases as soon as binary is available.

Revision history for this message
Cesare Tirabassi (norsetto) wrote :

The verification fails:

Stopping Next generation IRC server: invoke-rc.d: initscript ngircd, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Stopping Next generation IRC server: invoke-rc.d: initscript ngircd, action "stop" failed.
dpkg: error processing ngircd_0.10.3-2ubuntu0.1_amd64.deb (--install):
 subprocess new pre-removal script returned error exit status 1
Starting Next generation IRC server: start-stop-daemon: Unable to open pidfile `/var/run/ngircd/ngircd.pid' for writing: No such file or directory (No such file or directory)
ngircd.

One possible solution is to check if /var/run/ngircd/ngircd.pid exists before calling start-stop-daemon in the stop action of the init script. Other solutions (which I haven't tested) could be to use oknodo or error-handler. One can also think to have the check before the case to also cover the reload and force-reload actions (but that would go too far for this purpose I guess).

Revision history for this message
Adrien Cunin (adri2000) wrote :

Uploaded 0.10.3-2ubuntu0.2, debdiff attached.

Changed in ngircd:
status: Fix Committed → In Progress
Revision history for this message
Adrien Cunin (adri2000) wrote :

(I fixed this in intrepid as well, the patches are identical.)

Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

I just tested Adrien's last solution, it works fine for me :

- I installed the current ngircd.
- I stopped the daemon.
- I removed /var/run/ngircd/
- I installed Adrien's patched package.

The package installed smoothly and the daemon starts/stops correctly.

Revision history for this message
John Dong (jdong) wrote :

ack from ~motu-sru for 0.2

Revision history for this message
Jonathan Riddell (jr) wrote :

accepted 0.10.3-2ubuntu0.2 into hardy-proposed, please test.

Revision history for this message
Jonathan Riddell (jr) wrote :

This is also bug 127496

Changed in ngircd:
status: In Progress → Fix Committed
Revision history for this message
Cesare Tirabassi (norsetto) wrote :

The new package in -proposed permits update and removal.

Changed in ngircd:
status: Fix Committed → Fix Released
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.