jaypipes / ghw

Go HardWare discovery/inspection library
Apache License 2.0
1.62k stars 174 forks source link

drop use of blkid on block_linux.go #319

Closed Itxaka closed 2 years ago

Itxaka commented 2 years ago

We currently only use the lsblk binary for getting the partition UUID: https://github.com/jaypipes/ghw/blob/main/pkg/block/block_linux.go#L279

This means that we need elevated permissions for that, as blkid requires privilege elevation. Fortunately we have udevInfoPartition which requires zero privs and can produce the same UUID (ID_PART_ENTRY_UUID).

Changing that would allow us to drop the externaltools part from linux block detection and fully rely on rootless udev :D

Following with the same pattern there is also Filesystem UUID (ID_FS_UUID), but I think I expanded the API too much already ;)

ffromani commented 2 years ago

yes please, IMO wherever makes sense and it's practical (for example no feature regressions) we should not invoke external tools