Some post unmerged-usr cleanups (#38696)

I noticed in our NixOS packaging that we were working around the fact
that core/swap.c looks for swapon and swapoff in /sbin

Lets make it configurable just like all the other util-linux binaries
through meson and make it default to /usr/sbin/{swapon,swapoff}

This way mounts work on a systemd without the /sbin -> /usr/sbin
compatibility symlink. (And as a side-effect has NixOS be able to have
it in /nix/store too like the other util-linux tools).

Given that `unmerged-usr` support was dropped in 255 I think this is a
safe change?
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-09-17 14:22:05 +02:00
committed by GitHub
8 changed files with 13 additions and 7 deletions
+3
View File
@@ -635,6 +635,9 @@ progs = [['quotaon', '/usr/sbin/quotaon' ],
['kmod', '/usr/bin/kmod' ],
['kexec', '/usr/sbin/kexec' ],
['sulogin', '/usr/sbin/sulogin' ],
['swapon', '/usr/sbin/swapon' ],
['swapoff', '/usr/sbin/swapoff' ],
['agetty', '/usr/sbin/agetty' ],
['mount', '/usr/bin/mount', 'MOUNT_PATH'],
['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
+3
View File
@@ -57,6 +57,9 @@ option('quotacheck-path', type : 'string', description : 'path to quotacheck')
option('kmod-path', type : 'string', description : 'path to kmod')
option('kexec-path', type : 'string', description : 'path to kexec')
option('sulogin-path', type : 'string', description : 'path to sulogin')
option('swapon-path', type : 'string', description : 'path to swapon')
option('swapoff-path', type : 'string', description : 'path to swapoff')
option('agetty-path', type : 'string', description : 'path to agetty')
option('mount-path', type : 'string', description : 'path to mount')
option('umount-path', type : 'string', description : 'path to umount')
option('loadkeys-path', type : 'string', description : 'path to loadkeys')
+2 -2
View File
@@ -781,7 +781,7 @@ static void swap_enter_activating(Swap *s) {
}
}
r = exec_command_set(s->control_command, "/sbin/swapon", "--fixpgsz", NULL);
r = exec_command_set(s->control_command, SWAPON, "--fixpgsz", NULL);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to initialize swapon command line: %m");
goto fail;
@@ -826,7 +826,7 @@ static void swap_enter_deactivating(Swap *s) {
s->control_command = s->exec_command + SWAP_EXEC_DEACTIVATE;
r = exec_command_set(s->control_command,
"/sbin/swapoff",
SWAPOFF,
s->what,
NULL);
if (r < 0) {
+1 -1
View File
@@ -351,7 +351,7 @@ create_session() {
[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/agetty --autologin logind-test-user --noclear %I $TERM
ExecStart=-/usr/sbin/agetty --autologin logind-test-user --noclear %I $TERM
Restart=no
EOF
systemctl daemon-reload
+1 -1
View File
@@ -20,7 +20,7 @@ Before=getty.target
ConditionPathExists=/dev/console
[Service]
ExecStart=-/sbin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM}
ExecStart=-{{AGETTY}} --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM}
Type=idle
Restart=always
UtmpIdentifier=cons
+1 -1
View File
@@ -25,7 +25,7 @@ Conflicts=rescue.service
Before=rescue.service
[Service]
ExecStart=-/sbin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM}
ExecStart=-{{AGETTY}} --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM}
Type=idle
Restart=always
RestartSec=0
+1 -1
View File
@@ -34,7 +34,7 @@ Before=rescue.service
ConditionPathExists=/dev/tty0
[Service]
ExecStart=-/sbin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM}
ExecStart=-{{AGETTY}} --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d - ${TERM}
Type=idle
Restart=always
RestartSec=0
+1 -1
View File
@@ -30,7 +30,7 @@ Conflicts=rescue.service
Before=rescue.service
[Service]
ExecStart=-/sbin/agetty --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM}
ExecStart=-{{AGETTY}} --noreset --noclear --issue-file=/etc/issue:/etc/issue.d:/run/issue.d:/usr/lib/issue.d --keep-baud 115200,57600,38400,9600 - ${TERM}
Type=idle
Restart=always
UtmpIdentifier=%I