blkid shouldn't need root privileges

Bug #220275 reported by Christoph Langner
2
Affects Status Importance Assigned to Milestone
e2fsprogs (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: e2fsprogs

When I execute blkid without root privileges I get an empty result. Only when i add a sudo to the command i get an output:

$ blkid
$ sudo blkid
/dev/mapper/stein-root: UUID="505a1f5d-8a14-40c7-b873-009b722d3782" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/stein-swap_1: TYPE="swap" UUID="0cf47458-4a05-4b8a-aedf-238d7d047b18"
/dev/sda5: UUID="cdb51a1e-b277-43e3-8130-eb7b992efda2" TYPE="crypt_LUKS"
/dev/sda1: UUID="2d6fdebf-54bc-4987-a46e-7b3352737b14" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/sda5_crypt: UUID="nmmiO3-4W3N-zaP1-DQdP-hlQT-yooV-KGSjOg" TYPE="lvm2pv"

This is quite strange since blkid reads /etc/blkid.tab and reformats the file. /etc/blkid.tab is readable for all users:

$ ls -al /etc/blkid.tab
-rw-r--r-- 1 root root 663 2008-04-21 17:13 /etc/blkid.tab
$ cat /etc/blkid.tab
<device DEVNO="0xfe01" TIME="1208790785" UUID="505a1f5d-8a14-40c7-b873-009b722d3782" SEC_TYPE="ext2" TYPE="ext3">/dev/mapper/stein-root</device>
<device DEVNO="0xfe02" TIME="1208790785" TYPE="swap" UUID="0cf47458-4a05-4b8a-aedf-238d7d047b18">/dev/mapper/stein-swap_1</device>
<device DEVNO="0x0805" TIME="1208790785" UUID="cdb51a1e-b277-43e3-8130-eb7b992efda2" TYPE="crypt_LUKS">/dev/sda5</device>
<device DEVNO="0x0801" TIME="1208790785" UUID="2d6fdebf-54bc-4987-a46e-7b3352737b14" SEC_TYPE="ext2" TYPE="ext3">/dev/sda1</device>
<device DEVNO="0xfe00" TIME="1208790785" UUID="nmmiO3-4W3N-zaP1-DQdP-hlQT-yooV-KGSjOg" TYPE="lvm2pv">/dev/mapper/sda5_crypt</device>

I can reproduce the problem on several installations with Ubuntu Hardy and inside a clean VM with Ubuntu Hardy RC1 booted from the Live-CD.

ProblemType: Bug
Architecture: i386
Date: Mon Apr 21 17:14:37 2008
DistroRelease: Ubuntu 8.04
Package: e2fsprogs 1.40.8-2ubuntu2
PackageArchitecture: i386
ProcEnviron:
 SHELL=/bin/bash
 PATH=/home/username/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=de_DE.UTF-8
SourcePackage: e2fsprogs
Uname: Linux 2.6.24-16-generic i686

Tags: apport-bug
Revision history for this message
Christoph Langner (chrissss) wrote :
Revision history for this message
Theodore Ts'o (tytso) wrote :

Can you send me the output of "ls -dl /dev /dev/mapper"? That is, I want to see the ownership and permissions of the /dev and /dev/mapper directories. I suspect they might not be world-readable, and causing blkid to fail in a way that causes it not to print. I can replicate the problem on my system if I chmod /dev/mapper to mode 700. I agree that blkid should not fail in such a way, and I'll look into trying to fix it, but I'd like some confirmation that this is the same root cause for the problem you are seeing on your system.

Thanks, regards,

--- Ted

Revision history for this message
Christoph Langner (chrissss) wrote :

Here it is :)

$ ls -dl /dev /dev/mapper
drwxr-xr-x 16 root root 14220 2008-04-21 23:55 /dev
drwxr-xr-x 2 root root 120 2008-04-21 20:08 /dev/mapper

Revision history for this message
Christoph Langner (chrissss) wrote :

This bug is fixed in intrepid. I can execute blkid without root-rights.

$ blkid
/dev/mapper/stein-root: UUID="115e7f77-a5e1-4ae1-ace4-cbcbed78be46" TYPE="ext3"
/dev/mapper/stein-swap_1: UUID="6ef7cec4-ffee-45c4-a404-50301d735707" TYPE="swap"
/dev/sda1: UUID="d1c47f80-64bd-4c28-b5fd-587597012e43" TYPE="ext3"
/dev/sda5: UUID="35893d2e-da1b-4170-b65b-aac693a1d3c5" TYPE="ext3"
/dev/dm-0: UUID="1JO8Ld-CdsV-Lb2G-2Bml-sUHi-UlB4-j4Mhc4" TYPE="lvm2pv"

Changed in e2fsprogs:
status: New → Fix Released
Revision history for this message
Khurshid Alam (khurshid-alam) wrote :

LOL!....On 16.04 it still requires root.

Revision history for this message
Jamie (jamalex) wrote :

It seems that when run without root, it reads from the cached results in /etc/blkid.tab, which are only populated if blkid was previously run as root. That could explain why it worked for chrissss, if he had previously run as root.

In other words, this doesn't seem to be fixed; an ordinary user can't run blkid and expect results.

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.