Bug 657216
| Summary: | Providing native systemd file for upcoming F15 Feature Systemd | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Tomasz Torcz <tomek> |
| Component: | bacula | Assignee: | Andreas Thienemann <andreas> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | rawhide | CC: | andreas, dnovotny, fschwarz, gwync, hgkamath, hhorak, jgorig, johannbg, lpoetter, maurizio.antillon, mmcgrath, rvokal, vanmeeuwen+fedora |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | bacula-5.0.3-11.fc16 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-09-30 18:45:15 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 713562 | ||
| Attachments: | |||
|
Description
Tomasz Torcz
2010-11-25 08:48:51 UTC
Created attachment 462847 [details]
bacula-fd.service for file daemon
Created attachment 462848 [details]
bacula-sd.service unit for storage daemon
Fedora-15 alpha
Won't start using init script, systemctl or service
Eventually started using commandline
for i in dir sd fd ; do bacula-${i} -c /etc/bacula/bacula-${i}.conf ; done
# /etc/rc.d/init.d/bacula-dir start
Starting bacula-dir (via systemctl): [ OK ]
# /etc/rc.d/init.d/bacula-dir status
bacula-dir.service - SYSV: Bacula-dir is the Backup-server, which is the program that schedules backups and controls the bacula-client and the bacula-storage daemons.
Loaded: loaded (/etc/rc.d/init.d/bacula-dir)
Active: active (exited)
Process: 25657 ExecStop=/etc/rc.d/init.d/bacula-dir stop (code=exited, status=0/SUCCESS)
Process: 25698 ExecStart=/etc/rc.d/init.d/bacula-dir start (code=exited, status=0/SUCCESS)
Main PID: 25704 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/bacula-dir.service
# service bacula-dir start
Starting bacula-dir (via systemctl): [ OK ]
# service bacula-dir status
bacula-dir.service - SYSV: Bacula-dir is the Backup-server, which is the program that schedules backups and controls the bacula-client and the bacula-storage daemons.
Loaded: loaded (/etc/rc.d/init.d/bacula-dir)
Active: active (exited)
Process: 23092 ExecStop=/etc/rc.d/init.d/bacula-dir stop (code=exited, status=0/SUCCESS)
Process: 23103 ExecStart=/etc/rc.d/init.d/bacula-dir start (code=exited, status=6/NOTCONFIGURED)
CGroup: name=systemd:/system/bacula-dir.service
[root@saturn bacula]# /bin/systemctl start bacula-dir.service
[root@saturn bacula]# /bin/systemctl status bacula-dir.service
bacula-dir.service - SYSV: Bacula-dir is the Backup-server, which is the program that schedules backups and controls the bacula-client and the bacula-storage daemons.
Loaded: loaded (/etc/rc.d/init.d/bacula-dir)
Active: active (exited)
Process: 26059 ExecStop=/etc/rc.d/init.d/bacula-dir stop (code=exited, status=0/SUCCESS)
Process: 26072 ExecStart=/etc/rc.d/init.d/bacula-dir start (code=exited, status=0/SUCCESS)
Main PID: 26078 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/bacula-dir.service
# systemctl show bacula-dir.service
Id=bacula-dir.service
Names=bacula-dir.service
Requires=basic.target
Conflicts=shutdown.target
Before=rc-local.service abrt-ccpp.service smolt.service shutdown.target psacct.ser
After=irda.service netconsole.service nfslock.service lvm2-monitor.service rpcidma
Description=SYSV: Bacula-dir is the Backup-server, which is the program that sched
LoadState=loaded
ActiveState=active
SubState=exited
CanStart=yes
CanStop=yes
CanReload=yes
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
DefaultControlGroup=name=systemd:/system/bacula-dir.service
ControlGroup=cpu:/system/bacula-dir.service name=systemd:/system/bacula-dir.servic
NeedDaemonReload=no
JobTimeoutUSec=0
# rpm -qa | egrep -i "systemd|bacula*"
bacula-console-bat-5.0.3-9.fc15.x86_64
bacula-docs-5.0.3-9.fc15.x86_64
systemd-24-1.fc15.x86_64
bacula-console-wxwidgets-5.0.3-9.fc15.x86_64
bacula-director-common-5.0.3-9.fc15.x86_64
bacula-storage-common-5.0.3-9.fc15.x86_64
systemd-units-24-1.fc15.x86_64
bacula-storage-mysql-5.0.3-9.fc15.x86_64
bacula-common-5.0.3-9.fc15.x86_64
bacula-console-5.0.3-9.fc15.x86_64
bacula-director-mysql-5.0.3-9.fc15.x86_64
bacula-client-5.0.3-9.fc15.x86_64
# uname -a
Linux saturn.localdomain 2.6.38.2-9.fc15.x86_64 #1 SMP Wed Mar 30 16:55:57 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
You are not using provided *service files: Description=SYSV: Bacula-dir is ... Loaded: loaded (/etc/rc.d/init.d/bacula-dir) Please issue "systemctl daemon-reload" after dropping provided files in /lib/systemd/systemd (or /etc/systemd/system if you are just testing locally). 'service bacula-dir start' has exit code 6. This exit code is returned when configuration file contains non-changed default passwords. Please make sure you have correct configuration. thx for reply.
I believe I did troubleshoot that, and eventually did remove @@s and insert a
password for all bacula resource configs in relevant files bacula-dir.conf,
bacula-sd.conf bacula-fd.conf (its possible the copy-paste above might have
preceded that configuration)
[root@saturn bacula]# service bacula-dir start
Starting bacula-dir (via systemctl): [ OK ]
[root@saturn bacula]# ps -ef | egrep -i bacula
root 23698 2063 0 07:24 pts/0 00:00:00 egrep -i bacula
[root@saturn bacula]# service bacula-dir status
bacula-dir.service - SYSV: Bacula-dir is the Backup-server, which is the
program that schedules backups and controls the bacula-client and the
bacula-storage daemons.
Loaded: loaded (/etc/rc.d/init.d/bacula-dir)
Active: active (exited)
Main PID: 26078 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/bacula-dir.service
/etc/rc.d/init.d/bacula-dir uses the following line
grep -q '^[^#].*_PASSWORD@@' $CONFIG
and /lib/systemd/system/bacula-dir.service uses
ExecStartPre=/bin/grep -vq '^[^#].*_PASSWORD@@' $CONFIG
[root@saturn system]# for i in dir sd fd ; do echo $i ; grep -vq '^[^#].*_PASSWORD@@' /etc/bacula/bacula-${i}.conf ; echo $? ; done
dir
0
sd
0
fd
0
I am investigating the service files route
[root@saturn ~]# rpm -qil --whatprovides "bacula-dir.service"
no package provides bacula-dir.service
[root@saturn ~]# yum whatprovides "*bacula-dir.service"
Loaded plugins: langpacks, presto, refresh-packagekit
No Matches found
I created those files in
[root@saturn ~]# find /lib/systemd -ls | egrep -i "bacula-.*.service"
133697 4 -rw-r--r-- 1 root root 523 Apr 8 07:34 /lib/systemd/system/bacula-sd.service
133679 4 -rw-r--r-- 1 root root 520 Apr 8 07:33 /lib/systemd/system/bacula-dir.service
133505 4 -rw-r--r-- 1 root root 540 Apr 8 07:33 /lib/systemd/system/bacula-fd.service
[root@saturn ~]# find /etc/systemd -ls | egrep -i "bacula-.*.service"
[root@saturn ~]#
[root@saturn system]# systemctl daemon-reload
[root@saturn system]# service bacula-dir status
bacula-dir.service - Bacula-Director, the Backup-server
Loaded: loaded (/lib/systemd/system/bacula-dir.service)
Active: active (exited)
Main PID: 26078 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/bacula-dir.service
[root@saturn system]# service bacula-dir start
Starting bacula-dir (via systemctl): [ OK ]
[root@saturn system]# ps -ef | egrep -i bacula
root 24419 2063 0 07:36 pts/0 00:00:00 egrep -i bacula
[root@saturn systemd]# systemctl show bacula-dir.service
Id=bacula-dir.service
Names=bacula-dir.service
Requires=network.target systemd-logger.socket basic.target
Conflicts=shutdown.target
Before=shutdown.target
After=network.target systemd-logger.socket basic.target
Description=Bacula-Director, the Backup-server
LoadState=loaded
ActiveState=active
SubState=exited
FragmentPath=/lib/systemd/system/bacula-dir.service
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
DefaultControlGroup=name=systemd:/system/bacula-dir.service
ControlGroup=cpu:/system/bacula-dir.service name=systemd:/system/bacula-dir.servic
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionTimestamp=Thu, 07 Apr 2011 01:19:14 -0400
ConditionResult=yes
Type=forking
Restart=no
NotifyAccess=none
RestartUSec=100ms
TimeoutUSec=3min
ExecStartPre={ path=/bin/grep ; argv[]=/bin/grep -vq ^[^#].*_PASSWORD@@ $CONFIG ;
ExecStart={ path=/usr/sbin/bacula-dir ; argv[]=/usr/sbin/bacula-dir -c $CONFIG ; i
Environment=CONFIG=/etc/bacula/bacula-dir.conf
EnvironmentFile=/etc/sysconfig/bacula-dir (ignore=no)
UMask=0002
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=1024
LimitAS=18446744073709551615
LimitNPROC=5818
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=5818
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=syslog
StandardError=inherit
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=1048576
PrivateTmp=no
SameProcessGroup=no
KillMode=control-group
KillSignal=15
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=no
GuessMainPID=yes
ExecMainPID=26078
ExecMainCode=1
ExecMainStatus=1
MainPID=0
ControlPID=0
SysVStartPriority=-1
FsckPassNo=0
This may not be source of error, but noting.
The init.d/bacula-dir file uses grep -q (without -v)
the system/bacula-dir.service uses grep -vq
-v only only means match the inversion of the regexp
grep returns 0 if matches are found
In the init.d file grep -q would have returns 0 if @@s were matched and will exit.
so if my understanding is correct the grep -vq in the service file is redundant because it matches ordinary lines and ignores @@ lines. The only way grep -vq would return 1 if a file contained of only lines with _PASSWORD@@ in it and no other.
I assume -v was used because someone thought it inverts the exit status of grep (perhaps systemd uses '1' to determine if error happened. The -v doesn't invert the exit status, it inverts the match.
[root@saturn system]# for i in dir sd fd ; do echo $i ; grep -q '^[^#].*_PASSWORD@@' /etc/bacula/bacula-${i}.conf ; echo $? ; done
dir
1
sd
1
fd
1
The above means no conf file has _PASSWORD@@ in it. (except when preceded with #, commented)
That's right, systemd treats exit status 0 as success, any other as failure. If '-v' cannot be used, then I'm not sure how to translate this check into systemd. Is it even worth? Lennart, could you comment if systemd has ability to work with this kind of checks? If shell scripting is possible the following may work Attempt1 $ bash -c "exit $((RANDOM>16384))" ; ret=$? ; echo $ret ; if [ $ret == 1 ] ; th en bash -c "exit 0" ; else bash -c "exit 1" ; fi ; echo $? 0 1 Attempt 2 $ bash -c "exit $((RANDOM>16384))" ; ret=$? ; echo $ret ; bash -c "exit $(($ret ==0))" ; echo $? 1 0 Created attachment 501294 [details]
bacula-dir.service definition for director
Simplified unit file:
- drop the template check
- pass "-f" to have daemon running in foreground
- remove Type=forking because of above
Created attachment 501295 [details]
bacula-fd.service unit for file daemon
Simplified.
Created attachment 501296 [details]
bacula-sd.service unit for storage daemon
Simplified.
Created attachment 517582 [details]
bacula-fd.service unit for file daemon
Created attachment 517583 [details]
bacula-sd.service unit for storage daemon
Created attachment 517584 [details]
bacula-dir.service definition for director
Created attachment 517585 [details]
script which check if configfile has been changed
Created attachment 517586 [details]
bacula.spec patch
This is a patch for spec file which allow to use systemd unit files in bacula.
I'm proposing the following changes to previous unit files (adjusted unit files already attached):
* sysconfig files are not mandatory, so not installed any more, but they're respected if they exist from previous versions
* added requirments on syslog
* checking if config files don't contain _PASSWORD@@ moved to script bacula-checkconf, which is executed in ExecStartPre=
* setting user/group in unit file (can be overriden in sysconfig file if it exists)
This is a scratch build of bacula with systemd unit files above: http://koji.fedoraproject.org/koji/taskinfo?taskID=3263792 bacula-5.0.3-10.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/bacula-5.0.3-10.fc16 Package bacula-5.0.3-10.fc16: * should fix your issue, * was pushed to the Fedora 16 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing bacula-5.0.3-10.fc16' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/bacula-5.0.3-10.fc16 then log in and leave karma (feedback). bacula-5.0.3-11.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/bacula-5.0.3-11.fc16 bacula-5.0.3-11.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report. |