On Thu, Nov 23, 2023, at 10:57 AM, Martin Simmons wrote:
> I've just tested it with the Bacula 15 Beta on FreeBSD 12.4 and found that the
> value of HOME in the ClientRunBeforeJob script comes from when bacula-fd was
> started and Bacula doesn't change it.
>
> How are you starting Bacula 9.6.7?

Lack of upgrade. :)

>  Note that FreeBSD's system startup scripts
> such as /etc/rc and /usr/sbin/service explicitly set HOME=/ so that might be
> the cause of the difference and will also happen if Bacula 13.x is started
> that way.

I didn't know that. There it is right there:

[16:27 empty dan ~] % grep -i home /usr/sbin/service
                exec env -i -L -/daemon HOME=/ 
PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@"

> FWIW, the make_catalog_backup.pl sets HOME=$wd while running pg_dump.  Maybe
> you need to do something similar?

I have tried that while debugging an issue.

The problem came to light when I upgraded a FreeBSD host from a postgresql 12 
to a postgresql 16 client. The pg_dump stopped working because of a 
password-related issue.  A postgresql 12-14 client worked. If installing 
postgresql15 or 16-client, pg_dump was failing.

Eventually, it was tracked down to a PostgreSQL change in 15.x with respect to 
determination of HOME.  Details at 
https://dan.langille.org/2023/11/22/i-figured-out-why-pg_dump-was-failing-with-postgresql-15-16/

In short, PostgreSQL once checked /etc/passwd for HOME, now it checks and uses 
$HOME if set. Hence the failure on FreeBSD with a HOME of / (/root/.pgpass) was 
not being picked up.

Both setting HOME and PGPASSFILE were valid solution for the pg_dump problem.

Thank you.

>>>>>> On Thu, 23 Nov 2023 09:02:36 -0500, Dan Langille said:
>> 
>> Hello,
>> 
>> One of the features of a is a script. I frequently use ClientRunBeforeJob to 
>> invoke pg_dump - I'm sure others may do similar.
>> 
>> For Bacula 9.6.7, when in that script, the value for $HOME is /
>> 
>> The UID is 0, i.e. root.  On FreeBSD, root's home directory is /root.
>> 
>> I'm not sure why that differs.  I've been told that Bacula 13.x does the 
>> right thing and HOME is /root - I was looking through the commits trying to 
>> find something which fixed this. I failed. I also checked the release notes 
>> and GitLab issues; no mention.
>> 
>> Does anyone recall this change?
>> 
>> To aid in tracking down this issue, could you add "echo $HOME" to your 
>> script. Is it / ?  Regardless, what version are you running and what HOME 
>> directory is reported?
>> 
>> NOTE:
>> 
>> - I'm not asking for bug fix
>> - I'm looking for a commit which made a deliberate change to the behavior
>> - Knowing the history as to why it changed might be useful
>> 
>> Thank you.
>> 
>> -- 
>>   Dan Langille
>>   d...@langille.org
>> 
>> 
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
>>

-- 
  Dan Langille
  d...@langille.org


_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to