[LU-5060] mkfs.lustre --backfstype=zfs fails to execute due to fix library name libzfs.so.1 Created: 14/May/14  Updated: 15/May/14  Resolved: 14/May/14

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.1
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Thomas Stibor Assignee: WC Triage
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Debian 7.5, 3.2 kernel,
SPL 0.6.2-38_gad3412e
ZFS 0.6.2-274_g2c33b91


Issue Links:
Duplicate
is duplicated by LU-4606 Lustre hard codes libzfs.so.1 in lust... Resolved
Epic/Theme: zfs
Severity: 3
Rank (Obsolete): 13978

 Description   

Cloning master SPL/ZFS from github and compiling and running Lustre (cloned from master) with ZFS backend
only, results in:

# mkfs.lustre --reformat --mgs --backfstype=zfs ....

mkfs.lustre FATAL: Failed to initialize ZFS library. Are the ZFS
packages and modules correctly installed?
mkfs.lustre FATAL: unable to prepare backend (22)
mkfs.lustre: exiting with 22 (Invalid argument)

strace reveals:

# strace mkfs.lustre --backfstype=zfs ...

...
...
open("/usr/lib/tls/x86_64/libzfs.so.1", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat("/usr/lib/tls/x86_64", 0x7fffcb620930) = -1 ENOENT (No such file or
directory)
open("/usr/lib/tls/libzfs.so.1", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat("/usr/lib/tls", 0x7fffcb620930)    = -1 ENOENT (No such file or
directory)
open("/usr/lib/x86_64/libzfs.so.1", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat("/usr/lib/x86_64", 0x7fffcb620930) = -1 ENOENT (No such file or
directory)
open("/usr/lib/libzfs.so.1", O_RDONLY)  = -1 ENOENT (No such file or
directory)
stat("/usr/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
munmap(0x7f650e274000, 13380)           = 0
write(2, "\nmkfs.lustre FATAL: ", 20
mkfs.lustre FATAL: )   = 20
write(2, "Failed to initialize ZFS library"..., 88Failed to initialize
ZFS library. Are the ZFS packages and modules correctly installed?

In mount_utils_zfs.c:

...
	handle_libzfs = dlopen("libzfs.so.1", RTLD_LAZY);
	if (handle_libzfs == NULL)
		return EINVAL;

	handle_nvpair = dlopen("libnvpair.so.1", RTLD_LAZY);
	if (handle_nvpair == NULL) {
		ret = EINVAL;
		goto out;
	}
...

However, the latest ZFS libraries are named:

lrwxrwxrwx 1 root staff      15 May 14 11:46 libzfs.so -> libzfs.so.2.0.0
lrwxrwxrwx 1 root staff      15 May 14 11:46 libzfs.so.2 -> libzfs.so.2.0.0
-rwxr-xr-x 1 root staff 1040438 May 14 11:46 libzfs.so.2.0.0
...
lrwxrwxrwx 1 root staff      18 May 14 11:46 libnvpair.so -> libnvpair.so.1.0.1
lrwxrwxrwx 1 root staff      18 May 14 11:46 libnvpair.so.1 -> libnvpair.so.1.0.1
-rwxr-xr-x 1 root staff  317279 May 14 11:46 libnvpair.so.1.0.1

I guess the most simplest solution to fix that, would be changing

handle_libzfs = dlopen("libzfs.so.1", RTLD_LAZY);

into

handle_libzfs = dlopen("libzfs.so", RTLD_LAZY);

So it will based on the proper symbolic links.

I will provide a simple patch for this problem.



 Comments   
Comment by Andreas Dilger [ 15/May/14 ]

Patch is at http://review.whamcloud.com/10326 it this is obsoleted by http://review.whamcloud.com/10193 changes. It may make more sense to land the 10326 patch for b2_5, since it is much less intrusive.

Comment by Thomas Stibor [ 15/May/14 ]

Ok, thanks for the info. I have abandoned the patch http://review.whamcloud.com/#/c/10326/

Generated at Sat Feb 10 01:48:11 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.