Bug 19108 - Stop using /etc/mtab (_PATH_MOUNTED) in Linux
Summary: Stop using /etc/mtab (_PATH_MOUNTED) in Linux
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-09 14:50 UTC by Martin Pitt
Modified: 2024-04-18 11:36 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Pitt 2015-10-09 14:50:21 UTC
An /etc/mtab file has been a broken concept right from the start (putting info about mounted file systems on a mounted file system), and at least in Linux (util-linux, systemd, etc.) it has been dead for many years. Every distro, systemd, etc. configure /etc/mtab as a symlink to /proc/mounts, but every now and then it still happens that /etc/mtab is a file: you might keep `/etc/` in revision control, under backup, trying to edit it, etc.

This then causes e. g. libmount's mount monitor to break, systemd 227 will not even boot (which is way too strict, I'm currently arguing about that in https://github.com/systemd/systemd/issues/1495), and it's generally a pointless exercise these days -- there is just one valid value for that file (be a symlink to /proc/mounts).

util-linux has deprecated it a while ago (offering --enable-libmount-force-mountinfo), and 2.27.1 will cease to pay attention to it completely (https://github.com/karelzak/util-linux/commit/02501746). glibc's _PATH_MOUNTED seems to be pretty much the only place left that actually still needs /etc/mtab.

So, my plea: can we pretty please get rid of this altogether, use /proc/mounts consistently, and stop creating/using/paying attention to /etc/mtab altogether? (At least for Linux, not sure about BSD and others).

Thank you for considering!
Comment 1 Jason A. Donenfeld 2015-11-18 14:33:26 UTC
Submitted a patch for this:
https://sourceware.org/ml/libc-alpha/2015-11/msg00418.html