Bacula-users

Re: [Bacula-users] vchanger 1.0.1 says "No slots in changer to scan"

2016-05-06 13:33:03
Subject: Re: [Bacula-users] vchanger 1.0.1 says "No slots in changer to scan"
From: Pann Tolk <pann.tolk AT gmail DOT com>
To: Josh Fisher <jfisher AT pvct DOT com>
Date: Sat, 7 May 2016 01:31:13 +0800
Hi Josh,

Thanks for your quick response.

On Fri, May 6, 2016 at 7:40 PM, Josh Fisher <jfisher AT pvct DOT com> wrote:

On 5/6/2016 3:07 AM, Pann Tolk wrote:
Hi Josh,

......

May 06 14:34:06 deneb systemd-udevd[2578]: '/usr/libexec/vchanger/vchanger-launch-mount.sh 1fde15be-83a4-4b67-accc-378d5fa10ea7'(err) '  device-enumerator: scanning /sys/class'
====>> May 06 14:34:06 deneb systemd-udevd[2578]: Process '/usr/libexec/vchanger/vchanger-launch-mount.sh 1fde15be-83a4-4b67-accc-378d5fa10ea7' succeeded.

^^^
^^^ Here, udevd says that /usr/libexec/vchanger/vchanger-launch-mount.sh script has completed running successfully.

Udev expects any scripts launched by udev rules to execute quickly and not cause delays, therefore the vchanger-launch-mount.sh script launched by udev simply causes the /usr/libexec/vchanger/vchanger-mount-uuid.sh script to be invoked as a background process and then terminates. So a success simply means that vchanger-launch-maount.sh successfully invoked vchanger-mount-uuid.sh in a background process, not that it mounted successfully.
 
Ah yes!  My bad.  I did read and also looked at /usr/libexec/vchanger/vchanger-launch-mount.sh before and knows that it invokes /usr/libexec/vchanger/vchanger-mount-uuid.sh as a background process.  Wasn't thinking properly earlier. Sorry.

The default mountdir is /mnt. To mount under say /mnt/vchanger it is necessary to set MOUNTDIR=/mnt/vchanger in /etc/sysconfig/vchanger.

Yes, my /etc/sysconfig/vchanger is as below:

[root@deneb ~]# ls -lt /etc/sysconfig/vchanger
-rw-r--r-- 1 root root 39 Jun 10  2015 /etc/sysconfig/vchanger
[root@deneb ~]# cat /etc/sysconfig/vchanger
MOUNT_DIR=/mnt/vchanger
MOUNT_OPTIONS=
[root@deneb ~]#

It's still the original file that comes with the RPM package.
 
Alternatively, you can use a line like

UUID=1fde15be-83a4-4b67-accc-378d5fa10ea7 /any/existing/directory/name ext4 defaults,rw,relatime,data="" 0 0

in /etc/fstab to cause vchanger-mount-uuid.sh to mount it wherever you like. When specified as magazine=uuid:, vchanger will lookup the mountpoint using libudev and so doesn't really care where it gets mounted. When using magazine=/some/static/path, it must be mounted at the specified path.

Ok.  I'll have to muck with /etc/fstab now to add those entries to mount the filesystem magazines to /mnt/vchanger/<UUID>
 
You can umount the partition and then run vchanger-mount-uuid.sh (as root) with the uuid as its only parameter to see what it does. Unfortunately, the script is very simple and doesn't provide logging.

I did the test.  First, I inserted the disk and executed mount | grep <UUID> :

[root@deneb ~]# mount | grep 1fde15be-83a4-4b67-accc-378d5fa10ea7
[root@deneb ~]#

Nothing!  vchanger-mount-uuid.sh does not mount the drive.

Next, I ran
/usr/libexec/vchanger/vchanger-mount-uuid.sh:

