Hello Neil,

Yes, I think that your assumption about PATH can be correct. It looks that
the /usr/local/bin path is not accessible for executing by PHP exec().

If you want you can add at the beginning of the mtx-changer script

echo $PATH

to see where exactly mtx-changer looks for binaries when it is executed via
web.

I found that FreeBSD users report this problem with PATH too:

https://forums.freebsd.org/threads/heads-up-php-exec-does-not-look-in-usr-local-bin-for-executables.78098/

Fortunately it is not difficult to solve. You can fix the PATH in
mtx-changer script or globally if it is possible.

Best regards,
Marcin Haba (gani)

On Wed, 10 Apr 2024 at 18:33, Neil Balchin <n...@neilandjo.com> wrote:

> When trying to configure the auto changer in the API panel,  I click.
> Checkbox on get sudo configuration and when I test I get this error in red:
>
>    /usr/local/share/bacula/mtx-changer: mtx: not found
> /usr/local/share/bacula/mtx-changer: perl: not found
>
>
> Both mtx and perl are installed in the system ,  perhaps there’s a path
> issue in the MTX changer script ?
>
>
> On 9 Apr 2024, at 20:56, Marcin Haba <ganius...@gmail.com> wrote:
>
> Hello Neil,
>
> For running everything in FreeBSD Jail, if to use mtx-changer by bacula
> user is needed sudo, I think the sudo needs to be added to ChangerCommand
> too:
>
> Autochanger {
>   Name = "TL2000"
>   Device = "HH-LTO7"
>   ChangerDevice = "/dev/pass1"
>   ChangerCommand = "sudo /etc/bacula/scripts/mtx-changer %c %o %S %a %d"
> }
>
> For Perl, it is used by mtx-changer script. I see in mtx-changer that the
> Perl command can be changed to commented by default awk/sed/cut commands.
> Inside mtx-changer after the Perl command is this comment:
>
> # If perl isn't installed, you can use by those commands
>
> Best regards,
> Marcin Haba (gani)
>
> On Wed, 10 Apr 2024 at 01:44, Neil Balchin <n...@neilandjo.com> wrote:
>
>> So I’m doing all of this from within a Freebsd Jail inside of Trueness.
>>
>> Therefore although I can expose the /dev devices I can’t easily change
>> their rwx properties so instead I added some lines to my sudoers config
>> file that allows the www and bacula users to perform certain sudo functions
>> without a password.
>>
>>
>> I added a sudo in front of my max-changer config in my bacula-sd.conf,
>>  by my theory this should be just fine
>>
>> I tested this command:
>> root@Bacula1:~ # sudo -u bacula sudo /usr/local/share/bacula/mtx-changer
>> /dev/pass1 slots
>> 24
>> root@Bacula1:~ #
>>
>> And as you can see I get the expected count of 24 slots
>>
>> Unfortunately from console:  I get
>>
>> *update slots
>> Automatically selected Catalog: MyCatalog
>> Using Catalog "MyCatalog"
>> The defined Storage resources are:
>>      1: File1
>>      2: File2
>>      3: HH-LTO7
>>      4: TL2000
>> Select Storage resource (1-4): 4
>> Connecting to Storage daemon TL2000 at localhost:9103 ...
>> 3306 Issuing autochanger "slots" command.
>> Device "TL2000" has 0 slots.
>> No slots in changer to scan.
>> *
>>
>> Now when I try to add the Autochanger TL2000 in the API I get an error
>> that it can’t find perl,  Is perl a preqequisite to bacula and I missed
>> that ?
>>
>>
>>
>>
>>
>> On 9 Apr 2024, at 14:39, Marcin Haba <ganius...@gmail.com> wrote:
>>
>> Hello Neil,
>>
>> From your description it looks that Bacularis works with the mtx-changer
>> script well.
>>
>> For labeling volumes, as it is action realized by Bacula SD, so I think,
>> it might be good to check if the mtx-changer script is capable of being
>> correctly executed by the bacula user.
>>
>> For test I would propose to try this command:
>>
>> # sudo -u bacula /etc/bacula/scripts/mtx-changer /dev/pass1 slots
>>
>> and also a good test could be trying to label a sample volume using
>> bconsole.
>>
>> Best regards,
>> Marcin Haba (gani)
>>
>> On Tue, 9 Apr 2024 at 20:30, Rob Gerber <r...@craeon.net> wrote:
>>
>>> What happens when you click 'update slots' on the volumes page, and tell
>>> it to update slots 1-24? Idk if this is relevant, but perhaps it is. Should
>>> update bacula's knowledge of what is in the library, as per mtx. The output
>>> once you click that button and tell it to update slots 1-24 should show
>>> that it knew about every tape's position in various slots in the library.
>>> If it says anything about updating a record to reflect a tape being in a
>>> certain slot, then its knowledge was incorrect and has been corrected.
>>>
>>> Robert Gerber
>>> 402-237-8692
>>> r...@craeon.net
>>>
>>> On Tue, Apr 9, 2024, 1:14 PM Neil Balchin <n...@neilandjo.com> wrote:
>>>
>>>> Ok Great,  that solves that problem
>>>>
>>>> I’m almost there
>>>>
>>>> I’m using a Dell TL2000 Tape library and a HH LTO7 drive
>>>>
>>>> I’ve added these to my bacula-sd ( configs pasted below). Also added
>>>> the Autochanger and Drives to the API device list
>>>>
>>>> From the API gui. It’s clearly running the slots and status commands
>>>> properly. Because it shows the 19 tapes with barcodes ,  however when I try
>>>> to label these tapes from the volumes page it reports Zero slots
>>>>
>>>> Autochanger {
>>>>   Name = "TL2000"
>>>>   Device = "HH-LTO7"
>>>>   ChangerDevice = "/dev/pass1"
>>>>   ChangerCommand = "/etc/bacula/scripts/mtx-changer %c %o %S %a %d"
>>>> }
>>>>
>>>> Device {
>>>>   Name = "HH-LTO7"
>>>>   MediaType = "LTO-7"
>>>>   ArchiveDevice = "/dev/sa0"
>>>>   HardwareEndOfMedium = no
>>>>   BackwardSpaceRecord = no
>>>>   BsfAtEom = yes
>>>>   TwoEof = yes
>>>>   FastForwardSpaceFile = yes
>>>>   RemovableMedia = yes
>>>>   RandomAccess = no
>>>>   AutomaticMount = yes
>>>>   AlwaysOpen = yes
>>>>   Autochanger = yes
>>>>   ControlDevice = "/dev/pass1"
>>>>   AlertCommand = "/usr/local/share/bacula/tapealert %l"
>>>> }
>>>>
>>>> I can run mt and mtx commands freely from the command line as both the
>>>> bacula user and www user so I think my /dev/ permissions are ok
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>
> --
>
> "Greater love hath no man than this, that a man lay down his life for his 
> friends." Jesus Christ
>
> "Większej miłości nikt nie ma nad tę, jak gdy kto życie swoje kładzie za 
> przyjaciół swoich." Jezus Chrystus
>
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
>
>

-- 

"Greater love hath no man than this, that a man lay down his life for
his friends." Jesus Christ

"Większej miłości nikt nie ma nad tę, jak gdy kto życie swoje kładzie
za przyjaciół swoich." Jezus Chrystus
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to