#102 pam_mount always deletes mount point

pam_mount (94)

I'm using pam_mount to mount and encrypted luks partition on top of LVM.

Pam_mount version 2.10 always removes a mount point even when stated in pam_mount.xml to not remove it.
System: Ubuntu 12.04 x64 beta1
pam_mount version 2.10
pam_mount.xml: http://pastebin.com/3BmesDBs
I've had the mkmountpoint enabled with enable=0, remove=false; enable=1, remove=false; and completely commented. Everytime when I reboot the mountpoint gets deleted.
After I login to the system and create the mountpoint manually the mount command works normal.

Let me know if you need more details.


  • Blue Duck

    Blue Duck - 2012-07-24

    Exctly same issue here, for weeks. Any progress in resolution?

  • Jan Engelhardt

    Jan Engelhardt - 2012-07-30

    I cannot reproduce your problem. Also note that pam_mount only runs when you login, and when you logout. If the directory disappears during reboot, that is a problem of your distribution and/or how you set your system configuration up.

  • Jan Engelhardt

    Jan Engelhardt - 2012-07-30
    • status: open --> pending-works-for-me
  • stefan

    stefan - 2012-08-01
    • status: pending-works-for-me --> open-works-for-me
  • stefan

    stefan - 2012-08-01

    Just throwing down a couple of ideas until I get to test:

    Have you tried reproducing it in ubuntu 12.04 or on another disto?
    How are you trying to reproduce it ? Maybe I can help you with that.

    How can the "distro" delete a sub-directory in the /media directory but not any of the other sub-directories ?
    How can it delete just the sub-directory that has been specified in the pam_mount.xml ?

    This worked fine in previous versions of pam_mount, last time I tried it in ubuntu 11.04 I think.

  • stefan

    stefan - 2012-08-01

    This is what I've done to successfully reproduce the problem on my laptop.

    I've moved pam_mount.xml out of /etc
    I've manually created /meda/<dir> ( mountpoint )
    As expected, the directory is still there after the reboot.
    Moved pam_mount.xml in its place in /etc
    The /media/<dir> is not there anymore.

    This makes me point a finger at pam_mount for the deletion of the mount point.
    Let me know if you need other details.

  • Jan Engelhardt

    Jan Engelhardt - 2012-08-01

    >Have you tried reproducing it in ubuntu 12.04 or on another disto?

    openSUSE 12.1, the one I am developing on.

    >How are you trying to reproduce it ? Maybe I can help you with that.

    I change to another user with "su - gt" (gt is my other trash user), for which volume(s) are configured depending on whatever I have to debug. For use with your problem, I reused what I had left in:

    <volume user="gt" path="/home/gt" mountpoint="/home/foo/bar/gt"

    /home/foo does not exist; on login, so pam_mount will create /home/foo/bar/gt (because it did not exist and I have enable="1"), and on logout, pam_mount 2.13 will also remove /home/foo/bar/gt (but not /home/foo/bar nor /home/foo), because pam_mount itself was the creator of the mountpoint, and because remove=1.

  • Jan Engelhardt

    Jan Engelhardt - 2012-08-01

    Keep in mind that /media may be configured by certain advanced distributions (particularly those with systemd) to be a tmpfs, since /media is only meant to hold dirs to more mountpoints (for attached USB disks, etc.). As tmpfs is volatile, its content may be cleared across reboots.

  • stefan

    stefan - 2012-08-01

    I can confirm that /media is not mounted as tmpfs.

    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 155G 122G 26G 83% /
    udev 3.9G 12K 3.9G 1% /dev
    tmpfs 1.6G 1.2M 1.6G 1% /run
    none 5.0M 0 5.0M 0% /run/lock
    none 3.9G 344K 3.9G 1% /run/shm

    Any idea what else to troubleshoot ?
    In my case pam_mount has not been the creator of the mountpoint. Should it delete the mountpoint ?
    I have this in the settings xml

    <volume user="stefan" fstype="crypt" path="/dev/disk/by-uuid/d39c4101-9ac7-4b9c-89da-16e3d544b0c6" mountpoint="/media/truecrypt1" options="fsck,relatime" />

    <!-- <mkmountpoint enable="1" remove="false" /> -->

  • Jan Engelhardt

    Jan Engelhardt - 2012-08-01

    pam_mount should never delete a mntpt it has not created.

    To that end, I identified one spot where it might do that nevertheless... on login, when mounting of a volume fails, versions up to and including 2.13 will unconditionally attempt to rmdir the directory.

  • stefan

    stefan - 2012-08-01

    As promising as your find looks, how can I troubleshoot further ?

    In my case the lvm gets mounted correctly, once I'm logged in all I have to do is create /media/truecrypt1 ( mountpoint ) and then
    mount /media/truecrypt1
    I don't mount the underlying lvm manually.

    Any ideas how I can troubleshoot further ?
    How do you troubleshoot on your machine ?

  • stefan

    stefan - 2012-08-12

    Another test that I've ran:
    I've changed the mount point location in pam_mount.xml and in /etc/fstab to point to /home/stefan/truecrypt1
    I've created the directory manually
    After rebooting the directory gets removed ( I suspect by pam-mount ) since this directory is located in my home directory and it is not in any system accessed directories.

    Any other thoughts on how to troubleshoot ?

  • Jan Engelhardt

    Jan Engelhardt - 2012-08-13

    Make sure that you only log in as root - on the text console tty1 perhaps -, and from there, use `su - stefan` to execute pam_mount on change to and from stefan. The directory should not be removed.

    If for some reason, pam_mount is executed on reboot (it should not), you would find appropriate messages in /var/log/messages at the time of shutdown.

  • stefan

    stefan - 2013-12-22

    I gave pam_mount another try and this time it is succesfully mounting my encrypted partition.

    System: Ubuntu 13.10 x64
    pam_mount version 2.14

    $ dpkg -l libpam-mount
    ii  libpam-mount                                                  2.14~zgit3+966c6bea-3               amd64                               PAM module that can mount volumes for a user session

    From my point of view this bug looks like it has been fixed.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks