You are not logged in.

#1 2015-04-11 17:29:32

newguy
Member
Registered: 2015-03-18
Posts: 36

blkid - Why doesn't it mention that it needs elevated privileges ?

Hello,

I was wondering why blkid doesn't inform you that it needs root privileges for it to run ? If I don't give it root privileges it just outputs nothing. Is it the way it is coded and that exception isn't handled properly ? 

For eg - if I run pacman as a normal user it throws an error asking you to elevate the privileges --: "error: you cannot perform this operation unless you are root."


Arch makes me cry and pull my hair out but I soon realized thats a part of my learning process.

Offline

#2 2015-04-11 17:44:51

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,901
Website

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

From the manpage:

for non-root users it  returns
       cached  unverified  information.

If you don't have a cache, it outputs nothing, but the cache appears to be generated at boot time, so I'm not sure why you don't have one.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-04-11 17:45:18

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,559
Website

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

blkid can be used as a regular user, it just does something else:

man blkid wrote:

Note that blkid reads information directly from devices and for non-root users it returns cached unverified information.  It is better to use lsblk --fs to  get  a  user-riendly overview of filesystems and devices.

This isn't too uncommon, wireless scanning works the same way.

EDIT: crossposted with the above.  But I do not get a cache generated during boot either.  The output for me is empty until I run blkid as root.  Wormzy, I gather you have some service that runs this at boot up.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2015-04-11 17:57:32

newguy
Member
Registered: 2015-03-18
Posts: 36

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

Alright. I just checked , when I run blkid as a normal user again, it did show me the information (I'm guessing thats cached information)

After restarting, blkid as a normal user didn't output anything. I'm guessing the cache gets erased. I've been using lsblk -o +UUID to get my UUIDs (other than the time I installed arch using beginners guide and I had root priv then so didn't realize)

Thanks guys.


Arch makes me cry and pull my hair out but I soon realized thats a part of my learning process.

Offline

#5 2015-04-11 18:16:02

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,901
Website

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

Trilby wrote:

Wormzy, I gather you have some service that runs this at boot up.

Apparently so! This is news to me though. I can't find any call to blkid in any of my systemd units. There are several references of blkid in the udev rules regarding RAID though, so that may be the cause (as I have an RAID 5).


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2015-04-11 19:00:48

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

Moving to Newbie Corner...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2015-04-11 19:09:38

Awebb
Member
Registered: 2010-05-06
Posts: 6,309

Re: blkid - Why doesn't it mention that it needs elevated privileges ?

It says nothing, because a program is supposed to say nothing if it has nothing worthwhile to say. A tool like this should neither worry about permissions nor patronize me about it. It is supposed to give me the information I want and shut up, if it does not have any. I especially don't want it to produce another line of garbage without real information, that I will have to catch manually in a script. I'd rather have it return 1 and not provide cached information, if called without a switch.

Offline

Board footer

Powered by FluxBB