| 1 |
\chapter{\bacula{} \acs{RPM} Packaging FAQ} |
| 2 |
\label{blb:RpmFaqChapter} |
| 3 |
\index[general]{FAQ!\bacula{}\bregistered{} - \acs{RPM} Packaging } |
| 4 |
\index[general]{\bacula{}\bregistered{} - \acs{RPM} Packaging FAQ } |
| 5 |
|
| 6 |
\begin{benumerate} |
| 7 |
\item \bilink{How do I build \bacula{} for platform xxx?}{blb:faq1} |
| 8 |
\item \bilink{How do I control which database support gets built?}{blb:faq2} |
| 9 |
\item \bilink{What other defines are used?}{blb:faq3} |
| 10 |
\item \bilink{I'm getting errors about not having permission when I try to build the packages. Do I need to be root?}{blb:faq4} |
| 11 |
\item \bilink{I'm building my own rpms but on all platforms and compiles I get an unresolved dependency for something called \bfilename{/usr/afsws/bin/pagsh}.}{blb:faq5} |
| 12 |
\item \bilink{I'm building my own rpms because you don't publish for my platform. Can I get my packages released to sourceforge for other people to use?}{blb:faq6} |
| 13 |
\item \bilink{Is there an easier way than sorting out all these command line options?}{blb:faq7} |
| 14 |
\item \bilink{I just upgraded from 1.36.x to 1.38.x and now my director daemon won't start. It appears to start but dies silently and I get a ``connection refused'' error when starting the console. What is wrong?}{blb:faq8} |
| 15 |
\item \bilink{There are a lot of rpm packages. Which packages do I need for what?}{blb:faq9} |
| 16 |
\item \bilink{What happened to the build switches for gnome console, wxconsole and bat?}{blb:faq10} |
| 17 |
\end{benumerate} |
| 18 |
|
| 19 |
\section{Answers} |
| 20 |
\index[general]{Answers } |
| 21 |
|
| 22 |
\begin{benumerate} |
| 23 |
\item \label{blb:faq1} |
| 24 |
\textbf{ How do I build \bacula{} for platform xxx?} |
| 25 |
The \bacula {}spec file contains defines to build for several platforms: \\ |
| 26 |
\\ |
| 27 |
Red Hat 7.x (rh7), Red Hat 8.0 (rh8), Red Hat 9 (rh9), \\ |
| 28 |
Fedora Core (fc1, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc10), \\ |
| 29 |
Whitebox Enterprise Linux 3.0 (wb3), \\ |
| 30 |
Red Hat Enterprise Linux (rhel3, rhel4, rhel5), \\ |
| 31 |
Mandrake 10.x (mdk), Mandriva 2006.x (mdv), \\ |
| 32 |
CentOS (centos3, centos4, centos5) \\ |
| 33 |
Scientific Linux (sl3, sl4, sl5) and \\ |
| 34 |
SuSE (su9, su10, su102, su103, su110, su111, su112). \\ |
| 35 |
\\ |
| 36 |
The package build is controlled by a mandatory define set at the beginning of the file. These defines basically just control the dependency information that gets coded into the finished rpm package as well |
| 37 |
as any special configure options required. The platform define may be edited |
| 38 |
in the spec file directly (by default all defines are set to 0 or ``not set''). |
| 39 |
For example, to build the Red Hat 7.x package find the line in the spec file |
| 40 |
which reads |
| 41 |
|
| 42 |
\begin{bVerbatim} |
| 43 |
%define rh7 0 |
| 44 |
\end{bVerbatim} |
| 45 |
|
| 46 |
and edit it to read |
| 47 |
|
| 48 |
\begin{bVerbatim} |
| 49 |
%define rh7 1 |
| 50 |
\end{bVerbatim} |
| 51 |
|
| 52 |
Alternately you may pass the define on the command line when calling \btool{rpmbuild}: |
| 53 |
|
| 54 |
\begin{bVerbatim} |
| 55 |
rpmbuild -ba --define "build_rh7 1" bacula.spec |
| 56 |
rpmbuild --rebuild --define build_rh7 1" bacula-x.x.x-x.src.rpm |
| 57 |
\end{bVerbatim} |
| 58 |
|
| 59 |
\item \label{blb:faq2} |
| 60 |
\textbf{How do I control which database support gets built?} |
| 61 |
Another mandatory build define controls which database support is compiled, |
| 62 |
one of \texttt{build\_sqlite}, \texttt{build\_mysql} or \texttt{build\_postgresql}. To get the \mysql{} |
| 63 |
package and support either set the |
| 64 |
|
| 65 |
\begin{bVerbatim} |
| 66 |
%define mysql 0 |
| 67 |
OR |
| 68 |
%define mysql4 0 |
| 69 |
OR |
| 70 |
%define mysql5 0 |
| 71 |
\end{bVerbatim} |
| 72 |
|
| 73 |
to |
| 74 |
|
| 75 |
\begin{bVerbatim} |
| 76 |
%define mysql 1 |
| 77 |
OR |
| 78 |
%define mysql4 1 |
| 79 |
OR |
| 80 |
%define mysql5 1 |
| 81 |
\end{bVerbatim} |
| 82 |
|
| 83 |
in the spec file directly or pass it to \btool{rpmbuild} on the command line: |
| 84 |
|
| 85 |
\begin{bVerbatim} |
| 86 |
rpmbuild -ba --define "build_rh7 1" --define "build_mysql 1" bacula.spec |
| 87 |
rpmbuild -ba --define "build_rh7 1" --define "build_mysql4 1" bacula.spec |
| 88 |
rpmbuild -ba --define "build_rh7 1" --define "build_mysql5 1" bacula.spec |
| 89 |
\end{bVerbatim} |
| 90 |
|
| 91 |
\item \label{blb:faq3} |
| 92 |
\textbf{What other defines are used?} |
| 93 |
Three other building defines of note are the \texttt{depkgs\_version}, \texttt{docs\_version} and |
| 94 |
\texttt{\_rescuever} identifiers. These two defines are set with each release and must |
| 95 |
match the version of those sources that are being used to build the packages. |
| 96 |
You would not ordinarily need to edit these. See also the Build Options section |
| 97 |
below for other build time options that can be passed on the command line. |
| 98 |
\item \label{blb:faq4} |
| 99 |
\textbf{I'm getting errors about not having permission when I try to build the |
| 100 |
packages. Do I need to be root?} |
| 101 |
No, you do not need to be \texttt{root} and, in fact, it is better practice to |
| 102 |
build rpm packages as a non-root user. \bacula{} packages are designed to |
| 103 |
be built by a regular user but you must make a few changes on your |
| 104 |
system to do this. If you are building on your own system then the |
| 105 |
simplest method is to add write permissions for all to the build |
| 106 |
directory (/usr/src/redhat/, /usr/src/RPM or /usr/src/packages). |
| 107 |
To accomplish this, execute the following command as root: |
| 108 |
|
| 109 |
\begin{bVerbatim} |
| 110 |
chmod -R 777 /usr/src/redhat |
| 111 |
chmod -R 777 /usr/src/RPM |
| 112 |
chmod -R 777 /usr/src/packages |
| 113 |
\end{bVerbatim} |
| 114 |
|
| 115 |
If you are working on a shared system where you can not use the method |
| 116 |
above then you need to recreate the appropriate above directory tree with all |
| 117 |
of its subdirectories inside your home directory. Then create a file named |
| 118 |
|
| 119 |
{\tt .rpmmacros} |
| 120 |
|
| 121 |
in your home directory (or edit the file if it already exists) |
| 122 |
and add the following line: |
| 123 |
|
| 124 |
\begin{bVerbatim} |
| 125 |
%_topdir /home/myuser/redhat |
| 126 |
%_tmppath /tmp |
| 127 |
\end{bVerbatim} |
| 128 |
|
| 129 |
Another handy directive for the .rpmmacros file if you wish to suppress the |
| 130 |
creation of debug rpm packages is: |
| 131 |
|
| 132 |
\begin{bVerbatim} |
| 133 |
%debug_package %{nil} |
| 134 |
\end{bVerbatim} |
| 135 |
|
| 136 |
|
| 137 |
\item \label{blb:faq5} |
| 138 |
\textbf{I'm building my own rpms but on all platforms and compiles I get an |
| 139 |
unresolved dependency for something called /usr/afsws/bin/pagsh.} This |
| 140 |
is a shell from the OpenAFS (Andrew File System). If you are seeing |
| 141 |
this then you chose to include the docs/examples directory in your |
| 142 |
package. One of the example scripts in this directory is a pagsh |
| 143 |
script. Rpmbuild, when scanning for dependencies, looks at the shebang |
| 144 |
line of all packaged scripts in addition to checking shared libraries. |
| 145 |
To avoid this do not package the examples directory. If you are seeing this |
| 146 |
problem you are building a very old \bacula{} package as the examples have been |
| 147 |
removed from the doc packaging. |
| 148 |
|
| 149 |
\item \label{blb:faq6} |
| 150 |
\textbf{I'm building my own rpms because you don't publish for my platform. |
| 151 |
Can I get my packages released to sourceforge for other people to use?} Yes, |
| 152 |
contributions from users are accepted and appreciated. Please examine the |
| 153 |
directory platforms/contrib-rpm in the source code for further information. |
| 154 |
|
| 155 |
\item \label{blb:faq7} |
| 156 |
\textbf{Is there an easier way than sorting out all these command line options?} Yes, |
| 157 |
there is a gui wizard shell script which you can use to rebuild the src rpm package. |
| 158 |
Look in the source archive for platforms/contrib-rpm/rpm\_wizard.sh. This script will |
| 159 |
allow you to specify build options using GNOME dialog screens. It requires zenity. |
| 160 |
|
| 161 |
\item \label{blb:faq8} |
| 162 |
\textbf{I just upgraded from 1.36.x to 1.38.x and now my director daemon |
| 163 |
won't start. It appears to start but dies silently and I get a "connection |
| 164 |
refused" error when starting the console. What is wrong?} Beginning with |
| 165 |
1.38 the rpm packages are configured to run the director and storage |
| 166 |
daemons as a non-root user. The file daemon runs as user \texttt{root} and group |
| 167 |
\texttt{bacula}, the storage daemon as user \texttt{bacula} and group \texttt{disk}, and the director |
| 168 |
as user \texttt{bacula} and group \texttt{bacula}. If you are upgrading you will need to |
| 169 |
change some file permissions for things to work. Execute the following |
| 170 |
commands as root: |
| 171 |
|
| 172 |
\begin{bVerbatim} |
| 173 |
chown bacula.bacula /var/bacula/* |
| 174 |
chown root.bacula /var/bacula/bacula-fd.9102.state |
| 175 |
chown bacula.disk /var/bacula/bacula-sd.9103.state |
| 176 |
\end{bVerbatim} |
| 177 |
|
| 178 |
Further, if you are using File storage volumes rather than tapes those |
| 179 |
files will also need to have ownership set to user \texttt{bacula} and group \texttt{bacula}. |
| 180 |
|
| 181 |
\item \label{blb:faq9} |
| 182 |
\textbf{There are a lot of rpm packages. Which packages do I need for |
| 183 |
what?} For a \bacula{} server you need to select the packsge based upon your |
| 184 |
preferred catalog database: one of \texttt{bacula-mysql}, \texttt{bacula-postgresql} or |
| 185 |
\texttt{bacula-sqlite}. If your system does not provide an \mtx{} package you also |
| 186 |
need \texttt{bacula-mtx} to satisfy that dependancy. For a client machine you need |
| 187 |
only install \texttt{bacula-client}. Optionally, for either server or client |
| 188 |
machines, you may install a graphical console \texttt{bacula-gconsole} and/or |
| 189 |
\texttt{bacula-wxconsole}. The \bat{} (\acl{BAT})is installed with the |
| 190 |
\texttt{bacula-bat} package. One last package, \texttt{bacula-updatedb} is required only when |
| 191 |
upgrading a server more than one database revision level. |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
\item \textbf{Support for RHEL3/4/5, CentOS 3/4/5, Scientific Linux 3/4/5 and x86\_64} |
| 196 |
The examples below show |
| 197 |
explicit build support for RHEL4 and CentOS 4. Build support |
| 198 |
for x86\_64 has also been added. |
| 199 |
\end{benumerate} |
| 200 |
|
| 201 |
\begin{bVerbatim} |
| 202 |
Build with one of these 3 commands: |
| 203 |
|
| 204 |
rpmbuild --rebuild \ |
| 205 |
--define "build_rhel4 1" \ |
| 206 |
--define "build_sqlite 1" \ |
| 207 |
bacula-1.38.3-1.src.rpm |
| 208 |
|
| 209 |
rpmbuild --rebuild \ |
| 210 |
--define "build_rhel4 1" \ |
| 211 |
--define "build_postgresql 1" \ |
| 212 |
bacula-1.38.3-1.src.rpm |
| 213 |
|
| 214 |
rpmbuild --rebuild \ |
| 215 |
--define "build_rhel4 1" \ |
| 216 |
--define "build_mysql4 1" \ |
| 217 |
bacula-1.38.3-1.src.rpm |
| 218 |
|
| 219 |
For CentOS substitute '--define "build_centos4 1"' in place of rhel4. |
| 220 |
For Scientific Linux substitute '--define "build_sl4 1"' in place of rhel4. |
| 221 |
|
| 222 |
For 64 bit support add '--define "build_x86_64 1"' |
| 223 |
\end{bVerbatim} |
| 224 |
|
| 225 |
\section{Build Options} |
| 226 |
\index[general]{Build Options} |
| 227 |
The spec file currently supports building on the following platforms: |
| 228 |
\begin{bVerbatim} |
| 229 |
Red Hat builds |
| 230 |
--define "build_rh7 1" |
| 231 |
--define "build_rh8 1" |
| 232 |
--define "build_rh9 1" |
| 233 |
|
| 234 |
Fedora Core build |
| 235 |
--define "build_fc1 1" |
| 236 |
--define "build_fc3 1" |
| 237 |
--define "build_fc4 1" |
| 238 |
--define "build_fc5 1" |
| 239 |
--define "build_fc6 1" |
| 240 |
--define "build_fc7 1" |
| 241 |
|
| 242 |
Whitebox Enterprise build |
| 243 |
--define "build_wb3 1" |
| 244 |
|
| 245 |
Red Hat Enterprise builds |
| 246 |
--define "build_rhel3 1" |
| 247 |
--define "build_rhel4 1" |
| 248 |
--define "build_rhel5 1" |
| 249 |
|
| 250 |
CentOS build |
| 251 |
--define "build_centos3 1" |
| 252 |
--define "build_centos4 1" |
| 253 |
--define "build_centos5 1" |
| 254 |
|
| 255 |
Scientific Linux build |
| 256 |
--define "build_sl3 1" |
| 257 |
--define "build_sl4 1" |
| 258 |
--define "build_sl5 1" |
| 259 |
|
| 260 |
SuSE build |
| 261 |
--define "build_su9 1" |
| 262 |
--define "build_su10 1" |
| 263 |
--define "build_su102 1" |
| 264 |
--define "build_su103 1" |
| 265 |
|
| 266 |
Mandrake 10.x build |
| 267 |
--define "build_mdk 1" |
| 268 |
|
| 269 |
Mandriva build |
| 270 |
--define "build_mdv 1" |
| 271 |
|
| 272 |
MySQL support: |
| 273 |
for mysql 3.23.x support define this |
| 274 |
--define "build_mysql 1" |
| 275 |
if using mysql 4.x define this, |
| 276 |
currently: Mandrake 10.x, Mandriva 2006.0, SuSE 9.x & 10.0, FC4 & RHEL4 |
| 277 |
--define "build_mysql4 1" |
| 278 |
if using mysql 5.x define this, |
| 279 |
currently: SuSE 10.1 & FC5 |
| 280 |
--define "build_mysql5 1" |
| 281 |
|
| 282 |
PostgreSQL support: |
| 283 |
--define "build_postgresql 1" |
| 284 |
|
| 285 |
Sqlite support: |
| 286 |
--define "build_sqlite 1" |
| 287 |
|
| 288 |
Build the client rpm only in place of one of the above database full builds: |
| 289 |
--define "build_client_only 1" |
| 290 |
|
| 291 |
X86-64 support: |
| 292 |
--define "build_x86_64 1" |
| 293 |
|
| 294 |
Supress build of bgnome-console: |
| 295 |
--define "nobuild_gconsole 1" |
| 296 |
|
| 297 |
Build the WXWindows console: |
| 298 |
requires wxGTK >= 2.6 |
| 299 |
--define "build_wxconsole 1" |
| 300 |
|
| 301 |
Build the Bacula Administration Tool: |
| 302 |
requires QT >= 4.2 |
| 303 |
--define "build_bat 1" |
| 304 |
|
| 305 |
Modify the Packager tag for third party packages: |
| 306 |
--define "contrib_packager Your Name <[email protected]>" |
| 307 |
\end{bVerbatim} |
| 308 |
|
| 309 |
\section{\acs{RPM} Install Problems} |
| 310 |
\index[general]{\acs{RPM} Install Problems} |
| 311 |
In general the \acsp{RPM}, once properly built should install correctly. |
| 312 |
However, when attempting to run the daemons, a number of problems |
| 313 |
can occur: |
| 314 |
\begin{bitemize} |
| 315 |
\item [Wrong /var/bacula Permissions] |
| 316 |
By default, the Director and Storage daemon do not run with |
| 317 |
root permission. If the \bdirectoryname{/var/bacula} is owned by \texttt{root}, then it |
| 318 |
is possible that the Director and the Storage daemon will not |
| 319 |
be able to access this directory, which is used as the Working |
| 320 |
Directory. To fix this, the easiest thing to do is: |
| 321 |
\begin{bVerbatim} |
| 322 |
chown bacula:bacula /var/bacula |
| 323 |
\end{bVerbatim} |
| 324 |
Note: as of 1.38.8 \bdirectoryname{/var/bacula} is installed \texttt{root\string:bacula} with |
| 325 |
permissions 770. |
| 326 |
\item [The Storage daemon cannot Access the Tape drive] |
| 327 |
This can happen in some older \acs{RPM} releases where the Storage |
| 328 |
daemon ran under userid \texttt{bacula}, group \texttt{bacula}. There are two |
| 329 |
ways of fixing this: the best is to modify the \bfilename{/etc/init.d/bacula-sd} |
| 330 |
file so that it starts the Storage daemon with group \texttt{disk}. |
| 331 |
The second way to fix the problem is to change the permissions |
| 332 |
of your tape drive (usually \bfilename{/dev/nst0}) so that \bacula{} can access it. |
| 333 |
You will probably need to change the permissions of the \acs{SCSI}control |
| 334 |
device as well, which is usually \bfilename{/dev/sg0}. The exact names depend |
| 335 |
on your configuration, please see the Tape Testing chapter for |
| 336 |
more information on devices. |
| 337 |
\end{bitemize} |
| 338 |
|