Hi, Pete. On 05/01/16 04:40, Peter Keller wrote:
>> Yes, I have noticed that after a restart, both processes were not able >> to start and this was because the "bacula" directory I had manually >> created in /var/run had disappeared. How you handle this? > It disappears because /var/run is often on a ramdisk so when > the machine reboots the data is lost forever. AFAICT, most startup scripts > simply mkdir the appropriate directories they need in /var/run and chmod and > chown them to be whatever they need to be. Yes, thanks for the observation. I see that /var/run is a symbolic link to /run which is a tmpfs device. >> The startup scripts in the Debian packaged version uses a >> "create_var_run_dir" function but I don't see its definition within the >> scripts. > I personally think the bacula startup scripts need to create the directories > leading up to the PIDFILE and SUBSYSDIR and ensure they are owned properly. > They currently don't (by inspection). > > In my setup, the Director and Storage daemons are run as the 'bacula' user and > only the File Daemon is root. All bacula config files (and ssl certs which > are bacula related) are owned by 'bacula' in group 'bacula' and are mode 640. > All directories like /var/log/bacula/, /var/run/lock/bacula/, and such > are bacula.bacula and 750. Here too I have compiled using 'bacula' user 'bacula' and 'bacula' group. In my compiled installation directories were created with the following permissions: root@baculatest:~# ll -d /var/log/bacula drwxr-xr-x 2 bacula bacula 4096 Dec 24 19:50 /var/log/bacula root@baculatest:~# ll -d /var/lib/bacula/ drwxrwx--- 2 bacula bacula 4096 Jan 4 21:48 /var/lib/bacula root@baculatest:~# ll -d /etc/bacula/ drwxrwx--- 3 bacula bacula 4096 Jan 4 21:43 /etc/bacula Has you manually changed something to have the permissions that you mentioned? > My personal preference for how bacula is installed on a machine did > not match the defaults bacula chooses. I ended up specifying a pile of > arguments to ./configure to spread the installed files around like more > traditional unix applications do. > > In addition to the LSB info block, I ended up adding this after the respective > variable definition block in each bacula startup script. > > mkdir -p ${PIDDIR} ${SUBSYSDIR} > chown -R bacula.bacula ${PIDDIR} ${SUBSYSDIR} > chmod -R 750 ${PIDDIR} ${SUBSYSDIR} > > That ensures that each startup script created those directories and the races > didn't matter since all interleaved control paths lead to the same thing in > the file system. I found this bug report [1] from some years ago. Seeing again the startup scripts on that basis, I have found (in the Bacula 5.2.6 version of Debian repositories) the definition of the function mentioned in an independent file: ------------------------------------------------------------------------------ backup:~# cat /usr/share/bacula-common/common-functions.init # # Common functions, used from init scripts # create_var_run_dir() { if [ ! -d /var/run/bacula/ ]; then mkdir -p -m 0755 /var/run/bacula/ chown bacula:daemon /var/run/bacula/ fi } ------------------------------------------------------------------------------ In my case I should use the chown with 'bacula: bacula'. > Others on this list may disagree with how I chose to do things and since I'm > new to Bacula, I'm sure they'll have good advice. 7.2.0 wasn't in the repos I > needed and compiling it by hand caused me to take many steps to create an > install in the manner I thought appropriate. YMMV. > > It does seem, though, that I didn't know about 'make install-autostart'. > I'm somewhat surprised since usually the /etc/init.d scripts are > installed by 'make install' in most other unix packages so I wasn't > expecting there to be a special make target for it. I'll have to > figure that out and see if it removes some of the work I was doing > by hand. Neither I did not know :-D I found this when inspect the Makefile options: ------------------------------------------------------------------------------ install: installdirs @for I in $(doc_files) ; do $(INSTALL_DATA) $$I $(DESTDIR)${docdir}; done @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done uninstall: @for I in $(all_subdirs); do (cd $$I && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1); done install-autostart: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-dir: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-fd: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) install-autostart-sd: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-dir: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-fd: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) uninstall-autostart-sd: (cd platforms && $(MAKE) DESTDIR=$(DESTDIR) $@ || exit 1) ------------------------------------------------------------------------------ > However, an inspection of those debian specific startup scripts > just now still leaves out the mkdir/chown/chmod block I need and it > doesn't depend on postgres or mysql in the LSB block (and it doesn't > seem that it can algorithmically choose), so it appears that needs > to be fixed anyway.... Yes. Certainly, the mkdir/chown block was something that I had to manually added. I don't remember if I had also manually added the database dependency block, although it seems so: ------------------------------------------------------------------------------ root@baculatest:/usr/src/bacula/bacula/platforms/debian# diff bacula-dir /etc/init.d/bacula-dir 16a17 > # Should-Start: bacula-fd postgresql mysql 45c46 < PIDFILE=/var/run/${NAME}.${BPORT}.pid --- > PIDFILE=/var/run/bacula/${NAME}.${BPORT}.pid ------------------------------------------------------------------------------ Best regards, Daniel [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452683
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users