[root@deneb ~]# /usr/libexec/vchanger/vchanger-mount-uuid.sh 1fde15be-83a4-4b67-accc-378d5fa10ea7
checking dev
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
[root@deneb ~]# mount | grep 1fde15be-83a4-4b67-accc-378d5fa10ea7
/dev/sdb1 on /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7 type ext4 (rw,relatime,data="">

So this is weird, running /usr/libexec/vchanger/vchanger-mount-uuid.sh manually is able to mount it.  Note that autofs is disabled. So, it shouldn't be interfering with udev.
 

Anyway, to test further, I manually mount it:

[root@deneb ~]# mount /dev/disk/by-uuid/1fde15be-83a4-4b67-accc-378d5fa10ea7 /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7/
[root@deneb ~]# mount | grep vchanger
/dev/sdb1 on /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7 type ext4 (rw,relatime,data=""> [root@deneb ~]#

Then, I did what you mentioned:-  I modified /etc/vchanger/vchanger01.conf and changed the bconsole="/usr/sbin/bconsole" line to bconsole = "".

Then I tried the following again.

[root@deneb ~]# vchanger /etc/vchanger/vchanger01.conf listmags
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
0:18:1:/mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7
1:::
2:::
3:::

So vchanger is working properly when run as root. What does it do when you run that same command as user bacula:tape? Are you sure bacula-sd is running as user bacula:tape? vchanger must run as the same user as bacula-sd. It could still be a permissions issue. You can set 'log level = 7' and 'logfile = /path/to/logfile' in vchanger.conf to debug vchanger, but you must run it as user bacula:tape to debug if it is a permissions issue.

I believe bacula-sd is running as bacula:tape:

[root@deneb ~]# ps -aux | grep bacula
bacula    2239  0.0  0.4 200828  9396 ?        Ssl  23:59   0:00 /usr/sbin/bacula-dir -f -c /etc/bacula/bacula-dir.conf -u bacula -g bacula
bacula    2248  0.0  0.3 254136  7600 ?        Ssl  23:59   0:00 /usr/sbin/bacula-sd -f -c /etc/bacula/bacula-sd.conf -u bacula -g tape


As requested, I set 'log level =7':

[root@deneb ~]# cat /etc/vchanger/vchanger01.conf | grep -v  "^[#]"
Storage Resource = "vchanger01"
User = bacula
group = tape
work dir = "/var/spool/vchanger/vchanger01"
logfile = "/var/log/vchanger/vchanger01.log"
log level = 7
bconsole = ""
bconsole config = /etc/bacula/bconsole.conf
default pool = "Scratch"

magazine = UUID:1fde15be-83a4-4b67-accc-378d5fa10ea7
magazine = UUID:412060d2-7be4-4719-8089-2ee6cfd28624
magazine = UUID:20d986c1-9391-467e-9f73-232b53fba377
magazine = UUID:fa48ed8d-2e63-4c27-8670-c943822d2cd0


Run "vchanger /etc/vchanger/vchanger01.conf listmags" as bacula:tape:-

[root@deneb ~]# runuser bacula -g tape
bash-4.3$ id
uid=133(bacula) gid=33(tape) groups=33(tape)
bash-4.3$ vchanger /etc/vchanger/vchanger01.conf listmags
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
device-enumerator: scan all dirs
  device-enumerator: scanning /sys/bus
  device-enumerator: scanning /sys/class
0:18:1:/mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7
1:::
2:::
3:::


And from the /var/log/vchanger/vchanger01.log:-

May 07 00:56:24: created lockfile for pid 3308
May 07 00:56:24: restored state of magazine 0
May 07 00:56:24: magazine 0 has 18 volumes on /mnt/vchanger/1fde15be-83a4-4b67-accc-378d5fa10ea7
May 07 00:56:24: 18 volumes on magazine 0 assigned slots 1-18
May 07 00:56:24: magazine 1 is not mounted
May 07 00:56:24: magazine 2 is not mounted
May 07 00:56:24: magazine 3 is not mounted
May 07 00:56:24: saved state of magazine 0
May 07 00:56:24: saved dynamic configuration (max used slot: 37)
May 07 00:56:24: drive 0 previously unloaded
May 07 00:56:24: ==== preforming LISTMAGS command pid=3308
May 07 00:56:24:   SUCCESS listing magazine info to stdout
May 07 00:56:24: removing lockfile for pid 3308


bash-4.3$ bconsole
Connecting to Director deneb.chuakt.local:9101
1000 OK: 102 bacula-dir Version: 7.4.0 (16 January 2016)
Enter a period to cancel a command.
*update slots
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Automatically selected Storage: vchanger01
Connecting to Storage daemon vchanger01 at deneb.chuakt.local:9103 ...
3306 Issuing autochanger "slots" command.
Device "SATA-vchanger01" has 0 slots.
No slots in changer to scan.



So, it does not seem to be any permission issue...unless I'm wrong.

Still looking forward to fix this issue.

Thanks
Pann






------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users