4

I recently migrated my drbd setup from Ubutnu to centos 7 and i get a wierd error:

i can load and unload the module normally, and the whole thing seems to work

#>modprobe drbd
#>lsmod | grep drbd
drbd       373504     2
...

i can now issue drbdadm up drbdres commands, see the status for the resource, everything is running it seems. i can also unload the module

#>rmmod drbd
#>lsmod | grep drbd
#>drbdadm cstate all
0: Failure: (127) Device minor not allocated 
...
#> lsmod | grep drbd
drbd       373504     2
...

so i can load the module, drbdadm is able to load it but does not bring up any resources, while the docs claim the init script would do this, so drbd obviously does not initialise the module in this way.

Normally, all resources configured in /etc/drbd.conf are automatically enabled upon system startup by the /etc/init.d/drbd init script.

(source: http://www.drbd.org/users-guide-8.3/s-enable-disable.html)

If i try running the init.d script i get a wierd error:

#>/etc/init.d/drbd start script i get:
Starting DRBD resources:
sh: modinfo: command not found
open(".") failed: permission denied
#>

i was able to locate the line(s) where this happens:

$DRBDADM="drbdadm"
...

out=$(&DRBDADM sh-nop 2>&1); ex=?
[[ $ex = 127 ]] && exit 5 #LSB for "not installed"
log_daemon_msg "Starting DRBD resources"
if [[ $ex != 0 ]] ; then
    printf"\n%s\n" "$out" >&2
    exit1
fi

i inserted a line to log $ex and it says "3", so this seems to mean:

drbdadm sh-nop returns "open(".") failed: permission denied" which is error "3".

I cannot find out what this is supposed to tell me, running

#>drbdadm sh-nop

does not return anything in terminal or write to logs i know of. I also cannot locate a point in any file where open(".") would be called.

Im far from an expert on linux, ecspecially centOS/redhat as i am used to debian , all i can tell is that Ubuntu 14.04 worked well with this configuration under drbd83. I have now switched to drbd84 on centOS 7, the docs do not say anything about changes in parts of the module that touch my configuration afaik. Only thing is that i can no longer store the metadata internal, as the whole drbd device will be handed as disk to a virtual machine.

I am hoping that the error lies in my "doing thing the debian way" because i cannot find any configuration issues with drbd.

I ll append my configuration:

global {
    usage-count no;
}

common {
    syncer {
        rate 100M;
    }

}
resource drbdres {
    device minor 0;

    net {
        protocol C;
    }
    startup {
        wfc-timeout     0;
        degr-wfc-timeout    60;
    }
    disk {
        on-io-error     detach;
    }
    #NODES

    on node1 {
        disk        /dev/mapper/vmachines-lvdrbd;
#       device      drbddisk;
        address     192.168.8.133:7788;
        meta-disk   /dev/mapper/vmachines-lvdrbdMeta; #!internal
    }

    on node2 {
        disk        /dev/mapper/vmachines-lvdrbd;
#       device      drbddisk;
        address     192.168.8.132:7788;
        meta-disk   /dev/mapper/vmachines-lvdrbdMeta; #!internal
    }
}

if i attach my second host to test the setup regardless of these issues, both start up drbd, and get stuck with the status "WFConnection", the ip addresses they have configured for the other hosts are correct, so i assume the service is indeed not started by drbdadm, it just loads the module if it is not loaded.

Thanks for any hints or help,

Regards BillDoor

(original: https://stackoverflow.com/questions/25680702/centos-7-drbd-cannot-start-service)

EDIT:

my configured repositories:

Centos7 base
ELrepo e17
Centos7 extras
centos7 updates

i installed the packages:

drbd84-utils.x86_64
drbd84-utils-sysvinit.x86_64
kmod-drbd.x86_64

i issued yum install drbd84 to install drbd

2
  • Where did you get drbd for CentOS 7? Sep 5, 2014 at 11:53
  • installed using yum, my configured repos and the packagenames are edited into the question
    – billdoor
    Sep 8, 2014 at 6:02

3 Answers 3

2

I know this is an old post, but I thought I would provide a solution for those who want/need SELinux enabled. Do this by creating a local SELinux policy for DRBD.

If you grep the '/var/log/audit/audit.log' for "drbd_t", you should see some errors; piping those errors into 'audit2allow' will allow you to generate a new SELinux policy package that permits the previously denied actions. You can then install that policy with 'semodule -i':

# grep drbd_t /var/log/audit/audit.log | audit2allow -M drbdlocal
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i drbdlocal.pp

# semodule -i drbdlocal.pp

If you run into another SELinux error, you can rerun the above two commands to create/install a new policy package until you have no more errors.

3

I hate to answer my own question, but for all future newcommers to centOS and drbd, selinux is the one denying me access to certain necessary directories. I have not yet discovered what directories exactly i need to configure for drbd, but setting selinux to permissive-mode lets me at least test the drbd setup!

This also is the reason why debian ran without any problems, as selinux is a securityfeature only present in Enterpriselinux, so mainly redhat and centOS.

0

Is there a reason that you have commented out the device portion of you DRBD config?

Should that not be something like:

device /dev/drbd0; or /dev/drbddisk;

1
  • i got the error "minor nor allocated" when attaching a resource while "up" wokred. So I tried a few things before realised that "up" is indeed not just a copy of "attach + connect" as the docs suggest. the device is called drbd0, drbd is the default name if "device" is omited and just a minor number is given
    – billdoor
    Sep 8, 2014 at 5:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .