`df /dev/sda1` no longer reports information for /dev/sda1

Bug #1535349 reported by Dan Watkins on 2016-01-18
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Trusty
Medium
Dave Chiluk
initramfs-tools (Ubuntu)
Trusty
Medium
Dave Chiluk

Bug Description

[Impact]

 * df fails to process devices that are specified on the command line.

[Test Case]

 * Actual
$ df -h /dev/sda1
Filesystem Size Used Avail Use% Mounted on
udev 1.8G 8.0K 1.8G 1% /dev

 * Expected
$ df -h /dev/sda1
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 978M 8.5G 11% /

[Regression Potential]

 * This patch is a partial backport of functions as they exist in vivid to help minimize the regression potential.

 * That being said I had to do some backporting so as to avoid ui changes.

 * This once again significantly changes the mount search and matching
   logic within df, but it is localized to df.

[Other Info]

 * Anything else you think is useful to include
 * Anticipate questions from users, SRU, +1 maintenance, security teams and the Technical Board
 * and address these questions in advance

-------------------- Original Description-----------------------
It appears that the latest version of coreutils uploaded to trusty-updates has a regression in it. We have scripting that checks how much space we have left on a partition using `df /dev/sda1`. Using coreutils 8.21-1ubuntu5.1, we can do the following:

$ df -h /dev/sda1
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 978M 8.5G 11% /

This is a valid way of using the tool per the manpage: "If an argument is the absolute file name of a disk device node containing a mounted file system, df shows the space available on that file system rather than on the file system containing the device node"

It appears that either 8.21-1ubuntu5.2 or 8.21-1ubuntu5.3 broke this, however. We now get output for the udev filesystem that is mounted at /dev, instead of the device we pass in.

$ df -h /dev/sda1
Filesystem Size Used Avail Use% Mounted on
udev 1.8G 8.0K 1.8G 1% /dev

This is both a behaviour change, and contravenes the manpage, so it would be good to get this fixed.

Michael Terry (mterry) on 2016-01-18
Changed in coreutils (Ubuntu):
assignee: nobody → Dave Chiluk (chiluk)
Changed in coreutils (Ubuntu Trusty):
assignee: nobody → Dave Chiluk (chiluk)
Dave Chiluk (chiluk) wrote :

Ack thanks for the bug.

Verified incorrect behavior exists in trusty, xenial is not experiencing the issue though. I will take a closer look tomorrow when I'm back from vacation.

Changed in coreutils (Ubuntu Trusty):
status: New → Confirmed
importance: Undecided → Medium
Dave Chiluk (chiluk) on 2016-01-18
tags: added: regression-update sts
Dave Chiluk (chiluk) on 2016-01-25
Changed in coreutils (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Dave Chiluk (chiluk) wrote :

Here's a first go of the patch. I need to clean it up and show attribution, and what-not. I just wanted to share that there is progress. I have also confirmed that it resolves the issue mentioned in this bug as well as successfully completing the available testcases.

The attachment "lp1535349.trusty.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Dave Chiluk (chiluk) on 2016-01-25
Changed in coreutils (Ubuntu):
milestone: none → trusty-updates
Changed in coreutils (Ubuntu Trusty):
milestone: none → trusty-updates
Changed in coreutils (Ubuntu):
milestone: trusty-updates → none
Dave Chiluk (chiluk) on 2016-01-27
Changed in coreutils (Ubuntu):
status: Confirmed → Invalid
Dave Chiluk (chiluk) wrote :

Here's an updated patch with proper attribution, and references to the upstream commits. I decided to do a backport of the relevant portions of df.c from vivid as that is already known to work well rather than attempt to follow the endless trail of patches that exist upstream. That being said I did document the commit id's that relate to the areas of code that were used in the dep3 header.

I would now appreciate some review and sponsorship of this patch.

Dave Chiluk (chiluk) on 2016-01-27
description: updated
Dave Chiluk (chiluk) wrote :

I have been doing some more testing with this, and would appreciate some more eyes on this before upload.

I have created a ppa with test packages here.
https://launchpad.net/~chiluk/+archive/ubuntu/df

Thanks ahead of time to anyone who can test the PPA.

I've already noticed that on one of my machines I got this unexpected behavior. Although better this is not expected.
chiluk@bonus:/tmp$ df -h /dev/sda2
Filesystem Size Used Avail Use% Mounted on
/dev/disk/by-uuid/dc918cc3-dc63-4049-bce1-96fec88f77d1 30G 26G 2.0G 93% /

Dave Chiluk (chiluk) wrote :

It looks like the issue of reporting the uuid device instead of the actual device is a initramfs issue. Basically df will report whatever is in /proc/self/mountinfo, and this appears to be an issue with how fstab is processed. I still have to fully root cause that.

Dave Chiluk (chiluk) wrote :

It looks like the addition of "resolve_device" to initramfs-tool/scripts/functions and to local fixes the uuid mount that I was seeing on my trusty machine. I will have to do additional work to get initramfs-tools resolved, but it looks like the patch is good.

Dave Chiluk (chiluk) wrote :

Ok here's the debdiff again, now that I root-caused the source of the uuid lines.

Dave Chiluk (chiluk) on 2016-01-28
Changed in initramfs-tools (Ubuntu Trusty):
status: New → Confirmed
assignee: nobody → Dave Chiluk (chiluk)
Changed in initramfs-tools (Ubuntu):
status: New → Invalid
Changed in initramfs-tools (Ubuntu Trusty):
importance: Undecided → Critical
importance: Critical → Medium
Dave Chiluk (chiluk) wrote :

The fix for initramfs-tools appears to be spread out accross commits f135e7cf, be18fee1, f1d6fb37 .

Changed in coreutils (Ubuntu Trusty):
status: Confirmed → Triaged
no longer affects: coreutils (Ubuntu)
no longer affects: initramfs-tools (Ubuntu)
Changed in initramfs-tools (Ubuntu Trusty):
status: Confirmed → Triaged
Dave Chiluk (chiluk) on 2016-01-28
Changed in coreutils (Ubuntu Trusty):
status: Triaged → In Progress
Changed in initramfs-tools (Ubuntu Trusty):
status: Triaged → In Progress
Dave Chiluk (chiluk) wrote :

Alright I've finally finished a patch for initramfs-tools to resolve the UUID information.

I've uploaded a test version of initramfs-tools to my test ppa for this issue.
dput ppa:chiluk/df

I would really appreciate if, I could get help testing for both initramfs-tools and the coreutils packages that are available in that ppa.

Additionally here's the debdiff for initrmafs-tools.

Thank you.

Dave Chiluk (chiluk) wrote :

apw uploaded the initramfs-tools bits for this, I still need sponsorship/comments for the requisite coreutils changes.

Hello Dan, or anyone else affected,

Accepted initramfs-tools into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.103ubuntu4.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in initramfs-tools (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Dave Chiluk (chiluk) wrote :

For all who care, coreutils is still waiting for upload on this case. Both the fix for coreutils and initramfs are necessary for a functioning experience.

Dave Chiluk (chiluk) on 2016-03-09
tags: added: verification-done
removed: verification-needed
tags: added: verification-done-initramfs
removed: verification-done
Chris J Arges (arges) wrote :

Hello Dan, or anyone else affected,

Accepted coreutils into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/coreutils/8.21-1ubuntu5.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in coreutils (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Simon Déziel (sdeziel) wrote :

Works on Trusty, thanks.

Before:

$ df -h /dev/vda1
Filesystem Size Used Avail Use% Mounted on
udev 347M 4.0K 347M 1% /dev

After:

$ df -h /dev/vda1
Filesystem Size Used Avail Use% Mounted on
/dev/disk/by-uuid/24ab0046-39e7-4298-8090-feeb168476f9 4.0G 909M 2.9G 25% /

tags: added: verification-done
removed: verification-needed
Dave Chiluk (chiluk) wrote :

FYI Simon, if you update initramfs-tools and reboot you will again show

$ df -h /dev/vda1
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 4.0G 909M 2.9G 25%

This was due to the way the initramfs was mounting the disk by uuid directly rather than processing the symbolic link down to the actual device.

Dave Chiluk (chiluk) wrote :

Yep I verified as well. Everything looks good. Hopefully no one else finds weird corner cases.

tags: added: trusty
removed: verification-done-initramfs
Dave Chiluk (chiluk) wrote :

There are failing autopackage tests on these two packages. the test failures are either timeouts while recompiling the kernel

____________________________________________________________
  CC [M] drivers/gpu/drm/cirrus/cirrus_fbdev.o
adt-run [23:07:42]: ERROR: timed out on command "su -s /bin/bash ubuntu -c set -e; export USER=`id -nu`; . /etc/profile >/dev/null 2>&1 || true; . ~/.profile >/dev/null 2>&1 || true; buildtree="/data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/build.QBN/linux-lts-vivid-3.19.0"; mkdir -p -m 1777 -- "/data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-artifacts"; export ADT_ARTIFACTS="/data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-artifacts"; export ADTTMP=$(mktemp -d --tmpdir adttmp.XXXXXX); export DEBIAN_FRONTEND=noninteractive; export LANG=C.UTF-8; export DEB_BUILD_OPTIONS=parallel=$(grep -c ^processor /proc/cpuinfo | sed 's/^0$/1/'); unset LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL;rm -f /tmp/adt_test_script_pid; set -C; echo $$ > /tmp/adt_test_script_pid; set +C; trap "rm -rf $ADTTMP /tmp/adt_test_script_pid" EXIT INT QUIT PIPE; chmod 755 $ADTTMP; cd "$buildtree"; export 'ADT_TEST_TRIGGERS=coreutils/8.21-1ubuntu5.4'; chmod +x /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/build.QBN/linux-lts-vivid-3.19.0/debian/tests/rebuild; touch /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-stdout /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-stderr; /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/build.QBN/linux-lts-vivid-3.19.0/debian/tests/rebuild 2> >(tee -a /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-stderr >&2) > >(tee -a /data/adttmp/adt-virt-lxc.shared.w4v95wh5/downtmp/rebuild-stdout); " (kind: test)
adt-run [23:07:42]: test rebuild: -----------------------]
adt-run [23:07:43]: test rebuild: - - - - - - - - - - results - - - - - - - - - -
rebuild FAIL timed out
adt-run [23:07:43]: @@@@@@@@@@@@@@@@@@@@ summary
ubuntu-regression-suite SKIP Test requires machine-level isolation but testbed does not provide that
rebuild FAIL timed out
____________________________________________________________

Or Fails on checking the kernel version string.
____________________________________________________________

adt-run [23:06:55]: test ubuntu-regression-suite: [-----------------------
Source Package Version: 3.19.0-54.60~14.04.1
Running Kernel Version: 3.13.0-82.126
ERROR: running version does not match source package
adt-run [23:06:56]: test ubuntu-regression-suite: -----------------------]
adt-run [23:06:56]: test ubuntu-regression-suite: - - - - - - - - - - results - - - - - - - - - -
ubuntu-regression-suite FAIL non-zero exit status 1
adt-run [23:06:56]: @@@@@@@@@@@@@@@@@@@@ summary
rebuild FAIL timed out
ubuntu-regression-suite FAIL non-zero exit status 1
Exit request sent.
____________________________________________________________

Both appear to be issues with the testcases, and not issues with the changes to this package.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package coreutils - 8.21-1ubuntu5.4

---------------
coreutils (8.21-1ubuntu5.4) trusty; urgency=medium

  * LP #1432871 introduced a regression whereby devices specified on
    the command line were no longer properly handled. (LP: #1535349)

 -- Dave Chiluk <email address hidden> Sun, 24 Jan 2016 23:24:24 -0600

Changed in coreutils (Ubuntu Trusty):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for coreutils has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package initramfs-tools - 0.103ubuntu4.3

---------------
initramfs-tools (0.103ubuntu4.3) trusty; urgency=medium

  [ Dimitri John Ledkov ]

  * Create /bin/egrep -> busybox symlink, because initramfs-tools
    scripts/functions expect to have it & our busybox hook is executed
    after zz-busybox one. (LP: #1315755)

  [ Dave Chiluk]

  * Add resolve_device to initramfs-tools so that actual devices show up
    in df and /proc/self/mountinfo instead of the UUID symlink. This is
    a backport of commits f135e7cf, be18fee1, f1d6fb37 from
    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/initramfs-tools
    (LP: #1535349)

 -- Andy Whitcroft <email address hidden> Thu, 25 Feb 2016 18:55:04 +0000

Changed in initramfs-tools (Ubuntu Trusty):
status: Fix Committed → Fix Released
James Dennis (jtmes) wrote :

It appears this change has also changed the behavior of how device mapper devices are shown in /proc/mounts. /proc/mounts and /etc/mtab now show the device differently.

Previously /proc/mounts would indicate /dev/mapper/somedevice - now it shows /dev/dm-X.

Dave Chiluk (chiluk) wrote :

The changes here are not responsible for changing the behavior of /proc/mounts or /etc/mtab. /etc/mtab is a symbolic link to /proc/self/mounts. /proc/self/mounts is owned by the kernel. The reverse is actually true. The changes in the kernel resulted in df needing to be modified to handle the changes in behavior.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers