RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1661672 - libblockdev fs plugin fails to load
Summary: libblockdev fs plugin fails to load
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libblockdev
Version: 8.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 8.0
Assignee: Vojtech Trefny
QA Contact: guazhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-21 22:57 UTC by John Pittman
Modified: 2021-09-06 15:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-21 12:33:07 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-35812 0 None None None 2021-08-30 12:26:31 UTC
Red Hat Knowledge Base (Solution) 3771771 0 None None None 2018-12-21 23:02:35 UTC

Description John Pittman 2018-12-21 22:57:59 UTC
Description of problem:

When attempting to import the fs plugin, sample script fails.  Same import with lvm plugin succeeds.

Version-Release number of selected component (if applicable):

[root@localhost libblockdev]# rpm -qa | grep blockdev
libblockdev-utils-2.19-6.el8.x86_64
libblockdev-fs-2.19-6.el8.x86_64
libblockdev-nvdimm-2.19-6.el8.x86_64
libblockdev-kbd-2.19-6.el8.x86_64
libblockdev-mdraid-2.19-6.el8.x86_64
libblockdev-2.19-6.el8.x86_64
libblockdev-lvm-2.19-6.el8.x86_64
libblockdev-part-2.19-6.el8.x86_64
libblockdev-loop-2.19-6.el8.x86_64
libblockdev-vdo-2.19-6.el8.x86_64
libblockdev-swap-2.19-6.el8.x86_64
libblockdev-dm-2.19-6.el8.x86_64
python3-blockdev-2.19-6.el8.x86_64
libblockdev-crypto-2.19-6.el8.x86_64
libblockdev-mpath-2.19-6.el8.x86_64
libblockdev-plugins-all-2.19-6.el8.x86_64

Steps to Reproduce:

Script contents:
================

[root@localhost libblockdev]# cat sample_script.py 
#!/usr/bin/python3

import sys
import os

import gi
gi.require_version("GLib", "2.0")
gi.require_version("BlockDev", "2.0")

from gi.repository import GLib
from gi.repository import BlockDev as bd

REQUESTED_PLUGIN_NAMES = {"fs"}

requested_plugins = bd.plugin_specs_from_names(REQUESTED_PLUGIN_NAMES)

try:
    succ_ = bd.init(requested_plugins)
except GLib.GError as err:
    raise RuntimeError("Failed to initialize libbd and its plugins (%s)" % REQUESTED_PLUGIN_NAMES)

Execution failure:
==================

[root@localhost libblockdev]# ./sample_script.py 

** (process:31170): WARNING **: 17:53:59.004: The 'ntfscluster' utility is not available
The 'ntfslabel' utility is not available
The 'ntfsresize' utility is not available
The 'ntfsfix' utility is not available
The 'mkntfs' utility is not available
Traceback (most recent call last):
  File "./sample_script.py", line 18, in <module>
    succ_ = bd.init(requested_plugins)
  File "/usr/lib64/python3.6/site-packages/gi/overrides/BlockDev.py", line 91, in init
    return _init(require_plugins, log_func)
GLib.Error: g-bd-init-error-quark: Failed to load plugins (0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./sample_script.py", line 20, in <module>
    raise RuntimeError("Failed to initialize libbd and its plugins (%s)" % REQUESTED_PLUGIN_NAMES)
RuntimeError: Failed to initialize libbd and its plugins ({'fs'})

lvm plugin works fine:
======================

[root@localhost libblockdev]# sed -i 's/"fs"/"lvm"/g' sample_script.py 
[root@localhost libblockdev]# ./sample_script.py 

Actual results:

fs Plugin import fails

Expected results:

fs Plugin import should succeed

Additional Info:

Sample script structure taken from https://github.com/storaged-project/api-examples/blob/master/demo-1-libblockdev-python

Comment 1 John Pittman 2018-12-22 20:32:15 UTC
Tested the other plugins that I could find and they all succeeded.

lvm - pass
fs - fail
nvdimm - pass
kbd - pass
mdraid - pass
part - pass
loop - pass
vdo - pass
swap - pass
dm - pass
crypto - pass
mpath - pass

Comment 2 xhe@redhat.com 2019-01-04 05:37:35 UTC
I reproduced this issue with sample_script.py for libblockdev-2.19-6.el8, let me add ACK+.

DISTRO=RHEL-8.0-20181220.1
ARCHITECTURE=x86_64

---------------------------------------
# rpm -qa|egrep 'libblockdev-[0-9]|python3-blockdev'
libblockdev-2.19-6.el8.x86_64
python3-blockdev-2.19-6.el8.x86_64

# python sample_script.py
** (process:30631): WARNING **: 00:30:16.665: The 'fsck.vfat' utility is not available
The 'fatlabel' utility is not available
The 'mkfs.vfat' utility is not available
Traceback (most recent call last):
  File "sample_script.py", line 18, in <module>
    succ_ = bd.init(requested_plugins)
  File "/usr/lib64/python3.6/site-packages/gi/overrides/BlockDev.py", line 91, in init
    return _init(require_plugins, log_func)
GLib.Error: g-bd-init-error-quark: Failed to load plugins (0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sample_script.py", line 20, in <module>
    raise RuntimeError("Failed to initialize libbd and its plugins (%s)" % REQUESTED_PLUGIN_NAMES)
RuntimeError: Failed to initialize libbd and its plugins ({'fs'})

# uname -r
4.18.0-56.el8.x86_64

# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.0 Beta (Ootpa)

Comment 3 Vojtech Trefny 2019-01-08 08:57:12 UTC
This is actually expected behavior. Libblockdev has checks for runtime dependencies during init by default and init fails if the dependencies are not available. You can use the "bd_switch_init_checks" function to disable this behavior.
I've updated the API examples to do this by default -- https://github.com/storaged-project/api-examples/pull/6

Comment 4 xhe@redhat.com 2019-03-21 01:11:16 UTC
I didn't find the issue on latest version of libblockdev-2.19-7.el8, libblockdev fs plugin can be loaded successfully in my testing. 
We can Resolve current bug.

test.py
------------
#!/usr/bin/python3
  
import sys
import os

import gi
gi.require_version("GLib", "2.0")
gi.require_version("BlockDev", "2.0")

from gi.repository import GLib
from gi.repository import BlockDev as bd

REQUESTED_PLUGIN_NAMES = {"fs"}

requested_plugins = bd.plugin_specs_from_names(REQUESTED_PLUGIN_NAMES)

# disable checks for runtime dependencies during init -- thanks to this init
# won't fail if for example 'mke2fs' is not installed
bd.switch_init_checks(False)

try:
    succ_ = bd.init(requested_plugins)
except GLib.GError as err:
    raise RuntimeError("Failed to initialize libbd and its plugins (%s)" % REQUESTED_PLUGIN_NAMES)

Comment 5 Vojtech Trefny 2020-09-21 12:33:07 UTC
Closing based on comment #4. Please to reopen the bug if you encounter the issue again.


Note You need to log in before you can comment on or make changes to this bug.