LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-17-2009, 10:01 AM   #1
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
fstab: allow regular user to unmount a loopback file?


I can mount a loopback squashfs file image as a user, but cannot then unmount it again.

I have the following line in my /etc/fstab file:
Code:
/home/ubuntu/dos/cd.squashfs /home/ubuntu/dos/cd squashfs user,loop,ro 0 0
When I try and mount the directory (as a regular user), it mounts okay.

mount then reports:
Code:
/dev/loop0 on /home/ubuntu/dos/cd type squashfs (ro,noexec,nosuid,nodev,user=ubuntu)
The exact same line appears in /etc/mtab.

But when I try to unmount it as the same regular user, I get the following error:
Code:
umount: /home/ubuntu/dos/cd mount disagrees with the fstab
I then have to unmount the file using root permissions.

Having read the mount manpage, it suggests that the user option will fail if /etc/mtab is a symlink to /proc/mtab (which it isn't).

I have also tried with various fstab options and seen the same error. The options I've tried include:
Code:
user,owner,loop,ro,noexec,nosuid,nodev
users,owner,loop,ro,noexec,nosuid,nodev
users,loop,ro,noexec,nosuid,nodev
Is there any way to debug why I'm getting this error when unmounting?

Thanks in advance for any help,

— Robert J Lee
 
Old 01-17-2009, 08:15 PM   #2
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey There,

The problem may be because

Quote:
/home/ubuntu/dos/cd.squashfs
from the /etc/fstab gets translated into

Quote:
/dev/loop0
once it's mounted.

Have you tried using this line in /etc/fstab instead?:

Quote:
/dev/loop0 /home/ubuntu/dos/cd squashfs user,loop,ro 0 0
It may or may not work, but it's worth a shot

Best wishes,

Mike
 
Old 01-18-2009, 05:52 PM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Original Poster
Rep: Reputation: 76
Hi Mike,

Thanks for that.

Your suggestion did actually work, in that you could then unmount the partition. But that meant that mounting the filesystem would just sit there, since it didn't know what file /dev/loop0 should point to.

Which made me realise how to fix it:

I put two lines in the fstab for it. My original line came first, and so it would be found by mount. Then I added a second copy of the line, with the file replaced with /dev/loop0, right after it, and unmount would find that and let me unmount it.

It doesn't seem very tidy, and I don't think I've ever seen that approach documented anywhere, but it does work.

Thanks again,

—Robert J Lee
 
Old 01-18-2009, 08:16 PM   #4
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Nice,

That is unusual. I've never seen it done that way, either.

If it's not a bug, it must be a feature

Nice work - Glad I could help you out

, Mike
 
Old 01-21-2009, 02:48 PM   #5
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Original Poster
Rep: Reputation: 76
One further point, in case anyone else has the same problem: I needed to add the noauto option to one line to stop it from mounting twice.
 
Old 06-16-2015, 04:56 AM   #6
Pixmix
LQ Newbie
 
Registered: Jun 2015
Posts: 2

Rep: Reputation: Disabled
same problem and same solution with tagsistant

Just a brief update if someone stomps here having the same problem with tagsistant:

I got the same problem and I solved it adding a dummy line in the /etc/fstab file conform to the naming reported by mount as suggested.

Quick and dirty, but works.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How add a loopback DVD iso image to fstab?? carl0ski Linux - General 3 09-02-2011 02:55 PM
Cant unmount CD-Rom with user 2Pacalypse Linux - Hardware 2 02-24-2007 04:06 AM
regular user mounts and fstab (again) clawder Slackware 7 12-31-2004 12:37 PM
Simple problem FSTAB File - User settings 'uid=xxx' crazyswede Linux - Networking 7 02-19-2004 03:59 PM
Samba: User can mount, but not unmount Wynd Linux - Networking 2 09-23-2003 06:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration