{"record":{"id":"dde2ae022f3c1f4f","repo":"2dust/v2rayN","slug":"failed-to-run-core-please-check-the-prompt-inform","errorCode":null,"errorMessage":"Failed to run Core, please check the prompt information","messagePattern":"Failed to run Core, please check the prompt information","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"v2rayN/ServiceLib/Manager/CoreAdminManager.cs","lineNumber":65,"sourceCode":"        }\n\n        var shFilePath = await FileUtils.CreateLinuxShellFile(\"run_as_sudo.sh\", sb.ToString(), true);\n\n        var procService = new ProcessService(\n            fileName: shFilePath,\n            arguments: \"\",\n            workingDirectory: Utils.GetBinConfigPath(),\n            displayLog: true,\n            redirectInput: true,\n            environmentVars: null,\n            updateFunc: _updateFunc\n        );\n\n        await procService.StartAsync(AppManager.Instance.LinuxSudoPwd);\n\n        if (procService is null or { HasExited: true })\n        {\n            throw new Exception(ResUI.FailedToRunCore);\n        }\n        _linuxSudoPid = procService.Id;\n\n        return procService;\n    }\n\n    public async Task KillProcessAsLinuxSudo()\n    {\n        if (_linuxSudoPid < 0)\n        {\n            return;\n        }\n\n        try\n        {\n            var shellFileName = Utils.IsMacOS() ? Global.KillAsSudoOSXShellFileName : Global.KillAsSudoLinuxShellFileName;\n            var shFilePath = await FileUtils.CreateLinuxShellFile(\"kill_as_sudo.sh\", EmbedUtils.GetEmbedText(shellFileName), true);\n            if (shFilePath.Contains(' '))","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/2dust/v2rayN/blob/e01717d8326a4f5060b335523590c5fda943fe03/v2rayN/ServiceLib/Manager/CoreAdminManager.cs#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the displayLog/updateFunc output captured during StartAsync for the core's own error message (the message says 'check the prompt information').","Verify LinuxSudoPwd is correct and the user can sudo non-interactively.","Run the core binary manually with the same working directory and config to reproduce the immediate exit.","Confirm the core binary exists, is executable, and its architecture/dependencies match the host.","Validate the generated config file in the bin config path is parseable by the core."],"exampleFix":"// before - opaque failure, user must guess\nif (procService is null or { HasExited: true })\n{\n    throw new Exception(ResUI.FailedToRunCore);\n}\n\n// after - surface the captured core stderr/exit code\nif (procService is null or { HasExited: true })\n{\n    var exit = procService?.HasExited == true ? procService.ExitCode : -1;\n    throw new Exception($\"{ResUI.FailedToRunCore} (exit={exit}). Core output: {_lastCoreOutput}\");\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight: ensure the core binary exists and is executable before sudo-start\nif (!File.Exists(fileName)) throw new FileNotFoundException(\"Core binary not found\", fileName);\nif (OperatingSystem.IsLinux() && string.IsNullOrEmpty(AppManager.Instance.LinuxSudoPwd))\n    throw new InvalidOperationException(\"Linux sudo password is not configured.\");","typeGuard":"static bool IsCoreBinaryReady(string path) => File.Exists(path);","tryCatchPattern":"try\n{\n    var proc = await adminManager.RunCoreAsLinuxSudo();\n}\ncatch (Exception ex) when (ex.Message == ResUI.FailedToRunCore)\n{\n    // core crashed on startup under sudo; inspect displayLog output and sudo password\n    _log?.Error(\"Core failed to start under sudo; check log/sudo password/binary.\");\n}","preventionTips":["Verify LinuxSudoPwd is correct and sudo works non-interactively.","Run the core binary manually with the same config to reproduce immediate exit.","Confirm the binary exists, is executable, and matches the host architecture.","Inspect the displayLog/updateFunc output for the core's own error.","Validate the config file in the bin config path."],"tags":["linux","sudo","process","core","startup"],"backgroundTag":null,"analyzedSha":"e01717d8326a4f5060b335523590c5fda943fe03","analyzedAt":"2026-08-13T10:10:23.416Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}