You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过Plink执行poweroff命令失败提示‘not found’的问题排查

Great question! I’ve run into this exact issue with embedded devices like AntMiner before, and it all boils down to differences between interactive and non-interactive shell environments.

Let’s break down the root cause:

When you run plink.exe ... poweroff, Plink executes the command in a non-interactive, non-login shell. This type of shell doesn’t load the same configuration files that your interactive shell uses.

On most Linux-based mining devices like AntMiner, the poweroff binary is typically located in /sbin or /usr/sbin—directories that are added to your PATH environment variable only when you start an interactive shell (via files like ~/.bashrc, /etc/profile, or /etc/bash.bashrc).

In the non-interactive shell that Plink uses, the default PATH is much shorter and doesn’t include /sbin//usr/sbin, so the system can’t find the poweroff command, hence the sh: poweroff: not found error (exit code 127 is the standard code for "command not found").

When you log in manually via Plink (without appending the command), you get an interactive shell which loads those configuration files, updates your PATH, and lets you run poweroff without issues.

Fixes you can try:

  1. Use the absolute path to poweroff
    First, find where poweroff is located by running this in your interactive shell:

    which poweroff
    

    It’ll probably return something like /sbin/poweroff. Then update your Plink command to use that full path:

    plink.exe -v -t -ssh antminer -l root -pw xxx /sbin/poweroff
    
  2. Force the shell to load interactive/login configurations
    You can tell Bash (or whatever shell AntMiner uses) to run as a login shell, which will load the necessary PATH settings. Use this command:

    plink.exe -v -t -ssh antminer -l root -pw xxx bash -l -c "poweroff"
    

    (The -l flag makes Bash act as a login shell, and -c lets you pass the command to execute.)

  3. Manually add the required directory to PATH before running poweroff
    If you don’t want to use the absolute path, you can extend the PATH temporarily in the same command:

    plink.exe -v -t -ssh antminer -l root -pw xxx export PATH=$PATH:/sbin && poweroff
    

内容的提问来源于stack exchange,提问作者Wannes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:07:07