fdisk -l as normal user should give output

Bug #73811 reported by Freddy Martinez
32
This bug affects 2 people
Affects Status Importance Assigned to Milestone
util-linux (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

If I run fdisk -l as a regular user, there is no output:

freddy@freddy-testing:~$ fdisk -l
freddy@freddy-testing:~$

I believe there should be output that says something like apt does to tell the user to be sudo.

freddy@freddy-testing:~$ apt-get install gaim
E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Also, i tried to put this bug under the package "fdisk" but LP says no suck package exists, even though I searched for fdisk in the search form.

Revision history for this message
RJ Marsan (rjmarsan) wrote :

I agree. I get the same thing here, and to be honest if I didn't know better, i would be very confused.

if i try to run the same thing under debian it tells me:
rj@rjs-server:~$ fdisk -l
-bash: fdisk: command not found
rj@rjs-server:~$

so at least it lets me know if its locked out

Revision history for this message
Seth de l'Isle (szoth) wrote : maybe change the man page?

I don't think that Ubuntu or the fdisk maintainers are in a position to change this; low level command line tools like fdisk are the sort of thing that are depended upon by other applications so there is a lot of resistence to changing their output.

From the fdisk man page:

" -l List the partition tables for the specified devices and then exit. If no devices are given, those mentioned in /proc/partitions (if that exists) are used."

It could probably mention that disks for which you do not have read permission will be silently ignored.

Revision history for this message
Fabio Marzocca (thesaltydog) wrote :

In kernel 2.6.24 (hardy), typing fdisk -l with one or more USB pens inserted doesn't give any answer.

This is a change in behaviour with respect to 2.6.22. In gutsy, if I had an USB pen in the socket (even not mounted), I had it listed in fdisk -l.
Now it doesn't happen anymore.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Just thought I'd mention that fdisk -l in util-linux 2.20.1-5.1ubuntu2 in Ubuntu 12.10 still has the same behaviour.

tags: added: lucid precise quantal
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I don't know when it changed over the years, but fdisk on Ubuntu 16.04 and later gives me the following result:
$ fdisk -l
fdisk: cannot open /dev/sda: Permission denied

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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