3

I got a machine running Arch Linux that have a problem on boot. It hangs for 90s waiting for pvscan on block devices, and then give up. (actually, the pvscan process are still stuck , and any lvm command after that will hang too). Sometimes it works well.

After some digging, it looks like lvmetad(8) is responsible for this hang, as it hangs itself at start:

lvmetad[360]: Cannot lock lockfile [/run/lvmetad.pid], error was [Resource temporarily unavailable]

If I kill it and start it again after boot, the hanging pvscan processes are unlocked, finish their works, and everything goes back to normal (lvm commands works again, etc.)

You can see this in logs : Pastebin

I tried to lower verbosity of lvmetad, but I only get the error given.

sometimes the boot is a little longer than usual (waiting for root partition), and lvmetad starts well (I'm not sure it's really related, though)

Have you an idea on how to prevent this error?

I've collected more information:

  • the "cannot log logfile" error appears when fcntl() fails with EAGAIN (a file to be locked is already shared-locked or exclusive-locked by another process)
  • there is a lvmetad running on the system, with a very little pid (way littler than the failing process we see in logs)
  • the lvmetad process spawned by lvm2-lvmetad.service is run with -f, so the running one is not this one
  • the first one was started 3 seconds before the second (before systemd)

The cleanup hook of lvm2 component for initrd should kill the early lvmetad, but for some reason it does not work:

run_cleanuphook() {
    kill $(cat /run/lvmetad.pid)
}

killing the process after boot don't work either.

I took a debug trace (can't post a third link, I put it at the end of the second paste), and it looks like the main thread is waiting for terminations of other threads, and there is a client_thread stuck on a read on fd 6 (/run/lvm/lvmetad.socket)

0

Note that the author since reported this as a bug to Archlinux and there's a helpful discussion here https://bugs.archlinux.org/task/41833

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.