blockdev doesn't work as reported with loop devices

Bug #1174098 reported by Ketil
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Fix Released
Undecided
Unassigned
Trusty
Fix Released
Medium
Chris J Arges
Utopic
Fix Released
Undecided
Unassigned

Bug Description

SRU Justification:
[Impact]
blockdev won't work correctly with loopback devices.

[Test Case]
1) Create and mount a loop back device on /dev/loop0
2) Run:
$ sudo blockdev --report /dev/loop0
This should work without an ioctl error.

[Regression Potential]
This patch is backported from an upstream release commit 569d1dac.
Its already in utopic, and the patch modifies the program to no longer use an invalid ioctl call.

--

According to blockdev's manual:

       --report
              Print a report for the specified device. It is possible to give
              multiple devices. If none is given, all devices which appear in
              /proc/partitions are shown. Note that the partition StartSec is
              in 512-byte sectors.

However, I'm running Ubuntu installed with wubi, so my root dev is on a loopback device. Here's my /proc/partitions:

major minor #blocks name

   7 0 30457856 loop0
   7 1 31457280 loop1
   8 0 732574584 sda
   8 1 26214400 sda1
   8 2 307263488 sda2
   8 3 1 sda3
   8 5 399092736 sda5

So according to the manual, all these devices should be printed with blockdev --report. But they are not, the loop devices are excluded:

$ sudo blockdev --report
[sudo] password for user:
RO RA SSZ BSZ StartSec Size Device
rw 256 512 4096 0 750156374016 /dev/sda
rw 256 512 4096 2048 26843545600 /dev/sda1
rw 256 512 4096 52430848 314637811712 /dev/sda2
rw 256 512 1024 666957824 1024 /dev/sda3
rw 256 512 4096 666959872 408670961664 /dev/sda5
$

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: util-linux 2.20.1-5.1ubuntu2
ProcVersionSignature: Ubuntu 3.5.0-27.46-generic 3.5.7.7
Uname: Linux 3.5.0-27-generic x86_64
ApportVersion: 2.6.1-0ubuntu10
Architecture: amd64
Date: Sun Apr 28 23:48:07 2013
InstallationDate: Installed on 2012-04-12 (381 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MarkForUpload: True
SourcePackage: util-linux
UpgradeStatus: Upgraded to quantal on 2012-11-15 (164 days ago)

Revision history for this message
Ketil (ketil-froyn) wrote :
Revision history for this message
Ketil (ketil-froyn) wrote :

Turns out blockdev is actually getting an ioctl error on loop devices when run with --report. I had only tested a few values directly, eg using --getsz. Perhaps that is why this happens?

$ sudo blockdev --report /dev/loop0
RO RA SSZ BSZ StartSec Size Device
blockdev: ioctl error on /dev/loop0
$ sudo blockdev --g
60915712
$

Revision history for this message
Chris J Arges (arges) wrote :

This works correctly in Utopic (2.25-8ubuntu3).

Changed in util-linux (Ubuntu Utopic):
status: New → Fix Released
Chris J Arges (arges)
Changed in util-linux (Ubuntu Trusty):
assignee: nobody → Chris J Arges (arges)
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Chris J Arges (arges) wrote :
Revision history for this message
Chris J Arges (arges) wrote :

Uploaded fix for Trusty.

Chris J Arges (arges)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Ketil, or anyone else affected,

Accepted util-linux into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/util-linux/2.20.1-5.1ubuntu20.2 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 util-linux (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Ketil (ketil-froyn) wrote :

Proposed package works for me, and I confirmed again that the version I had before upgrading had the same issue. From apt-get output:

Unpacking util-linux (2.20.1-5.1ubuntu20.2) over (2.20.1-5.1ubuntu20.1) ...

I don't see where I can change verification-needed to verification-done, however. Hopefully someone else can take care of that.

Mathew Hodson (mhodson)
tags: added: verification-done
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package util-linux - 2.20.1-5.1ubuntu20.2

---------------
util-linux (2.20.1-5.1ubuntu20.2) trusty; urgency=medium

  * Backport of 569d1dac to fix invalid ioctl when blockdev is called against
    loopback devices. (LP: #1174098)
 -- Chris J Arges <email address hidden> Mon, 22 Sep 2014 15:21:59 -0500

Changed in util-linux (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of the Stable Release Update for util-linux 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.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.