lsblk, why should extended use of lsblk require root permissions.

I am using the output of lsblk for an application. It is located within /usr/bin as:
-rwxr-xr-x 1 root root 138104 Apr 7 00:27 lsblk <==== the one from Fedora, Centos,Redhat, Ubuntu, Arch (Universal version)
-rwxr-xr-x 1 root root 88184 Mar 8 19:29 lsblk <=== the different from all the rest used within Tumbleweed, Leap, Leap15.1 and the beta.

NOTE THE DIFFERENCE IN SIZE.

with the non SUSE version(regular user)
with the **SUSE version (root user) ** same results

typical good output.

MOUNTPOINT="" FSTYPE=“ext4” KNAME=“sdb1” NAME=“sdb1” UUID=“bdc4349d-9b02-4d49-8d0a-a617f3f16539” PARTUUID=“8363523f-0fe5-4a67-b202-ff3cb0ad37b7” LABEL=“TwdBoot” PARTLABEL=“twdBoot”
MOUNTPOINT="" FSTYPE=“vfat” KNAME=“sdb2” NAME=“sdb2” UUID=“3B61-25DD” PARTUUID=“178b6f64-dd86-40e7-b44c-4a1d81428b32” LABEL=“TWDEFI” PARTLABEL=“TwdEFI”
MOUNTPOINT="" FSTYPE=“swap” KNAME=“sdb3” NAME=“sdb3” UUID=“2ff5bbad-eecf-474b-865b-63c37403be4f” PARTUUID=“a5234696-5ce5-4957-8043-6fe58ec0b05d” LABEL=“sdxSwap” PARTLABEL=""
and so forth.

With the SUSE version regular version Notice Missing information.

MOUNTPOINT="" FSTYPE="" KNAME=“sdb1” NAME=“sdb1” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb2” NAME=“sdb2” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb3” NAME=“sdb3” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb4” NAME=“sdb4” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb5” NAME=“sdb5” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb6” NAME=“sdb6” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb7” NAME=“sdb7” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb8” NAME=“sdb8” UUID="" PARTUUID="" LABEL="" PARTLABEL=""
MOUNTPOINT="" FSTYPE="" KNAME=“sdb9” NAME=“sdb9” UUID="" PARTUUID="" LABEL="" PARTLABEL=""

The user does not have root or sudo permissions. I filed bug reports but would like someone to report the same issue as confirmation. Bug1154238
By the way, the universal version does not work on the proposed Leap 15.x beta Some libraries are missing.

What is it used for. I call it from a C program and peel off the information I use the information to check a /etc/fstab, The entries are validated against the lsblk listing, and the table reformated into columns

Sample validated and reformatted /etc/fstab
#                       Tumbleweed installation created at  2020-04-06 at 08:19 Local time. 
#                       This file formatted and cross referenced by fstabxref  
#<file system>                            <mount>   <type>   <options>              <dmp pass> <xref>          <label/uuid> 
UUID=174c3c6c-6803-4154-bf7a-c39e58923a38 /         xfs      defaults,relatime        0  0     #/dev/sda4      TWeedSlash 
UUID=94bcaca3-7fdc-47f3-8f5a-a87914989d71 /backup   ext4     user,noauto,data=ordered 0  2     #/dev/sdc10     sdc10Backup 
UUID=963006ad-22e6-4c04-8ba3-6287ad66c958 /backup2  ext4     user,noauto,data=ordered 0  2     #/dev/sdc6      sdc6backup2 
UUID=aac575f5-dee6-47d9-89fa-80a7e1a6ea5e swap      swap     defaults,relatime        0  0     #/dev/sda5      sda5swap 
UUID=64ae397f-e99c-4d4f-90dd-7a29ae520b10 /boot     ext4     data=ordered,relatime    0  2     #/dev/sda3      TweedBoot 
UUID=acefc30a-d7fc-40fb-82c5-e0cae7c85ff0 /share    ext4     data=ordered,relatime    0  2     #/dev/nvme0n1p5 nvme0n1p5Share 
UUID=87a338d1-ee1f-4c17-a7af-363c425cda11 /share2   ext4     user,noauto,data=ordered 0  2     #/dev/sdc2      sdc2share2 
UUID=371d1798-4db0-4929-8abe-71e00d825490 /scratch1 ext4     user,noauto,data=ordered 0  2     #/dev/sdc1      scratch1 
UUID=c1632f4f-7f3c-464a-b3dc-4f574b585304 /junk     ext4     data=ordered             0  2     #/dev/sdc4      junk 
UUID=ecc640e9-335c-45f2-adf0-f658eb2645b6 /home     ext4     data=ordered,relatime    0  2     #/dev/sda10     TweedHome 
UUID=A36A-536A                            /boot/efi vfat     defaults,relatime        0  2     #/dev/sda1      TBLWEED 

