Debian Bug report logs - #94076
mount: doesn't update mtab when link to writable file

version graph

Package: mount; Maintainer for mount is util-linux packagers <util-linux@packages.debian.org>; Source for mount is src:util-linux (PTS, buildd, popcon).

Reported by: Tilman J. Rothe <tjr@extaxpi.de>

Date: Sun, 15 Apr 2001 18:06:00 UTC

Severity: wishlist

Tags: patch

Merged with 154438, 218197

Found in versions 2.10f-5.1, 2.11n-4, 2.12-3

Fixed in version 2.20.1-1

Done: Roger Leigh <rleigh@codelibre.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Adrian Bunk <bunk@fs.tum.de>:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Tilman J. Rothe <tjr@extaxpi.de>:
New Bug report received and forwarded. Copy sent to Adrian Bunk <bunk@fs.tum.de>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Tilman J. Rothe <tjr@extaxpi.de>
To: submit@bugs.debian.org
Subject: mount: doesn't update mtab when link to writable file
Date: Sat, 14 Apr 2001 22:14:00 +0200
Package: mount
Version: 2.10f-5.1
Severity: normal

Hi,
mount doesn't update the mtab at all if /etc is on a readonly
partition and /etc/mtab is a link to a writable file.

In this example, /etc is a symlink to /mnt/rootfs/etc,
/mnt/rootfs/etc/mtab is a symlink to /volatile/mtab, which is clearly
writable. 


#!/volatile/ash
# script to be executed like init, from a /dev/initrd - ram-disk.
# for some reason, you habe to tell the kernel explicitly:
# ... root=/dev/ram init=/linuxrc
set -x
/volatile/mount -n      -t proc proc      /proc
/volatile/mount -n  -ro -t ext2 /dev/hdc7 /mnt/rootfs 
/volatile/mount -n  -ro -t ext2 /dev/hdc6 /usr
# even whithout the "-n", nothing is written to /etc/mtab, even though
#is available by now.
# /usr, /mnt/rootfs, / are mounted correctly. I can remount them to
#make them rw/ro, and mounting them again gives the usual/correct
#buisy-or-not-found error.

# idea: write into the real mtab (/etc/mtab -> /volatile/mtab)
# this time I get only a general "help" message, like from a syntax
# error. 
/volatile/mount -f  -ro -t ext2 /dev/hdc7 /mnt/rootfs
/volatile/mount -f  -ro -t ext2 /dev/hdc6 /usr

#until here, executing "mount" doesn't output anything at all.
/usr/bin/cat /volatile/mtab #empty
/usr/bin/cat /proc/mounts >/volatile/mtab
# but here "mount" is informed correctly.


-- System Information
Debian Release: 2.2
Kernel Version: Linux extaxpi 2.2.18 #2 Sun Jan 21 14:56:31 CET 2001 i586 unknown

Versions of the packages mount depends on:
ii  libc6          2.1.3-18       GNU C Library: Shared libraries and Timezone



Information forwarded to debian-bugs-dist@lists.debian.org, Adrian Bunk <bunk@fs.tum.de>:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Colin Watson <cjw44@flatline.org.uk>:
Extra info received and forwarded to list. Copy sent to Adrian Bunk <bunk@fs.tum.de>. (full text, mbox, link).


Message #10 received at 94076@bugs.debian.org (full text, mbox, reply):

From: Colin Watson <cjw44@flatline.org.uk>
To: 94076@bugs.debian.org
Cc: "Tilman J. Rothe" <tjr@extaxpi.de>, control@bugs.debian.org
Subject: Re: [PATCH] mount: doesn't update mtab when link to writable file
Date: Tue, 1 May 2001 23:07:07 +0100
tags 94076 patch
thanks

mount explicitly avoids updating /etc/mtab when it's a symlink;
according to comments in the code, this is to prevent /proc/mounts being
accidentally created when /proc isn't mounted. However, it doesn't check
that /etc/mtab is a symlink to /proc/mounts, it just checks that it's a
symlink. Since having it as a symlink to somewhere else works fine (I've
just tested it), here's a patch:

