From 68221c35ff10c0e3f61074d97b02dc4b32164ad4 Mon Sep 17 00:00:00 2001 From: Kartik Gokte Date: Mon, 11 Dec 2023 19:09:26 +0530 Subject: [PATCH 1/2] ceph: use absolute binary paths instead of relative paths While trying to mount CephFS using libceph and systemd, mount.ceph tries to call "modinfo", "modprobe", and "grep", but fails with the error "sh: line 1: modprobe: command not found". This is because ceph calls these binaries by running the command "sh -c -- %s %s", which does not pass the PATH environment variable through. This isn't usually a problem, because ceph, by default, calls the paths of these binaries as they would be in debian, in /sbin and /bin, but a change was made to replace these with relative paths, thus breaking the mounting process entirely. Replacing these relative paths with absolute store paths alleviates this issue whilst preserving all functionality. --- pkgs/tools/filesystems/ceph/default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/filesystems/ceph/default.nix b/pkgs/tools/filesystems/ceph/default.nix index 241bf71985a0..f38cd4be880c 100644 --- a/pkgs/tools/filesystems/ceph/default.nix +++ b/pkgs/tools/filesystems/ceph/default.nix @@ -28,8 +28,10 @@ , doxygen , gperf , graphviz +, gnugrep , gtest , icu +, kmod , libcap , libcap_ng , libnl @@ -294,10 +296,14 @@ in rec { pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ]; + # replace /sbin and /bin based paths with direct nix store paths + # increase the `command` buffer size since 2 nix store paths cannot fit within 128 characters preConfigure ='' - substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo" - substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe" - substituteInPlace src/common/module.c --replace "/bin/grep" "grep" + substituteInPlace src/common/module.c \ + --replace "char command[128];" "char command[256];" \ + --replace "/sbin/modinfo" "${kmod}/bin/modinfo" \ + --replace "/sbin/modprobe" "${kmod}/bin/modprobe" \ + --replace "/bin/grep" "${gnugrep}/bin/grep" # install target needs to be in PYTHONPATH for "*.pth support" check to succeed # set PYTHONPATH, so the build system doesn't silently skip installing ceph-volume and others From 41b27d7f4b3d9609c5b80ca67925c5827322f00d Mon Sep 17 00:00:00 2001 From: Kartik Gokte Date: Mon, 11 Dec 2023 19:11:20 +0530 Subject: [PATCH 2/2] nixosTests.ceph-single-node: remove dashboard check Due to an [issue](https://www.spinics.net/lists/ceph-users/msg77812.html) with the cryptography python library, Ceph Dashboard and other mgr modules are currently broken, which will cause this test to always fail. Removing the check resolves this issue, and brings the test in line wit^Cthe other Ceph tests, which do not contain the dashboard check. --- nixos/tests/ceph-single-node.nix | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/nixos/tests/ceph-single-node.nix b/nixos/tests/ceph-single-node.nix index 4a5636fac156..a3a4072365af 100644 --- a/nixos/tests/ceph-single-node.nix +++ b/nixos/tests/ceph-single-node.nix @@ -182,16 +182,19 @@ let monA.wait_until_succeeds("ceph -s | grep 'mgr: ${cfg.monA.name}(active,'") monA.wait_until_succeeds("ceph -s | grep 'HEALTH_OK'") + # This test has been commented out due to the upstream issue with pyo3 + # that has broken this dashboard + # Reference: https://www.spinics.net/lists/ceph-users/msg77812.html # Enable the dashboard and recheck health - monA.succeed( - "ceph mgr module enable dashboard", - "ceph config set mgr mgr/dashboard/ssl false", - # default is 8080 but it's better to be explicit - "ceph config set mgr mgr/dashboard/server_port 8080", - ) - monA.wait_for_open_port(8080) - monA.wait_until_succeeds("curl -q --fail http://localhost:8080") - monA.wait_until_succeeds("ceph -s | grep 'HEALTH_OK'") + # monA.succeed( + # "ceph mgr module enable dashboard", + # "ceph config set mgr mgr/dashboard/ssl false", + # # default is 8080 but it's better to be explicit + # "ceph config set mgr mgr/dashboard/server_port 8080", + # ) + # monA.wait_for_open_port(8080) + # monA.wait_until_succeeds("curl -q --fail http://localhost:8080") + # monA.wait_until_succeeds("ceph -s | grep 'HEALTH_OK'") ''; in { name = "basic-single-node-ceph-cluster";