I just upgraded to 18.04 on my NAS. I have a script that prompts my user for a luks password and then mounts the drive after it's decrypted. This used to work:

cryptsetup luksOpen /dev/md0 md0_crypt
udevadm settle --exit-if-exists=/dev/mapper/files--vg-main
mount /dev/mapper/files--vg-main /main

However after updating to 18.04 this stopped working and I get: mount: /main: special device /dev/mapper/files--vg-main does not exist.

I have not found a solution just googling. My LUKS container is my pv. I have it in a Vol group called files-vg. I then have one logical volume with a path /dev/files-vg/main. Hence why I'm looking for /dev/mapper/files--vg-main

Edit: To clarify, the udevadm settle line does not wait long enough for the LV to become available so the mount fails. I can manually call mount and it will work afterward.

  • Have you tried putting a sleep 3 between line 1 and 2? If that's too much time, try 2, if too little, try 4. Please ping me @Fabby with the results.
    – Fabby
    Commented Oct 3, 2018 at 17:32
  • I think that would work but it's inelegant. I'm looking for something to mount the drive as soon as it's available
    – James Dean
    Commented Oct 4, 2018 at 3:40

1 Answer 1


Here's an ugly workaround that I don't have a LUKS container to test on:

udevadm info /dev/mapper/files--vg-main

Where /dev/mapper/files--vg-main is the device you are checking for. if [ $? -eq 0 ] then the command was successful meaning the device exists and you can mount it.

else you'd have to loop and check again.

As a side note you can find some useful udev debugging ideas on this page.

You must log in to answer this question.

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