I am having trouble understanding the issue.

The difference in size doesn’t mean much. It depends on how the application is built and which parts are to loaded from dynamic libraries. I’ll note that I get a size of 104584 on both Leap 15.1 and Leap 15.2. And I get a length of 154896 on Fedora 32 (beta release).

typical good output.

MOUNTPOINT=“” FSTYPE=“ext4” KNAME=“sdb1” NAME=“sdb1” UUID=“bdc4349d-9b02-4d49-8d0a-a617f3f16539” PARTUUID=“8363523f-0fe5-4a67-b202-ff3cb0ad37b7” LABEL=“TwdBoot” PARTLABEL=“twdBoot”
MOUNTPOINT=“” FSTYPE=“vfat” KNAME=“sdb2” NAME=“sdb2” UUID=“3B61-25DD” PARTUUID=“178b6f64-dd86-40e7-b44c-4a1d81428b32” LABEL=“TWDEFI” PARTLABEL=“TwdEFI”
MOUNTPOINT=“” FSTYPE=“swap” KNAME=“sdb3” NAME=“sdb3” UUID=“2ff5bbad-eecf-474b-865b-63c37403be4f” PARTUUID=“a5234696-5ce5-4957-8043-6fe58ec0b05d” LABEL=“sdxSwap” PARTLABEL=“”
and so forth.

This is where I am confused. The output that I see from “lsblk” is not at all like that. What you are showing looks more like the output from “blkid”.

Checking on Fedora 32 (beta), I see that the output of “blkid” is considerably more extensive for root than for an ordinary user.

It’s also not clear how you want to use this. You talk about validating “fstab”. But only root can change “fstab”. Most of the information can also be found via what’s in “/dev/disk/by-*”

Hi
Likewise with the bug report as indicated by the bug reporter that that bug is related to YaST and WSL, nothing for your issue… better to open a new bug report.

Why not code in info via libblkid in your c program?

lsblk -P
man lsblk

I could not figure out which options to use with lsblk to produce an output like this

with openSUSE Tumbleweed 20200405.

> ls -la /usr/bin/lsblk
-rwxr-xr-x 1 root root 88184  9. Mär 00:29 /usr/bin/lsblk
>

Results as a “plain user”:

> lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                  8:0    1 238,5G  0 disk  
├─sda1               8:1    1  1000M  0 part  /boot/efi
...
>
> lsblk -P
NAME="sda" MAJ:MIN="8:0" RM="1" SIZE="238,5G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="sda1" MAJ:MIN="8:1" RM="1" SIZE="1000M" RO="0" TYPE="part" MOUNTPOINT="/boot/efi"
...
>
> lsblk -l -f
NAME           FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda                                             
sda1                              989,3M     1% /boot/efi
...
>

The command blkid cannot be run by a “plain user”.

Results as “root”:

# lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                  8:0    1 238,5G  0 disk  
├─sda1               8:1    1  1000M  0 part  /boot/efi
...
#
# lsblk -P
NAME="sda" MAJ:MIN="8:0" RM="1" SIZE="238,5G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="sda1" MAJ:MIN="8:1" RM="1" SIZE="1000M" RO="0" TYPE="part" MOUNTPOINT="/boot/efi"
...
#
# lsblk -l -f
NAME           FSTYPE      LABEL            UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                             
sda1           vfat        EFI       FF12-A642                             989,3M     1% /boot/efi
...
#
# blkid
/dev/sda1: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="FFA3-E64D" TYPE="vfat" PARTLABEL="EFI" PARTUUID="2babe181-4be7-4d86-f63b-c046d4f16986"
...
#

Only the result of blkid contains UUIDs.

Regards

susejunky

Thanks.

It would have helped if the OP had indicated what options he was using.

Yes, a more general remark to the OP (as send to many new members):

Hello,

There is an important, but not easy to find feature on the forums.

Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

An example is here: Using CODE tags Around your paste.

Regards,

openSUSE builds util-linux without udev support. I checked Leap 42, Leap 15 and TW - all behave the same. It means lsblk falls back to direct device probing which is possible only for root.

I do not know if this is intentional, but it certainly defeats the very purpose of lsblk (and even manual page says “lsblk command reads the sysfs filesystem and udev db to gather information”. Please open bug report.

P.S. that said, this thread is still hopelessly out of place on this forum. I have feeling that most users simply select the first one without any consideration whether it is appropriate.

What the heck. 1169006 – util-linux is built without udev support