Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bacula: fix for #89057 - systemd and bacula fight #106689

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redvers
Copy link
Member

@redvers redvers commented Dec 11, 2020

The application's hard-coded working directory was set to /var/lib/bacula.
Thie directory is also used by systemd which changes the ownership
of that direction to root meaning the application can't write to it.

This fix provides an additional configuration option which allows our
configuration to specify a new working directory.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@redvers
Copy link
Member Author

redvers commented Dec 12, 2020

[root@apophenia:~/projects/nixpkgs]# systemctl | grep bac
  bacula-dir.service                                                                            loaded active running   Bacula Director Daemon
  bacula-fd.service                                                                             loaded active running   Bacula File Daemon
  bacula-sd.service                                                                             loaded active running   Bacula Storage Daemon

Success!

@redvers
Copy link
Member Author

redvers commented Dec 12, 2020

(At some point in the future I intend to do a significant refactor of this module - but I wanted to just get it working first since it's been broken for a while)

@redvers redvers changed the title bacula: fix for #89057 - systemd and bacula fight! [WIP]! bacula: fix for #89057 - systemd and bacula fight! Dec 12, 2020
The application's hard-coded working directory was set to /var/lib/bacula.
Thie directory is also used by systemd which changes the ownership
of that direction to root meaning the application can't write to it.

This fix provides an additional configuration option which allows our
configuration to specify a new working directory.

Added self to list of maintainers.
@alyssais
Copy link
Member

Hi, the right way to fix this sort of problem is to set StateDirectory, which tells systemd to make a directory writable by the service. Did you try that? If you haven’t, there are lots of examples of other services that use it that you could look at to see how to do it.

@alyssais
Copy link
Member

Ah, I’ve looked a bit closer. I think the real reason this wasn’t working is that User and Group aren’t set on the units, so systemd assumes the unit will be run by root. Could you try setting those to see if it helps?

@redvers
Copy link
Member Author

redvers commented Dec 15, 2020

I have not tried that - let me investigate that and get back to you. Thank you for the feedback!

@redvers
Copy link
Member Author

redvers commented Dec 15, 2020

@alyssais - I tried it, but bacula-fd needs to run as root. :-/

@aanderse
Copy link
Member

@alyssais - I tried it, but bacula-fd needs to run as root. :-/

It might be possible to avoid that, but I haven't dug into this in any detail at all.

@redvers
Copy link
Member Author

redvers commented Dec 15, 2020

After nuking my existing State I've found another bug in the module and package that needs to be fixed.

Marking WIP again.,

@redvers redvers changed the title bacula: fix for #89057 - systemd and bacula fight! bacula: fix for #89057 - systemd and bacula fight! [WIP] Dec 15, 2020
@wucke13
Copy link
Contributor

wucke13 commented Jul 5, 2021

@redvers What is the current state of your work? I'd be happy to have this done eventually. Let me know if I can be of any help.

@SuperSandro2000 SuperSandro2000 changed the title bacula: fix for #89057 - systemd and bacula fight! [WIP] bacula: fix for #89057 - systemd and bacula fight Jul 5, 2021
@SuperSandro2000 SuperSandro2000 marked this pull request as draft July 5, 2021 21:45
@stale
Copy link

stale bot commented Jan 3, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants