Bug 1215370

Summary: Thoroughly misleading error message when running "losetup -f" as non-root user
Product: [Fedora] Fedora Reporter: Nick Coghlan <ncoghlan>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: jonathan, kzak
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-03 10:12:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nick Coghlan 2015-04-25 21:42:52 UTC
Description of problem:

Running "losetup -f" as a non-root user when no loop devices are available fails with an unhelpful error message that doesn't tell the user they can run "sudo losetup -f" to automatically create a new loopback device.

Version-Release number of selected component (if applicable):

util-linux-2.26.1-1.fc22.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Run "losetup -f" as a non-root user with no loop devices created (the default)
2.
3.

Actual results:

$ losetup -f
losetup: cannot find an unused loop device: No such file or directory

Expected results:

$ losetup -f
losetup: cannot find an unused loop device (Root access required to automatically create new loop devices)

(It doesn't necessarily need to be that exact message, but there should be an explicit nudge towards "run losetup as root to create a new loop device"

Additional info:

The man pages for losetup, cryptsetup and tcplay also fail to mention this fact, which makes the default behaviour of failing to provide any loop devices by default (as per bug 896160) very confusing when attempting to follow the cryptsetup and tcplay man pages to mount an encrypted file as a volume (as per bug 1019440).

Comment 1 Karel Zak 2015-06-03 10:12:53 UTC
Improved in upstream tree by commit 362f5d203581e895005b91383ea7b1affafd8eba.

I don't think it's good idea to talk about "root", like in many other situations "Permission denied" is good enough.

$ losetup -f
lt-losetup: cannot find an unused loop device: Permission denied