Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion nixos/modules/services/cluster/kubernetes/kubelet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ in
[
gitMinimal
openssh
util-linux
# TODO (#409339): remove this patch. We had to add it to avoid a mass rebuild
# for the 25.05 release. Once the staging cycle referenced in the above PR completes,
# switch back to plain util-linux.
util-linux.withPatches
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure whether to switch this to minimal (there is gitMinimal, above). I guess it could make sense, but I'm also afraid of breaking kubernetes somehow by doing that, and we can now build a patched util-linux (not minimal) without rebuilding the world anyway.

iproute2
ethtool
thin-provisioning-tools
Expand Down
14 changes: 4 additions & 10 deletions pkgs/applications/networking/cluster/k3s/builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,16 +333,10 @@ let
}).overrideAttrs
overrideContainerdAttrs;

# TODO (#405952): remove this patch. We had to add it to avoid a mass rebuild
# for the 25.05 release. Once the above PR is merged, switch back to plain util-linuxMinimal.
k3sUtilLinux = util-linuxMinimal.overrideAttrs (prev: {
patches =
prev.patches or [ ]
++ lib.singleton (fetchpatch {
url = "https://github.com/util-linux/util-linux/commit/7dbfe31a83f45d5aef2b508697e9511c569ffbc8.patch";
hash = "sha256-bJqpZiPli5Pm/XpDA445Ab5jesXrlcnaO6e4V0B3rSw=";
});
});
# TODO (#409339): remove this patch. We had to add it to avoid a mass rebuild
# for the 25.05 release. Once the staging cycle referenced in the above PR completes,
# switch back to plain util-linuxMinimal.
k3sUtilLinux = util-linuxMinimal.withPatches;
in
buildGoModule rec {
pname = "k3s";
Expand Down
39 changes: 39 additions & 0 deletions pkgs/by-name/ut/util-linux/fix-mount-regression.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 7dbfe31a83f45d5aef2b508697e9511c569ffbc8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 24 Mar 2025 14:31:05 +0100
Subject: [PATCH] libmount: fix --no-canonicalize regression

Fixes: https://github.com/util-linux/util-linux/issues/3474
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/context.c | 3 ---
sys-utils/mount.8.adoc | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/libmount/src/context.c b/libmount/src/context.c
index 0323cb23d34..15a8ad3bbd0 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -530,9 +530,6 @@ int mnt_context_is_xnocanonicalize(
assert(cxt);
assert(type);

- if (mnt_context_is_nocanonicalize(cxt))
- return 1;
-
ol = mnt_context_get_optlist(cxt);
if (!ol)
return 0;
diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc
index 4f23f8d1f0e..5103b91c578 100644
--- a/sys-utils/mount.8.adoc
+++ b/sys-utils/mount.8.adoc
@@ -756,7 +756,7 @@ Allow to make a target directory (mountpoint) if it does not exist yet. The opti
*X-mount.nocanonicalize*[**=**_type_]::
Allows disabling of canonicalization for mount source and target paths. By default, the `mount` command resolves all paths to their absolute paths without symlinks. However, this behavior may not be desired in certain situations, such as when binding a mount over a symlink, or a symlink over a directory or another symlink. The optional argument _type_ can be either "source" or "target" (mountpoint). If no _type_ is specified, then canonicalization is disabled for both types. This mount option does not affect the conversion of source tags (e.g. LABEL= or UUID=) and fstab processing.
+
-The command line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but it does not modify flags for open_tree syscalls.
+The command-line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but for backward compatibility, it does not modify open_tree syscall flags and does not allow the bind-mount over a symlink use case.
+
Note that *mount*(8) still sanitizes and canonicalizes the source and target paths specified on the command line by non-root users, regardless of the X-mount.nocanonicalize setting.

16 changes: 14 additions & 2 deletions pkgs/by-name/ut/util-linux/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
let
isMinimal = cryptsetupSupport == false && !nlsSupport && !ncursesSupport && !systemdSupport;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalPackage: rec {
pname = "util-linux" + lib.optionalString isMinimal "-minimal";
version = "2.41";

Expand Down Expand Up @@ -200,6 +200,18 @@ stdenv.mkDerivation rec {
'';

passthru = {
# TODO (#409339): Remove this hack. We had to add it to avoid a mass rebuild
# for the 25.05 release to fix Kubernetes. Once the staging cycle referenced
# in the above PR completes, this passthru and all consumers of it should go away.
withPatches = finalPackage.overrideAttrs (prev: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty overcomplicated for me for something that I don't remember having come up very much before…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should just do overrides in two places then? I was split between both approaches but could see merits to either because it's a oneoff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having the passthru is fine but I'd remove it again once we don't need it any more.

Copy link
Contributor Author

@numinit numinit May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, yeah, completely fair. People should not rely on this. I'll update the tracking issue and fix the comment to indicate that this is a temporary hack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good now.

patches = lib.unique (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this lib.unique is written in a way where, after the staging merge, withPatches and normal util-linux will eval to the same outpath.

prev.patches or [ ]
++ [
./fix-mount-regression.patch
]
);
});

updateScript = gitUpdater {
# No nicer place to find latest release.
url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git";
Expand Down Expand Up @@ -237,4 +249,4 @@ stdenv.mkDerivation rec {
];
priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages
};
}
})