LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Problems trying to unmount a tmpfs filesystem (https://www.linuxquestions.org/questions/linux-software-2/problems-trying-to-unmount-a-tmpfs-filesystem-4175447673/)

lp rob1 01-29-2013 06:05 AM

Problems trying to unmount a tmpfs filesystem
 
I am using pam_mount to mount user home areas as tmpfs on login, and to unmount the area on logout. The line in question in pam_mount.conf.xml is as follows:
Code:

<volume options="size=100m,uid=%(USERUID),gid=%(USERGID),mode=0700" mountpoint="~" uid="1000-50000" fstype="tmpfs" />
The mounting part works - the user gets their home area with correct permissions and correct size for them to use. The problem is with unmounting on logout. The home area stays mounted after logout, and looking in auth.log pam_mount says that the device is busy, and thus it was unable to unmount. But the problems don't stop there - trying to unmount the area manually as root also fails due to the device being busy. I have checked with fuser and (at least with the best of my ability) using lsof, and no files are open within the home area. The only way I can get it to 'unmount' is to do a lazy unmount, but even that isn't a real unmount. Forcing unmount has no effect either.

My first thoughts were that tmpfs was somehow bugged, but this was disproven since adding another line to mount a tmpfs somewhere other than the home area works fine. I have tried using the logout kill option in the configuration to kill any processes that might still be running, but also to no avail. And now, at the end of my rope, I come here in the hopes of finding a possible solution.

System specs:
(X)ubuntu 12.04, heavily customized XFCE desktop, LightDM with KDE greeter, fully updated until a few days ago. Running on an SSD, using open-source graphics drivers.

Alright, I did a bit more testing on this. I disabled the pam_mount tmpfs line, and mounted a tmpfs as my home area (all of this done while logged in as root). I then logged out of root, logged in as myself (everything working OK with regards to the desktop), then logged out again and back in as root. Attempting to umount the home area again gives a device is busy error. I tried deleting everything inside the home area and trying again - still no joy. Yet again, the only thing that can successfully unmount the tmpfs is a lazy unmount.

I used the following specific commands:
Code:

mount -t tmpfs -o uid=1000,gid=1000,size=100m,mode=0700 none /home/user
(at this point I logged in as myself)
umount /home/user

Now that pam_mount has been ruled out, this thread is a general question of why does a home area mounted as tmpfs not allow itself to be unmounted again properly? Unfortunately I cannot find a way to change the title of this thread - perhaps a mod could do that?

EDIT: I have narrowed it down further - logging in though a virtual terminal does not 'corrupt' the tmpfs, while logging in though an X session does. I uninstalled gvfs just in case it was the culprit (these kinds of things usually are) but it was not. Anything else to try, short of uninstalling all graphical apps?

EDIT2: The mystery deepens. Doing the same thing on my Arch Linux install (again with XFCE) the unmounting worked just fine. I am now struggling to understand what is causing these problems.

Ztcoracat 02-07-2013 11:33 PM

Hi:

This is most perplexing and I'd like to re-search this to help you.
A few questions if you don't mind-

Is it possible that the KDE Greeter could be conflicting with the XFCE Desktop Environment?

By tmpfs do you mean temporary file?

Is the directory encrypted?
If so this might help-
https://help.ubuntu.com/community/En...ivateDirectory

Quote:

I cannot find a way to change the title of this thread - perhaps a mod could do that?
Don't worry about that I'll do some re-search to help and if I can not I'll request a Moderators assistance.

Ztcoracat 02-07-2013 11:59 PM

Looking and searching on the web I found a few things that may help-


Here's How To unmount when the device is busy
http://ocaoimh.ie/2008/02/13/how-to-...evice-is-busy/
http://ubuntuforums.org/search.php?searchid=89102891

I know your not running Arch but this might help-
Encrypted $HOME - umount after logout and ssh access
https://bbs.archlinux.org/viewtopic.php?id=98227

I realize that this article is How To keep the directory mounted but perhaps by learning how it's kept mounted we can be enlightened to the reversal of what you have going on.
http://ubuntuforums.org/archive/inde...t-1694953.html

Maybe it's a encryption/decryption issue to be able to mount and 'unmount'

http://askubuntu.com/questions/19288...gin-and-logoff

lp rob1 02-09-2013 05:19 AM

Thanks for replying! I thought this thread might die into oblivion. To answer your questions:
The home area is not encrypted. I have tried using fuser and lsof to find open files, but still nothing. However, on a different Ubuntu install (still using XFCE, but the Unity greeter) the process works fine.
By tmpfs I mean a 'tmpfs' type volume that acts as a ramdisk. The idea would be that the user's home area would be on a ramdisk, thus be volatile and lose all changes on logout, but also fast due to it running off the memory.

Could the fact that I use Winbind authentication change anything?

jpollard 02-09-2013 11:23 AM

Do a "fuser <mountpoint>" when it hangs. It will show you what processes still have it open.

In the past, I have found that some desktops (gnome3/cinnamon/kde) leave processes hanging around after logout. These would prevent you from dismounting.

Another thing - remember that some desktops also use fuse mounts within the users home directory. So a "mount" listing might show these hanging around as well, and that too would prevent a dismount.

Ztcoracat 02-09-2013 11:51 AM

Try what jpollard; has recommended and I'll investigate 'Windbind and it's Authentication'

Authentication Methods (there are more than one kind)
- The balanced password with key exchange
- The Augmented password; key exchange password authenticated key retrieval
- Multi Server Methods and the Multi Party Methods

Ztcoracat 02-09-2013 12:14 PM

Using Windbind shouldn't be a problem as it is part of the Samba 7 suite.
The only thing I found is that turning off user enumeration maycause some programs to behave oddly-

If you do suspect that Windbind could be causing conflict the Windbind log should provide you with some clarification. Read through the log and see if you find something odd.

http://h30097.www3.hp.com/docs/iass/...8/0044____.HTM

Found a bug with Windbind and Ubuntu but it was in 2010
Occasionally on various Ubuntu 64-bit LucidLynx systems (10.04.1), winbind goes into a state such that logging in fails.
https://bugs.launchpad.net/ubuntu/+s...ba/+bug/667269

What one member at Ubuntu tried and Solved his issue with Windbind and the log
http://ubuntuforums.org/showthread.php?t=1645039

Hope this helps

lp rob1 02-10-2013 01:43 AM

I have already tried the fuser thing (and lsof) but to no avail. mount shows no FUSE filesystems mounted within the home area, and there are no processes running as me after logout. However, I will look into the Winbind links.

Ztcoracat 02-11-2013 02:07 PM

Hmm...to no avail with the 'fuser'
I'm baffled not sure what is going on-

Would you like me to write to the folks I know at Ubuntu and see what they think? ?

lp rob1 02-12-2013 10:50 AM

I will test once more on a slightly updated system, but it would be nice to know exactly what to try to find the problem - perhaps the Ubuntu guys could give some answer on that? For reference, the exact procedure is as follows:

Assume a user, 'testuser' can be authenticated through Winbind, which is connected to a Samba3 domain. This user has a home area defined as /home/testuser
Log in as root on the machine, and create /home/testuser, then run
Code:

mount -t tmpfs -o size=100m,uid=[testuser-uid],gid=[testuser-gid],mode=0700 none /home/testuser
Logout as root, and log in as testuser.
Logout as testuser, log in as root.
Attempt to unmount /home/testuser - this fails for me with 'Device is busy'

An important thing to note is that logging in through the graphical interface causes the problem, while logging in only through a virtual terminal doesn't. As mentioned before fuser and lsof do not show anything using that directory. The machine had GVFS uninstalled, however even with it installed there was no change. Repeat of the specs: XFCE desktop, LightDM with KDE greeter, Ubuntu 12.04.

At the moment I have defaulted back to our previous method of simply clearing /home on boot, but getting tmpfs to work properly will be really cool, especially if it can be linked with pam_mount to give automatic mounting/unmounting of the home area on login/logout.

Ztcoracat 02-13-2013 02:15 PM

lp rob1:

Good news; I posted a thread on your behalf; in the Ubuntu Forum-
- I explained the details and spec's about your system and they know now all of what you have tried-

I should hear from them in a few days but a 'heads-up' if they require me to provide them with your systems output of commands that need to be executed this could get complicated so I would need you to be prompt and answer as soon as your able to.

As soon as one of the Ubuntu Members or Forum Staff answer me I'll let you know what they have to say and what they think-

lp rob1 02-14-2013 10:30 AM

Thank you so much for this! Getting system information quickly may be an issue - I may be able to get a copy of the OS running at home on a virtual machine, but if I can't then it's weekdays only. Still - since this will ultimately benefit me I will try my best.

Ztcoracat 02-14-2013 01:52 PM

Your Welcome lp rob1!:hattip:

In that case just do what you can.
As soon as I hear from them I'll let you know in my next post what they want-

Ztcoracat 02-21-2013 05:08 PM

Nothing yet- sorry
115 folks have viewed the thread I made on your behalf but no reply yet-

Ztcoracat 03-11-2013 10:28 PM

Quote:

Originally Posted by Ztcoracat (Post 4897039)
Nothing yet- sorry
115 folks have viewed the thread I made on your behalf but no reply yet-

3-4 weeks later; 150 members have view the thread.

Still not response. Not sure why-

Past experience with the folks @Ubuntu sometimes it takes a while-


All times are GMT -5. The time now is 12:07 AM.