2dust/v2rayN · critical · Exception

Failed to run Core, please check the prompt information

Error message

Failed to run Core, please check the prompt information

What it means

Thrown by the Linux sudo core-runner after ProcessService.StartAsync(LinuxSudoPwd) when the process is null or has already exited (HasExited true). It means the proxy core binary failed to start or crashed immediately under sudo.

Source

Thrown at v2rayN/ServiceLib/Manager/CoreAdminManager.cs:65

        }

        var shFilePath = await FileUtils.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);

        var procService = new ProcessService(
            fileName: shFilePath,
            arguments: "",
            workingDirectory: Utils.GetBinConfigPath(),
            displayLog: true,
            redirectInput: true,
            environmentVars: null,
            updateFunc: _updateFunc
        );

        await procService.StartAsync(AppManager.Instance.LinuxSudoPwd);

        if (procService is null or { HasExited: true })
        {
            throw new Exception(ResUI.FailedToRunCore);
        }
        _linuxSudoPid = procService.Id;

        return procService;
    }

    public async Task KillProcessAsLinuxSudo()
    {
        if (_linuxSudoPid < 0)
        {
            return;
        }

        try
        {
            var shellFileName = Utils.IsMacOS() ? Global.KillAsSudoOSXShellFileName : Global.KillAsSudoLinuxShellFileName;
            var shFilePath = await FileUtils.CreateLinuxShellFile("kill_as_sudo.sh", EmbedUtils.GetEmbedText(shellFileName), true);
            if (shFilePath.Contains(' '))

View on GitHub (pinned to e01717d832)

Solutions

  1. Inspect the displayLog/updateFunc output captured during StartAsync for the core's own error message (the message says 'check the prompt information').
  2. Verify LinuxSudoPwd is correct and the user can sudo non-interactively.
  3. Run the core binary manually with the same working directory and config to reproduce the immediate exit.
  4. Confirm the core binary exists, is executable, and its architecture/dependencies match the host.
  5. Validate the generated config file in the bin config path is parseable by the core.

Example fix

// before - opaque failure, user must guess
if (procService is null or { HasExited: true })
{
    throw new Exception(ResUI.FailedToRunCore);
}

// after - surface the captured core stderr/exit code
if (procService is null or { HasExited: true })
{
    var exit = procService?.HasExited == true ? procService.ExitCode : -1;
    throw new Exception($"{ResUI.FailedToRunCore} (exit={exit}). Core output: {_lastCoreOutput}");
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: ensure the core binary exists and is executable before sudo-start
if (!File.Exists(fileName)) throw new FileNotFoundException("Core binary not found", fileName);
if (OperatingSystem.IsLinux() && string.IsNullOrEmpty(AppManager.Instance.LinuxSudoPwd))
    throw new InvalidOperationException("Linux sudo password is not configured.");

Type guard

static bool IsCoreBinaryReady(string path) => File.Exists(path);

Try / catch

try
{
    var proc = await adminManager.RunCoreAsLinuxSudo();
}
catch (Exception ex) when (ex.Message == ResUI.FailedToRunCore)
{
    // core crashed on startup under sudo; inspect displayLog output and sudo password
    _log?.Error("Core failed to start under sudo; check log/sudo password/binary.");
}

Prevention

When it happens

Trigger: CoreAdminManager starts the core with sudo using the stored password, waits, then checks procService is null or HasExited == true. A near-immediate exit trips the guard.

Common situations: Wrong/missing sudo password (LinuxSudoPwd) so sudo failed and the child never ran; the core binary path is wrong or not executable; missing runtime dependencies (libgrpc, glibc version); the core exited due to a bad config file in Utils.GetBinConfigPath(); architecture mismatch (e.g. arm binary on x86); displayLog output was not inspected.

Related errors


AI-assisted analysis of 2dust/v2rayN@e01717d832 (2026-08-13). Data as JSON: /api/errors/dde2ae022f3c1f4f. Report an issue: GitHub.