--- util-linux-2.11b/mount/fstab.c.orig	Tue May  1 22:29:34 2001
+++ util-linux-2.11b/mount/fstab.c	Tue May  1 22:40:26 2001
@@ -27,11 +27,13 @@
 static void
 get_mtab_info(void) {
      struct stat mtab_stat;
+     char link_path[PATH_MAX+1];
 
      if (!have_mtab_info) {
 	  if (lstat(MOUNTED, &mtab_stat))
 	       var_mtab_does_not_exist = 1;
-	  else if (S_ISLNK(mtab_stat.st_mode))
+	  else if (S_ISLNK(mtab_stat.st_mode)
+		   && !strcmp(realpath(MOUNTED, link_path), PROC_MOUNTS))
 	       var_mtab_is_a_symlink = 1;
 	  have_mtab_info = 1;
      }

Thanks,

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Tags added: patch Request was from Colin Watson <cjw44@flatline.org.uk> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>, util-linux@packages.qa.debian.org:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>, util-linux@packages.qa.debian.org. (full text, mbox, link).


Message #17 received at 94076@bugs.debian.org (full text, mbox, reply):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 94076@bugs.debian.org
Subject: Can you please fix #94076?
Date: 19 Apr 2003 16:01:21 +0200
Bug #94076 is now more than two years old.  The bug makes it
impossible for the administrator to move the mtab file out
of /etc by making /etc/mtab a symlink.  A patch has been
supplied.  Can you please apply it?

-- 
Thomas Hood <jdthood@yahoo.co.uk>




Severity set to `wishlist'. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. (full text, mbox, link).


Tags removed: patch Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. (full text, mbox, link).


Merged 53829 94076 154438. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to util-linux@packages.qa.debian.org:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and filed, but not forwarded. Copy sent to util-linux@packages.qa.debian.org. (full text, mbox, link).


Message #28 received at 94076-quiet@bugs.debian.org (full text, mbox, reply):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 53829@bugs.debian.org
Cc: 94076-quiet@bugs.debian.org, 154438-quiet@bugs.debian.org, Luca Barbieri <ldb@ldb.ods.org>, "Tilman J. Rothe" <tjr@extaxpi.de>, cesarb@web4u.com.br
Subject: merge 94076 154438 53829
Date: 21 Apr 2003 15:52:17 +0200
severity 94076 wishlist
severity 154438 wishlist
severity 53829 wishlist
tags 94076 - patch
tags 154438 - patch
tags 154438 - upstream
retitle 53829 Should move /etc/mtab to /run/
merge 94076 154438 53829
thanks

The first two (##94076, 154438) are requests that mount write
to the target of /etc/mtab if the latter is a symlink to
some location other than /proc/mounts.

#154438 has a more complicated patch than that in #94076.

#53829 is a request that mtab be moved to /var/run.
Actually mtab can't be moved there because /var may be
remotely mounted.  Therefore mtab has to do some place like
/run/.

I think that the simplest solution is for mount to write
to /run/mtab instead of /etc/mtab.  Then the "do nothing if
it's a symlink" code can be left as it is and mount won't
write to /run/mtab if THAT is a symlink.  The maintainer
scripts can make sure at configure time that /etc/mtab is
a symlink to /run/mtab.

Of course this solution has to wait until /run/ is implemented
by the sysvinit package.  That's coming, hopefully.

Please follow up at #53829.

-- 
Thomas Hood <jdthood@yahoo.co.uk>




Disconnected #53829 from all other report(s). Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (full text, mbox, link).


Message #35 received at 94076@bugs.debian.org (full text, mbox, reply):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 94076@bugs.debian.org
Subject: What is happening on the /etc/mtab symlink front?
Date: 26 Jun 2003 18:45:28 +0200
Hi.  ##94076 and 154438 request that mount follow a
symlink at /etc/mtab so long as the destination isn't
under /proc/.  This change is needed so that people
can mount / (and /etc/) read-only.  Is this issue being
addressed?

(Please follow up to #154438 and cc: me.)

--
Thomas Hood




Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to bolaadeosho@gawab.com:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (full text, mbox, link).


Message #40 received at 94076@bugs.debian.org (full text, mbox, reply):

From: Bola Adeosho <'bolaadeosho@gawab.com>
To: 94076@bugs.debian.org
Subject: Business Proposition:Respond ASAP
Date: Tue, 10 Feb 2004 13:00:16 +0000 (GMT)
Hello.
 
After due consideration, I have been mandated to contact you to participate in a Multi-million Dollar project for the benefit of all parties in involved (your side and mine).
 
I would really like to apologise for any inconvinience my mail might have caused you considering the fact that you had no fore knowledge of who I am or what I am proposing. At the same token, I will appreciate an urgent response as soon as posible with your phone and fax numbers and I will call you immediately to provide you with further details about the intended proposition as well as details on how to execute it successfully.

I will expect your response.

Kind regards

Bola Adeosho
Administrative Manager
Union Bank Headquarters
40, Marina, Lagos-Nigeria.







Merged 94076 154438 218197. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. (full text, mbox, link).


Tags added: patch Request was from Thomas Hood <jdthood@aglu.demon.nl> to control@bugs.debian.org. (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, LaMont Jones <lamont@debian.org>:
Bug#94076; Package mount. (full text, mbox, link).


Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to LaMont Jones <lamont@debian.org>. (full text, mbox, link).


Message #49 received at 94076@bugs.debian.org (full text, mbox, reply):

From: Petter Reinholdtsen <pere@hungry.com>
To: 94076@bugs.debian.org
Subject: Re: mount: doesn't update mtab when link to writable file
Date: Sat, 11 Aug 2007 18:13:33 +0200
We have run into this problem with diskless workstations in Debian
Edu, where it blocks CD mounts to work properly from KDE.  See
<URL: http://bugs.skolelinux.no/show_bug.cgi?id=1234 > for that bug
report.

The diskless workstation setup is a LTSP version with local
applications.  The file system is read-only, and thus /etc/ can't be
written to.  To get mounts working, we symlinked /etc/mtab to
/proc/mounts, after discovering that symlinking it to a writable
directory did not work.  This work for most mount points, but not for
the CDROM mounts, because /proc/mounts do not contain the user= flag
documenting who did the mounting.  This make it impossible for the
local user to umount the mounted CDROM.

Please make it possible to keep mtab outside /etc/, for example in
/lib/init/rw/.  Or at the very least, let it handle symlinks from
/etc/mtab to a writable location and do the update to the file pointed
to by the symlink.

Happy hacking,
-- 
Petter Reinholdtsen



Reply sent to Roger Leigh <rleigh@codelibre.net>:
You have taken responsibility. (Tue, 10 Jan 2012 14:01:05 GMT) (full text, mbox, link).


Notification sent to Tilman J. Rothe <tjr@extaxpi.de>:
Bug acknowledged by developer. (Tue, 10 Jan 2012 14:01:08 GMT) (full text, mbox, link).


Message #54 received at 94076-done@bugs.debian.org (full text, mbox, reply):

From: Roger Leigh <rleigh@codelibre.net>
To: 64479-done@bugs.debian.org, 94076-done@bugs.debian.org, 116288-done@bugs.debian.org, 235952-done@bugs.debian.org, 277931-done@bugs.debian.org, 296201-done@bugs.debian.org, 354298-done@bugs.debian.org, 409008-done@bugs.debian.org, 412152-done@bugs.debian.org, 440828-done@bugs.debian.org, 446921-done@bugs.debian.org, 533901-done@bugs.debian.org, 634871-done@bugs.debian.org
Subject: Closing mtab-related bugs
Date: Tue, 10 Jan 2012 13:54:26 +0000
Version: 2.20.1-1

/etc/mtab is now a symlink to /proc/mounts.  Bugs which were a
result of editing /etc/mtab which make it get out of sync with
the real kernel state are now no longer an issue.

mount continues to support /etc/mtab as a file for the time
being, and so some bugs are still technically present in the
package, but will not be encountered in practice due to no
longer being a supported default.

Several of these bugs were already fixed by new upstream releases.
All are fixed now /etc/mtab is a symlink.

#64479 mount: should use /proc/mounts with mtab as backup
 - /proc/mounts is now always used
#94076 mount: doesn't update mtab when link to writable file
 - not a problem with mtab as a symlink
#116288 mount: mount leaves type auto in /etc/mtab
 - not a problem with mtab as a symlink
#235952 mount: remount failed to change option, but updated mtab any way.
 - not a problem with mtab as a symlink
#277931 mount: When bind mounting /proc to a mtpt named 'proc' the mount point's full path is not written to mtab
 - not a problem with mtab as a symlink
#296201 mount: unprivileged user can mount partition without updating mtab
 - race no longer present; no mtab writing
#354298 mount --rbind does not update /etc/mtab properly
 - not a problem with mtab as a symlink
#409008 mount --move skrews up mtab
 - not a problem with mtab as a symlink
#412152 -f updates mtab on remount
 - mount -f was behaving as documented, and in any case, mtab is
   now no longer updated
#440828 umount fails to remove entry in /etc/mtab when unmounting
 - not a problem with mtab as a symlink
#446921 mount -oremount,size=10G /tmp miswrites mtab
 - not a problem with mtab as a symlink
#533901 "user" mounts broken when /etc/mtab is a symlink
 - now works just fine
#634871 mount refuses to update mtab if there's any entry with "none"
 - fixed


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.




Reply sent to Roger Leigh <rleigh@codelibre.net>:
You have taken responsibility. (Tue, 10 Jan 2012 14:01:16 GMT) (full text, mbox, link).


Notification sent to "Luca Barbieri" <ldb@ldb.ods.org>:
Bug acknowledged by developer. (Tue, 10 Jan 2012 14:01:24 GMT) (full text, mbox, link).


Reply sent to Roger Leigh <rleigh@codelibre.net>:
You have taken responsibility. (Tue, 10 Jan 2012 14:01:34 GMT) (full text, mbox, link).


Notification sent to Evan Harris <eharris@puremagic.com>:
Bug acknowledged by developer. (Tue, 10 Jan 2012 14:01:40 GMT) (full text, mbox, link).


Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 08 Feb 2012 07:39:05 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 15 21:23:37 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.