Bug 181160 - Port sysutils/bacula-client - All bacula-fd processes killed when upgrading port
Summary: Port sysutils/bacula-client - All bacula-fd processes killed when upgrading port
Status: Closed DUPLICATE of bug 91311
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Ruslan Makhmatkhanov
Depends on:
Reported: 2013-08-09 13:00 UTC by Kai Gallasch
Modified: 2014-08-07 23:09 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Kai Gallasch 2013-08-09 13:00:01 UTC
* FreeBSD Port sysutils/bacula-client and "killall" in pkg-plist.client *

Upgrading bacula-client on a jail server running jails with other bacula-client processes ("bacula-fd") kills all bacula-cient processes. They do not get restartet afer upgrading..

$cat /usr/ports/sysutils/bacula-server/pkg-plist.client

@unexec /usr/bin/killall bacula-fd > /dev/null 2>&1 || true
@exec mkdir -p %%BACULA_DIR%%
@dirrmtry %%BACULA_DIR%%
@dirrmtry share/bacula

Here you are using "@unexec /usr/bin/killall bacula-fd > /dev/null 2>&1 || true"

I maintain some multijail-servers hosting about 50 jails per server and I have bacula-client running on the jail-host itself and also inside on a great part of the jails (because this makes it easier for me to relocate jails to different jail-hosts and not having to worry that they are actually being backepd up, also because bacula-server becomes unusable slow when restoring to a bacula-client hosting millions of files or many jails - I guess database limitations.)

If I do a pkg upgrade of bacula-client on the jail-host, "killall" is killing all running bacula-fd processes on the jailhost, also the bacula-fd processes inside all of the jails.

Fix: I  propose the following patch for pkg-plist.client:

This of course makes the assumption that there is bacula-fd .pid file in /var/run

Looking at /usr/local/etc/bacula-fd.conf.sample I assume it is the common case that users have
"Pid Directory = /var/run" confuigured into bacula-fd.conf

The more universal solution would be to come up with a short script that a) uses pkill for killing purposes  b) checks if it is running inside or outside a jail (sysctl) c) makes sure pkill only shoots down the wanted bacula-fd process inside (jailed) or outside (host).

Besides: Why not use the bacula rc script in /usr/local/etc/rc.d/ for stopping/starting bacula-client?
I think this could be achieved by using "@stopdaemon bacula-fd" in pkg-plist.client

I'd favour a solution where portupgrade stops bacula-fd by using the rc script, upgrades the port and then starts bacula-fd (also by rc script).--jLe9faT1604tANq5bnSFjZDW8DgxS3i8NmF3f7rfnLyf0eSp
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- pkg-plist.client	2012-12-16 17:32:45.000000000 +0100
+++ pkg-plist.client.patched	2013-07-08 11:25:05.092088611 +0200
@@ -13,7 +13,7 @@
-@unexec /usr/bin/killall bacula-fd > /dev/null 2>&1 || true
+@unexec kill `cat /var/run/bacula-fd*.pid` > /dev/null 2>&1 || true
@exec mkdir -p %%BACULA_DIR%%
@dirrmtry %%BACULA_DIR%%
@dirrmtry share/bacula
How-To-Repeat: Upgrade bacula-client on a jail-host running bacula-client inside hosted jails.
Comment 1 Edwin Groothuis freebsd_committer 2013-08-09 13:00:16 UTC
Maintainer of sysutils/bacula-client,

Please note that PR ports/181160 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:

Edwin Groothuis via the GNATS Auto Assign Tool
Comment 2 Edwin Groothuis freebsd_committer 2013-08-09 13:00:17 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Dan Langille 2013-08-09 13:51:04 UTC
Thank you for submitting this patch.

I encountered the same problem earlier this month, and started a =
discussion on the Bacula users mailing list:


What do you think of removing the kill entirely?
Comment 4 Kai Gallasch 2013-08-14 16:51:06 UTC
I've reworked my proposed patch for sysutils/bacula-client amd also did =
a patch for sysutils/bacula-server

Daemons are now stopped by using "@stopdaemon" - so "kill" is not needed =
any more..

After doing a portupgrade the bacula daemons have to be restarted =
This is an approach many freebsd ports chose to take.


--- sysutils/bacula-server/pkg-plist.client	2012-12-16 =
17:32:45.000000000 +0100
+++ sysutils/bacula-server/pkg-plist.client.patched	2013-07-08 =
11:25:05.092088611 +0200
@@ -13,7 +13,7 @@
-@unexec /usr/bin/killall bacula-fd > /dev/null 2>&1 || true
@stopdaemon bacula-fd
@exec mkdir -p %%BACULA_DIR%%
@dirrmtry %%BACULA_DIR%%
@dirrmtry share/bacula

For sysutils/bacula-server I propose the following patch for pkg-plist:

--- sysutils/bacula-server/pkg-plist	2012-12-16 17:32:45.000000000 =
+++ sysutils/bacula-server/pkg-plist.patched	2013-08-14 =
17:37:48.830595374 +0200
@@ -51,7 +51,7 @@
 @dirrm %%DATADIR%%
-@unexec /usr/bin/killall bacula-sd  > /dev/null 2>&1 || true
-@unexec /usr/bin/killall bacula-dir > /dev/null 2>&1 || true
+@stopdaemon bacula-sd
+@stopdaemon bacula-dir
 @exec mkdir -p %%BACULA_DIR%%
 @dirrmtry %%BACULA_DIR%%
Comment 5 Dan Langille 2013-08-14 17:11:18 UTC
Maintainer approves the patch which removes stopping of daemons.  :)

Dan Langille - http://langille.org
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2013-08-15 03:06:44 UTC
State Changed
From-To: feedback->open

Maintainer approved.
Comment 7 Ruslan Makhmatkhanov freebsd_committer 2013-08-29 18:42:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rm

I will take it.
Comment 8 Dan Langille 2013-11-21 15:58:27 UTC
Comment 9 R.Mahmatkhanov 2013-12-23 21:24:27 UTC

I'm seeing this while building with poudriere:
===>   Registering installation for bacula-server-5.2.12_4
pkg-static: fopen(/usr/ports/Keywords/stopdaemon.yaml): No such file or 
pkg-static: unknown keyword stopdaemon, ignoring @stopdaemon
pkg-static: fopen(/usr/ports/Keywords/stopdaemon.yaml): No such file or 
pkg-static: unknown keyword stopdaemon, ignoring @stopdaemon
pkg-static: duplicate directory listing: /usr/local/etc/bacula/, ignoring
Installing bacula-server-5.2.12_4... done

So it seems like this isn't working. Should we do something with that?

Here is the full log for example:


T.O.S. Of Reality
Comment 10 Ruslan Makhmatkhanov freebsd_committer 2013-12-23 21:54:23 UTC
State Changed
From-To: open->feedback

Awaiting maintainer's feedback.
Comment 11 Dan Langille freebsd_committer 2014-08-05 14:44:42 UTC
This bug will be fixed by #91311
Comment 12 Dan Langille freebsd_committer 2014-08-07 23:09:20 UTC

*** This bug has been marked as a duplicate of bug 91311 ***