Skip to contentSkip to conversation

multipathd.service start failed when /var/run isn't mount

dm-devel lixiaokeng 3 participants 8 messages Jul 22, 2021 – Aug 12, 2021 Device mapper

lore
Share & tools
lore

lixiaokeng

author
#0 lore raw

When we enable multipathd.service with systemctl and reboot, multipathd doesn't start and log "failed to create pidfile".

The reason is following:

The RUN is /var/run in multipath-tools. When we start linux, we mount a disk to /var. So if multipathd.service start before mount, it will fail to activate.(If mount firstly, multipathd will start successfully)

The RUN is defined in Makefile.inc:

ifndef RUN

        ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
                RUN=run
        else
                RUN=var/run
        endif

endif

Can it always be defined as run?

Regards,
Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#1 lore raw
Quoted 13 lines · lixiaokeng

When we enable multipathd.service with systemctl and reboot, multipathd doesn't start and log "failed to create pidfile".

The reason is following:

The RUN is /var/run in multipath-tools. When we start linux, we mount a disk to /var. So if multipathd.service start before mount, it will fail to activate.(If mount firstly, multipathd will start successfully)

The RUN is defined in Makefile.inc:

ifndef RUN

Quoted 8 lines
        ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
                RUN=run
        else
                RUN=var/run
        endif

endif

Can it always be defined as run?

I believe all modern distributions make /var/run a symlink to /run. However, if that's the case, then I don't understand why you are running into this issue at all, since multipath should be using /run. What multipath packages are you using?

-Ben

Quoted 3 lines

Regards,
Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author
#2 lore raw
Quoted 21 lines · Benjamin Marzinski
Quoted 20 lines · lixiaokeng

When we enable multipathd.service with systemctl and reboot, multipathd doesn't start and log "failed to create pidfile".

The reason is following:

The RUN is /var/run in multipath-tools. When we start linux, we mount a disk to /var. So if multipathd.service start before mount, it will fail to activate.(If mount firstly, multipathd will start successfully)

The RUN is defined in Makefile.inc:

ifndef RUN

        ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
                RUN=run
        else
                RUN=var/run
        endif

endif

Quoted 6 lines
Quoted 1 line

Can it always be defined as run?

I believe all modern distributions make /var/run a symlink to /run. However, if that's the case, then I don't understand why you are running into this issue at all, since multipath should be using /run. What multipath packages are you using?

Yes, there is a symlink to /run in /var. But it is in the disk (such as sdb) mounted on /var actually. When reboot, systemd start multipathd service firstly then mount sdb to /var. In this way, the multipath service will not start.

After sdb mounted to /var, we can start multipathd service successfully.

Quoted 9 lines

-Ben

Quoted 3 lines

Regards,
Lixiaokeng

.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#3 lore raw
Quoted 30 lines · lixiaokeng
Quoted 21 lines · Benjamin Marzinski
Quoted 20 lines · lixiaokeng

When we enable multipathd.service with systemctl and reboot, multipathd doesn't start and log "failed to create pidfile".

The reason is following:

The RUN is /var/run in multipath-tools. When we start linux, we mount a disk to /var. So if multipathd.service start before mount, it will fail to activate.(If mount firstly, multipathd will start successfully)

The RUN is defined in Makefile.inc:

ifndef RUN

        ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
                RUN=run
        else
                RUN=var/run
        endif

endif

Quoted 6 lines
Quoted 1 line

Can it always be defined as run?

I believe all modern distributions make /var/run a symlink to /run. However, if that's the case, then I don't understand why you are running into this issue at all, since multipath should be using /run. What multipath packages are you using?

Quoted 6 lines

Yes, there is a symlink to /run in /var. But it is in the disk (such as sdb) mounted on /var actually. When reboot, systemd start multipathd service firstly then mount sdb to /var. In this way, the multipath service will not start.

After sdb mounted to /var, we can start multipathd service successfully.

But when the binaries were compiled, if /var/run existed and was a symlink in your build environment, then RUN should equal "run", and multipath should should be using /run instead of /var/run, right?

This is why I asked what multipath packages are you using.

-Ben

Quoted 9 lines
Quoted 9 lines

-Ben

Quoted 3 lines

Regards,
Lixiaokeng

.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author
#4 lore raw
Quoted 9 lines
Quoted 2 lines

After sdb mounted to /var, we can start multipathd service successfully.

But when the binaries were compiled, if /var/run existed and was a symlink in your build environment, then RUN should equal "run", and multipath should should be using /run instead of /var/run, right?

