mount -o remount always appends options to /etc/mtab even if they already exist

Bug #891688 reported by Amit Kucheria on 2011-11-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pm-utils (Ubuntu)
Martin Pitt

Bug Description

I have an external usb HDD attached to my system to store parts of /home. Every time I suspend and resume the laptop, mount appends a subset of the mount options to the already existing list.

I currently have this in the output of mount:

/dev/sdc1 on /media/LaCie type ext4 (rw,nosuid,nodev,commit=600,commit=600,commit=0,commit=600,commit=0,commit=600,commit=0,commit=0,commit=0,commit=600,commit=0,commit=0,commit=600,commit=0,commit=600,commit=600,commit=0,uhelper=udisks)

/etc/fstab doesn't have a line for this disk.


$ sudo modprobe scsi_debug
$ sudo mkfs.ext4 /dev/sdb
$ sudo mount /dev/sdb /mnt
$ grep sdb /etc/mtab
/dev/sdb /mnt ext4 rw 0 0

$ sudo mount -o remount,commit=600 /dev/sdb
$ grep sdb /etc/mtab
/dev/sdb /mnt ext4 rw,commit=600 0 0

$ sudo mount -o remount,commit=600 /dev/sdb
$ grep sdb /etc/mtab
/dev/sdb /mnt ext4 rw,commit=600,commit=600 0 0


ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: mount 2.19.1-2ubuntu3
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 1.23-0ubuntu4
Architecture: amd64
CheckboxSubmission: ebb646ad5c6c4ca2fe9420855758001f
CheckboxSystem: 7e42599bda39ea7ff8b528272b6ef52b
Date: Thu Nov 17 21:29:08 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64+mac (20110127)
 PATH=(custom, user)
SourcePackage: util-linux
UpgradeStatus: Upgraded to oneiric on 2011-10-15 (33 days ago)

Related branches

Amit Kucheria (amitk) wrote :
Amit Kucheria (amitk) wrote :

Adding udisk since that is more likely to be where this is happening.

Changed in udisks (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
Martin Pitt (pitti) on 2011-11-30
summary: - Constantly attached usb disk 's mount options keep growing each suspend
- resume cycle
+ Suspend/Resume adds "commit=600,commit=0" options to mounted USB drives
no longer affects: udisks (Ubuntu)

I can reproduce this. But nothing to do with udisks, I get the same behaviour if I kill udisks-daemon, chmod it to 0, log out of the desktop session (so no gvfs etc. either), and just run "sudo pm-suspend" on a terminal. Then my mounted USB stick as well as my internal /dev/sda1 (which carries my root partition) get an extra "commit=600" in /proc/mounts. In /etc/fstab / mount output, sdb1 (USB stick) additionally gets "commit=0". In dmesg I see

   EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro,commit=600
   EXT4-fs (sdb1): re-mounted. Opts: commit=600

This does not happen if I use a raw "echo mem | sudo tee /sys/power/state". Then sdb1 just gets unmounted and not re-mounted at all.

The "commit" mount option comes from /usr/lib/pm-utils/power.d/journal-commit.

So the root of the bug is that calling "mount -o remount,commit=600 /dev/sdb1" always appends the new option to /etc/mtab instead of recognizing an already existing one. This doesn't happen in /proc/mounts, so the kernel side is fine.

Changed in util-linux (Ubuntu):
assignee: nobody → Canonical Desktop Team (canonical-desktop-team)
status: New → Confirmed
summary: - Suspend/Resume adds "commit=600,commit=0" options to mounted USB drives
+ mount -o remount always appends options to /etc/mtab even if they
+ already exist
Changed in util-linux (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
Andy Whitcroft (apw) wrote :

@Amit -- does this occur if you do the raw s/r at the command line, ie do the below as root:

 # echo -n "mem" >/sys/power/state

Changed in util-linux (Ubuntu):
importance: Low → Medium
Andy Whitcroft (apw) wrote :

Moved this Medium as I am unsure just how many s/r cycles you will get before running out of option space.

Martin Pitt (pitti) on 2011-11-30
description: updated
Martin Pitt (pitti) wrote :

I forwarded this to, but I'm not sure whether this is being read, so I also mailed Karel.

Changed in util-linux (Ubuntu):
assignee: Canonical Desktop Team (canonical-desktop-team) → nobody
Martin Pitt (pitti) wrote :

Upstream (Karel Zak) says that this is pretty much wontfix for util-linux, and man mount says that it doesn't try to parse mount options. What pm-utils could do here is to remember the old mount options and use this form instead, i. e. with explicitly specifying the directory:

        The remount functionality follows the standard way how the mount
        command works with options from fstab. It means the mount command
        doesn't read fstab (or mtab) only when a device and dir are fully

           mount -o remount,rw /dev/foo /dir

        After this call all old mount options are replaced and arbitrary stuff
        from fstab is ignored, except the loop= option which is internally
        generated and maintained by the mount command.

(from man mount).

affects: util-linux (Ubuntu) → pm-utils (Ubuntu)
Martin Pitt (pitti) on 2012-01-16
Changed in pm-utils (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pm-utils - 1.4.1-9

pm-utils (1.4.1-9) unstable; urgency=low

  * Add 26-inhibit-on-right-status.patch: Do not use the exit status of log
    rather the exit status of the hook thereby allowing inhibit to work.
    Thanks to Ariel Cornejo for the patch! (LP: #665651, Closes: #633147)
  * Add 01_xfs_buffer_arguments.patch: pm/power.d/xfs_buffer: Fix wrong
    argument ordering. Thanks to Andre Draszik for the patch!
    (LP: #645974)
  * debian/rules: Remove the journal-commit and readahead scripts. Recent
    measurements have shown that they do not save any power in different
    workloads on rotary disks, and in fact increase power usage on SSD.
    (fd.o #44627, LP: #900923) This also avoids bugs caused by the
    journal-commit script. (Closes: #625606, LP: #891688)
  * Add debian/power.d/{pci_devices,usb_bluetooth}: Set USB bluetooth to
    autosuspend and a safe subclass of PCI devices to low-power mode during
    powersafe mode. (fd.o #44672, LP: #911325)
  * Add debian/patches/03-fix-alpm-typo.patch: Fix typo in sata_alpm hook.
    (fd.o #44676, LP: #900930)
  * debian/rules: Stop install hal-cd-polling. hal has been obsolete for
    years, so don't waste cycles for checking for hal. (LP: #898564)
  * debian/rules: Stop installing sleep.d/49bluetooth, it is not necessary any
    more with current Linux kernels. (Closes: #623750)
 -- Martin Pitt <email address hidden> Mon, 16 Jan 2012 15:55:45 +0100

Changed in pm-utils (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers