Subject: Re: bug#22199: Bug in coreutils for Linux Mint?? Package coreutils_8.21-1ubuntu5.3_amd64

From: Pádraig Brady <[email-masked]>
Date: Tue, 22 Dec 2015 01:39:11 +0000

On 21/12/15 22:13, Dave wrote:
> 
> On 12/18/2015 4:28 AM, Pádraig Brady wrote:
>> On 18/12/15 00:23, Dave wrote:
>>> df's output shows this on a standard run(df with no flags):
>>>
>>> Filesystem     1K-blocks      Used Available Use% Mounted on
>>> udev             1953632         4   1953628   1% /dev
>>> tmpfs             400436      1216    399220   1% /run
>>> /dev/sda1      957218452 302330152 606241340  34% /
>>> none                   4         0         4   0% /sys/fs/cgroup
>>> none                5120         0      5120   0% /run/lock
>>> none             2002168         8   2002160   1% /run/shm
>>> none              102400         4    102396   1% /run/user
>>> /dev/sdb1      957218452 302510240 606061252  34% /mnt/bkup/device2
>>>
>>> But when I mount an external USB disk that's on /dev/sdc1, df shows this
>>> output:
>>>
>>> Filesystem     1K-blocks      Used Available Use% Mounted on
>>> udev             1953632         4   1953628   1% /dev
>>> tmpfs             400436      1272    399164   1% /run
>>> /dev/sdc1      957218452 302334136 606237356  34% /
>>> none                   4         0         4   0% /sys/fs/cgroup
>>> none                5120         0      5120   0% /run/lock
>>> none             2002168         8   2002160   1% /run/shm
>>> none              102400         4    102396   1% /run/user
>>> /dev/sdb1      957218452 302498156 606073336  34% /mnt/bkup/device2
>>> /dev/sdc1      957218452 302564064 606007428  34% /mnt/bkup/externaldevice
>>>
>>> The filesystem of "/" has mysteriously changed (in appearance) to
>>> /dev/sdc1?!  All I did was mount the /dev/sdc1 device.  In fact,
>>> /dev/sdc1 is ONLY mounted at /mnt/bkup/externaldevice, and the mounted
>>> filesystem on "/" is still /dev/sda1.  I tested by writing a couple of
>>> files, plus mount shows the correct info:
>>>
>>> /dev/sda1 on / type ext4 (rw,errors=remount-ro)
>>> /dev/sdb1 on /mnt/bkup/device2 type ext4 (rw)
>>>
>>> If I unmount /mnt/bkup/externaldevice, df still shows /dev/sdc1 as the
>>> "/" filesystem for a small amount of time (10-20 seconds) and then it
>>> goes back to the correct filesystem of /dev/sda1.
>>>
>>> What is going on??  This only happened after upgrading to the package of
>>> coreutils mentioned in the subject, it was not doing this previously.
>>> Also, to note, the first two lines of the df output regarding udev and
>>> tmpfs did not appear until this version either.  I did see in the
>>> changelog that df was updated to display some additional information, so
>>> perhaps it has to do with that??
>> I see that ubuntu has backported _some_ patches from master.
>> Perhaps they were incomplete. Could you please try out this latest df binary.
>>
>>    wget http://www.pixelbeat.org/cu/df
>>    chmod a+x df
>>    ./df
>>
>> (There is a df.sig file is the same dir for gpg verification
>>   using the public key associated with this email address if desired)
>>
>> cheers,
>> Pádraig.
>>
> 
> Pádraig, thanks for the response. The df you provided (v8.24.113-84fcb) 
> also shows /dev/sdc1 in place of /dev/sda1 once the /dev/sdc1 device is 
> mounted, the same as in the example in the correspondence above. Is that 
> what you were expecting?
> 
> I found a copy of the old df that was in use before the coreutils 
> package upgrade, and it presents as version 8.21 just like the current 
> one when running df --version. The package the original came from was 
> coreutils_8.21-1ubuntu5.1_amd64 and the df executable is dated Jan 13, 
> 2015. I just ran THAT df, and here's the output (with the /dev/sdc1 
> device mounted):
> 
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/sda1 957218452 304082900 604488592 34% /
> none 4 0 4 0% /sys/fs/cgroup
> udev 1953632 4 1953628 1% /dev
> tmpfs 400436 1272 399164 1% /run
> none 5120 0 5120 0% /run/lock
> none 2002168 8 2002160 1% /run/shm
> none 102400 4 102396 1% /run/user
> /dev/sdb1 957218452 304106588 604464904 34% /mnt/bkup/device2
> /dev/sdc1 957218452 300703220 607868272 34% /mnt/bkup/externaldevice
> 
> So, 2 things of note: 1) I was clearly incorrect in saying in my 
> original message that the udev and tmpfs lines weren't showing in the 
> original df listing, because there they are, they were just in a 
> different spot (ie, not at the top) as you can see above. Apologies for 
> the misinformation on that. 2) Well, you can see that the old df is 
> reporting the root filesystem as /dev/sda1 correctly. If I run your df, 
> or the newer df, both incorrectly show "/dev/sdc1" for the root 
> filesystem after /dev/sdc1 is mounted at /mnt/bkup/externaldevice.
> 
> Also, here are the relevant lines from /proc/mounts and 
> /proc/self/mountinfo you had requested:
> 
> /proc/mounts:
> rootfs / rootfs rw 0 0
> /dev/sdb1 /mnt/bkup/device2 ext4 rw,relatime,data=ordered 0 0
> /dev/sdc1 /mnt/bkup/externaldevice ext4 rw,relatime,data=ordered 0 0
> 
> /proc/self/mountinfo:
> 22 1 8:1 / / rw,relatime - ext4 
> /dev/disk/by-uuid/ced6112c-e347-4ac4-a160-0b2f03c88602 
> rw,errors=remount-ro,data=ordered
> 23 22 8:17 / /mnt/bkup/device2 rw,relatime - ext4 /dev/sdb1 rw,data=ordered
> 33 22 8:33 / /mnt/bkup/externaldevice rw,relatime - ext4 /dev/sdc1 
> rw,data=ordered
> 
> Also, it should be noted, upon looking further into the uuid for "/" 
> referenced in /proc/self/mountinfo, I found that that reference is 
> softlinked to "/dev/sdc1" and it stays that way even after the external 
> device is unmounted. Hmm. So /proc/self/mountinfo seems wrong about "/" 
> in this case, since it's not referencing /dev/sda in any way. And it's 
> odd that the older df works, even despite that issue. Maybe I'm not 
> clear on what all /proc/self/mountinfo is supposed to convey? And maybe 
> this bug is originating somewhere else outside of df then?

Neither /proc/self/mounts or /proc/self/mountinfo mention /dev/sda1 ?
That's weird. Note the older ubuntu df should be referencing /etc/mtab
which these days is usually a link to /proc/self/mounts.
The newer df will directly reference /proc/self/mountinfo.

So it would be good to confirm that /etc/mtab is a symlink to /proc/self/mounts.
Also it would be good to attach that file and /proc/self/mountinfo
to avoid any ambiguity.

thanks,
Pádraig