When trying to install or remove kernels using CachyOS Kernel Manager, the operation fails because the generated temporary script is removed before it can be executed.
❯ strace -f -e execve cachyos-kernel-manager 2>&1 | tee /tmp/kernel-manager-trace.log
execve("/usr/bin/cachyos-kernel-manager", ["cachyos-kernel-manager"], 0x7ffd16884be8 /* 57 vars */) = 0
strace: Process 206514 attached
[pid 206514] execve("/bin/sh", ["sh", "-c", "--", "findmnt -ln -o FSTYPE /"], 0x7ffdebf1c3a8 /* 57 vars */) = 0
[pid 206514] execve("/usr/bin/findmnt", ["findmnt", "-ln", "-o", "FSTYPE", "/"], 0x55fa02edd960 /* 58 vars */) = 0
[pid 206514] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206514, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 206515 attached
[pid 206515] execve("/bin/sh", ["sh", "-c", "--", "chwd --list-installed -d 2>/dev/"...], 0x7ffdebf1c3a8 /* 57 vars */) = 0
strace: Process 206516 attached
strace: Process 206517 attached
[pid 206516] execve("/usr/bin/chwd", ["chwd", "--list-installed", "-d"], 0x55f46ff36990 /* 58 vars */strace: Process 206518 attached
) = 0
[pid 206517] execve("/usr/bin/grep", ["grep", "Name"], 0x55f46ff36990 /* 58 vars */) = 0
[pid 206518] execve("/usr/bin/awk", ["awk", "{print $4}"], 0x55f46ff36990 /* 58 vars */) = 0
strace: Process 206519 attached
[pid 206519] +++ exited with 0 +++
strace: Process 206520 attached
[pid 206520] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206520] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206520] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = 0
[pid 206520] +++ exited with 1 +++
[pid 206516] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206520, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
strace: Process 206521 attached
[pid 206521] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206521] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206521] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = 0
[pid 206521] +++ exited with 1 +++
[pid 206516] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206521, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
strace: Process 206522 attached
[pid 206522] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206522] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206522] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffe958aaf8 /* 58 vars */) = 0
[pid 206522] +++ exited with 1 +++
[pid 206516] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206522, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
[pid 206516] +++ exited with 0 +++
[pid 206517] +++ exited with 0 +++
[pid 206518] +++ exited with 0 +++
[pid 206515] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206516, si_uid=1000, si_status=0, si_utime=1 /* 0.01 s */, si_stime=2 /* 0.02 s */} ---
[pid 206515] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206515, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 206523 attached
[pid 206523] execve("/bin/sh", ["sh", "-c", "--", "chwd --list-installed -d 2>/dev/"...], 0x7ffdebf1c3a8 /* 57 vars */) = 0
strace: Process 206524 attached
strace: Process 206525 attached
strace: Process 206526 attached
[pid 206524] execve("/usr/bin/chwd", ["chwd", "--list-installed", "-d"], 0x55b249dce990 /* 58 vars */) = 0
[pid 206525] execve("/usr/bin/grep", ["grep", "Name"], 0x55b249dce990 /* 58 vars */ <unfinished ...>
[pid 206526] execve("/usr/bin/awk", ["awk", "{print $4}"], 0x55b249dce990 /* 58 vars */ <unfinished ...>
[pid 206525] <... execve resumed>) = 0
[pid 206526] <... execve resumed>) = 0
strace: Process 206527 attached
[pid 206527] +++ exited with 0 +++
strace: Process 206528 attached
[pid 206528] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206528] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206528] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = 0
[pid 206528] +++ exited with 1 +++
[pid 206524] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206528, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
strace: Process 206529 attached
[pid 206529] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206529] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206529] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = 0
[pid 206529] +++ exited with 1 +++
[pid 206524] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206529, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
strace: Process 206530 attached
[pid 206530] execve("/home/destoryg/.bun/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206530] execve("/usr/local/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = -1 ENOENT (没有那个文件或目录)
[pid 206530] execve("/usr/bin/systemd-detect-virt", ["systemd-detect-virt", "--vm"], 0x7fffbe4a2278 /* 58 vars */) = 0
[pid 206530] +++ exited with 1 +++
[pid 206524] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206530, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
[pid 206524] +++ exited with 0 +++
[pid 206525] +++ exited with 0 +++
[pid 206526] +++ exited with 0 +++
[pid 206523] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206524, si_uid=1000, si_status=0, si_utime=1 /* 0.01 s */, si_stime=1 /* 0.01 s */} ---
[pid 206523] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206523, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 206531 attached
strace: Process 206532 attached
strace: Process 206533 attached
strace: Process 206534 attached
strace: Process 206535 attached
strace: Process 206536 attached
strace: Process 206537 attached
strace: Process 206538 attached
strace: Process 206539 attached
strace: Process 206540 attached
strace: Process 206541 attached
strace: Process 206542 attached
strace: Process 206543 attached
strace: Process 206544 attached
strace: Process 206545 attached
strace: Process 206546 attached
strace: Process 206547 attached
strace: Process 206548 attached
strace: Process 206549 attached
strace: Process 206550 attached
strace: Process 206551 attached
strace: Process 206552 attached
[pid 206542] +++ exited with 0 +++
[pid 206541] +++ exited with 0 +++
[pid 206552] +++ exited with 0 +++
[pid 206551] +++ exited with 0 +++
[pid 206550] +++ exited with 0 +++
[pid 206549] +++ exited with 0 +++
[pid 206547] +++ exited with 0 +++
[pid 206545] +++ exited with 0 +++
[pid 206543] +++ exited with 0 +++
[pid 206540] +++ exited with 0 +++
[pid 206548] +++ exited with 0 +++
[pid 206544] +++ exited with 0 +++
[pid 206546] +++ exited with 0 +++
strace: Process 206553 attached
strace: Process 206554 attached
strace: Process 206555 attached
strace: Process 206556 attached
strace: Process 206557 attached
strace: Process 206558 attached
strace: Process 206559 attached
strace: Process 206560 attached
strace: Process 206561 attached
strace: Process 206562 attached
strace: Process 206563 attached
strace: Process 206564 attached
strace: Process 206565 attached
[pid 206565] +++ exited with 0 +++
[pid 206564] +++ exited with 0 +++
[pid 206563] +++ exited with 0 +++
[pid 206562] +++ exited with 0 +++
[pid 206561] +++ exited with 0 +++
[pid 206560] +++ exited with 0 +++
[pid 206559] +++ exited with 0 +++
[pid 206555] +++ exited with 0 +++
[pid 206553] +++ exited with 0 +++
[pid 206558] +++ exited with 0 +++
[pid 206557] +++ exited with 0 +++
[pid 206556] +++ exited with 0 +++
[pid 206554] +++ exited with 0 +++
strace: Process 206566 attached
strace: Process 206567 attached
strace: Process 206568 attached
strace: Process 206569 attached
strace: Process 206570 attached
strace: Process 206571 attached
strace: Process 206572 attached
strace: Process 206573 attached
strace: Process 206574 attached
strace: Process 206575 attached
strace: Process 206576 attached
strace: Process 206577 attached
strace: Process 206578 attached
[pid 206578] +++ exited with 0 +++
[pid 206575] +++ exited with 0 +++
[pid 206574] +++ exited with 0 +++
[pid 206572] +++ exited with 0 +++
[pid 206570] +++ exited with 0 +++
[pid 206568] +++ exited with 0 +++
[pid 206566] +++ exited with 0 +++
[pid 206573] +++ exited with 0 +++
[pid 206569] +++ exited with 0 +++
[pid 206577] +++ exited with 0 +++
[pid 206571] +++ exited with 0 +++
[pid 206567] +++ exited with 0 +++
[pid 206576] +++ exited with 0 +++
strace: Process 206579 attached
strace: Process 206580 attached
strace: Process 206581 attached
strace: Process 206582 attached
strace: Process 206583 attached
strace: Process 206584 attached
strace: Process 206681 attached
Waiting...
strace: Process 206682 attached
[pid 206682] execve("/usr/lib/cachyos-kernel-manager/terminal-helper", ["/usr/lib/cachyos-kernel-manager/"..., "-s", "pkexec /usr/lib/cachyos-kernel-m"..., "pacman -Rsn linux-cachyos-lts li"...], 0x7ffdebf1c3a8 /* 57 vars */) = 0
strace: Process 206683 attached
[pid 206683] execve("/usr/bin/mktemp", ["mktemp"], 0x55d6428c4520 /* 58 vars */) = 0
[pid 206683] +++ exited with 0 +++
[pid 206682] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206683, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 206684 attached
[pid 206684] execve("/usr/bin/kgx", ["kgx", "--wait", "--", "pkexec", "/usr/lib/cachyos-kernel-manager/"..., "/tmp/tmp.KVCNMXHwI0"], 0x55d6428c0890 /* 58 vars */) = 0
strace: Process 206685 attached
strace: Process 206686 attached
strace: Process 206687 attached
strace: Process 206688 attached
strace: Process 206697 attached
[pid 206697] +++ exited with 0 +++
[pid 206688] +++ exited with 0 +++
[pid 206687] +++ exited with 0 +++
[pid 206686] +++ exited with 0 +++
[pid 206685] +++ exited with 0 +++
[pid 206684] +++ exited with 0 +++
[pid 206682] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206684, si_uid=1000, si_status=0, si_utime=2 /* 0.02 s */, si_stime=1 /* 0.01 s */} ---
strace: Process 206699 attached
[pid 206699] execve("/usr/bin/rm", ["rm", "/tmp/tmp.KVCNMXHwI0"], 0x55d6428c0890 /* 58 vars */) = 0
[pid 206699] +++ exited with 0 +++
[pid 206682] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206699, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 206682] +++ exited with 2 +++
[pid 206681] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=206682, si_uid=1000, si_status=2, si_utime=0, si_stime=0} ---
Waiting...
[pid 206681] +++ exited with 0 +++
[pid 206584] +++ exited with 0 +++
[pid 206579] +++ exited with 0 +++
[pid 206581] +++ exited with 0 +++
[pid 206580] +++ exited with 0 +++
[pid 206582] +++ exited with 0 +++
[pid 206583] +++ exited with 0 +++
[pid 206538] +++ exited with 0 +++
[pid 206539] +++ exited with 0 +++
[pid 206531] +++ exited with 0 +++
[pid 206537] +++ exited with 0 +++
[pid 206535] +++ exited with 0 +++
[pid 206534] +++ exited with 0 +++
[pid 206533] +++ exited with 0 +++
[pid 206532] +++ exited with 0 +++
[pid 206536] +++ exited with 0 +++
+++ exited with 0 +++
~ 11s
blocks until the command has completed, but the cleanup step runs immediately.
This causes the generated temporary script to be deleted before it is consumed.
Description
When trying to install or remove kernels using CachyOS Kernel Manager, the operation fails because the generated temporary script is removed before it can be executed.
The terminal opens, but the command immediately fails with:
Steps to reproduce
Expected behavior
Kernel Manager should open the terminal, run the generated root script through
pkexec, and perform the requested pacman operation.Actual behavior
The temporary script passed to
rootshell.shno longer exists whenbashtries to execute it.Investigation
I traced the execution with
strace:Looks like the temporary script is removed immediately after launching
kgx, beforepkexeccan execute it.Possible cause
terminal-helperappears to assume that:kgx --wait -- commandblocks until the command has completed, but the cleanup step runs immediately.
This causes the generated temporary script to be deleted before it is consumed.
Environment
kgx)cachyos-kernel-managerAdditional note
The same behavior appears to exist in
cachyos-hello, which also uses a similarterminal-helperapproach. This may be a shared helper issue rather than a Kernel Manager-specific problem.