Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915613 - app-backup/bacula-11.0.6-r4 port number should not be hard coded in pid filename
Summary: app-backup/bacula-11.0.6-r4 port number should not be hard coded in pid filename
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Beierlein
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-12 00:05 UTC by Christophe PEREZ
Modified: 2023-11-10 10:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe PEREZ 2023-10-12 00:05:56 UTC
I spent hours to understand why I had all my bacula (sd, fd and dir) services considered as crashed.

Port number is hardcoded in the pid filename in init scripts:

# grep pidfile /etc/init.d/bacula*
/etc/init.d/bacula-dir:pidfile=/var/run/bacula-dir.9101.pid
/etc/init.d/bacula-fd:pidfile=/var/run/bacula-fd.9102.pid
/etc/init.d/bacula-sd:pidfile=/var/run/bacula-sd.9103.pid

So, if you change thoses ports, all the services are considered as crashed, even if all is ok

# grep "[Pp]ort =" /etc/bacula/bacula-{fd,sd,dir}.conf
/etc/bacula/bacula-fd.conf:  FDport = 19102
/etc/bacula/bacula-sd.conf:  SDPort = 19103
/etc/bacula/bacula-dir.conf:  DIRport = 19101


# rc-status | grep bacula
 bacula-fd                                                         [  crashed  ]
 bacula-sd                                                         [  crashed  ]
 bacula-dir                                                        [  crashed  ]

# sed -i 's/91/191/g' /etc/init.d/bacula*

# openrc
 * Caching service dependencies ...                                                                         [ ok ]
 * Starting bacula-fd ...                                                                                   [ ok ]
 * Starting bacula-sd ...                                                                                   [ ok ]
 * Starting bacula-dir ...                                                                                  [ ok ]

# rc-status | grep bacula
 bacula-fd                                                         [  started  ]
 bacula-sd                                                         [  started  ]
 bacula-dir                                                        [  started  ]
Comment 1 Thomas Beierlein gentoo-dev 2023-11-08 14:27:00 UTC
Normally you do not need to change the default ports for baculas different parts. It seems especially weird as even /etc/services have them listed.

Anyway after checking how other distros handles the problem it seems that at least ubuntu and suse have the portnumbers also hardcoded in pid-filename or start/stop scripts.

That enables it to run bacula components more than once on the same server. But you are right, that you have to adapt the start/stop script is not quite easy to find out.

I will not change the behaviour but add some comments to bacula-{dir|sd|fd}.conf files to point to the additional needed change of the start/stop scripts.
Comment 2 Christophe PEREZ 2023-11-08 14:36:14 UTC
If you have several stations behind a router, I don't think you have much choice other than to use several different ports for the same service (apart from a VPN). This is the freedom of free software. And then, whatever the reason, if the port is configurable in the bacula configuration, it is because I may have to change it, for whatever reason I like.
Comment 3 Larry the Git Cow gentoo-dev 2023-11-10 10:08:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9cd534404378c3efa83fb42d45e6836cd1be7bc4

commit 9cd534404378c3efa83fb42d45e6836cd1be7bc4
Author:     Thomas Beierlein <tomjbe@gentoo.org>
AuthorDate: 2023-11-10 10:03:46 +0000
Commit:     Thomas Beierlein <tomjbe@gentoo.org>
CommitDate: 2023-11-10 10:07:41 +0000

    app-backup/bacula: Add comment
    
    When changing port numbers of baculas components one needs to adapt the
    pidfile naming in init.d scripts. Add a comment to emphasize this.
    
    Thanks chris@novazur.fr for pointing to the problem.
    
    Closes: https://bugs.gentoo.org/915613
    Signed-off-by: Thomas Beierlein <tomjbe@gentoo.org>

 app-backup/bacula/bacula-11.0.6-r4.ebuild           | 5 +++++
 app-backup/bacula/bacula-11.0.6-r5.ebuild           | 5 +++++
 app-backup/bacula/bacula-13.0.2-r2.ebuild           | 5 +++++
 app-backup/bacula/bacula-13.0.3-r1.ebuild           | 5 +++++
 app-backup/bacula/files/newscripts/bacula-dir.initd | 4 +++-
 app-backup/bacula/files/newscripts/bacula-fd.initd  | 3 ++-
 app-backup/bacula/files/newscripts/bacula-sd.initd  | 4 +++-
 7 files changed, 28 insertions(+), 3 deletions(-)