This is why I asked what multipath packages are you using.

This problem is found in 0.7.7.

Regards,
Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#5 lore raw
Quoted 10 lines · lixiaokeng
Quoted 9 lines
Quoted 2 lines

After sdb mounted to /var, we can start multipathd service successfully.

But when the binaries were compiled, if /var/run existed and was a symlink in your build environment, then RUN should equal "run", and multipath should should be using /run instead of /var/run, right?

This is why I asked what multipath packages are you using.

This problem is found in 0.7.7.

Sorry. I wasn't very clear with what I was asking for. Unless I'm missing something here, if multipathd is trying to use /var/run, that means that when the multipathd binary was compiled, it was compiled on a machine where /var/run was not a symlink.

So, I'm wondering where your multipathd binary got compiled. Are you using a packaged version from a distribution like RHEL, SLES, Fedora, Ubuntu, etc? Did you compile it yourself?

When I run multipathd under strace, I can see:

openat(AT_FDCWD, "/run/multipathd.pid", O_WRONLY|O_CREAT, 0644) = 3

The multipathd binary I'm using was compiled on a machine where /var/run is a symlink to /run, so multipathd directly uses /run, instead of using /var/run. I'm assuming that whatever machine your multipathd binary was compiled on, /var/run was a directory. Do you know if that's possible?

-Ben

Quoted 2 lines

Regards, Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#6 lore raw
Quoted 29 lines · Benjamin Marzinski
Quoted 10 lines · lixiaokeng
Quoted 10 lines
Quoted 3 lines

After sdb mounted to /var, we can start multipathd service successfully.

But when the binaries were compiled, if /var/run existed and was a
symlink in your build environment, then RUN should equal "run", and
multipath should should be using /run instead of /var/run, right?

Quoted 3 lines
Quoted 2 lines

This is why I asked what multipath packages are you using.

This problem is found in 0.7.7.

Sorry. I wasn't very clear with what I was asking for.  Unless I'm missing something here, if multipathd is trying to use /var/run, that means that when the multipathd binary was compiled, it was compiled on a
machine where /var/run was not a symlink.

So, I'm wondering where your multipathd binary got compiled. Are you using a packaged version from a distribution like RHEL, SLES, Fedora, Ubuntu, etc? Did you compile it yourself?

When I run multipathd under strace, I can see:

openat(AT_FDCWD, "/run/multipathd.pid", O_WRONLY|O_CREAT, 0644) = 3

Quoted 8 lines

The multipathd binary I'm using was compiled on a machine where /var/run
is a symlink to /run, so multipathd directly uses /run, instead of using
/var/run. I'm assuming that whatever machine your multipathd binary was
compiled on, /var/run was a directory. Do you know if that's possible?

Ack. Lixiaokeng, can you answer Ben's question?

Regards,
Martin

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author
#7 lore raw
Quoted 39 lines · Martin Wilck
Quoted 29 lines · Benjamin Marzinski
Quoted 10 lines · lixiaokeng
Quoted 10 lines
Quoted 3 lines

After sdb mounted to /var, we can start multipathd service successfully.

But when the binaries were compiled, if /var/run existed and was a
symlink in your build environment, then RUN should equal "run", and
multipath should should be using /run instead of /var/run, right?

Quoted 3 lines
Quoted 2 lines

This is why I asked what multipath packages are you using.

This problem is found in 0.7.7.

Sorry. I wasn't very clear with what I was asking for.  Unless I'm missing something here, if multipathd is trying to use /var/run, that means that when the multipathd binary was compiled, it was compiled on a
machine where /var/run was not a symlink.

So, I'm wondering where your multipathd binary got compiled. Are you using a packaged version from a distribution like RHEL, SLES, Fedora, Ubuntu, etc? Did you compile it yourself?

When I run multipathd under strace, I can see:

openat(AT_FDCWD, "/run/multipathd.pid", O_WRONLY|O_CREAT, 0644) = 3

Quoted 8 lines

The multipathd binary I'm using was compiled on a machine where /var/run
is a symlink to /run, so multipathd directly uses /run, instead of using
/var/run. I'm assuming that whatever machine your multipathd binary was
compiled on, /var/run was a directory. Do you know if that's possible?

Quoted 5 lines

Ack. Lixiaokeng, can you answer Ben's question?

Regards,
Martin

Hi Martin, Ben:
I'm sorry for missing reply. The situation is the same as ben said. The /var/run in compile machine is a directory, but it is a symlink in using machine.

Thanks Ben's help again.

Regards,
Lixiaokeng

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel