[GH-ISSUE #5741] [Bug]: [ERR] Certificate files not found after installation #3991

Closed
opened 2026-10-31 20:36:23 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @skorphil on GitHub (Jul 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5741

Describe the bug

Cant get cert via sudo 3x-ui -> 20 -> 6

[Thu Jul  2 10:33:07 UTC 2026] Your cert is in: /root/.acme.sh/<IP>_ecc/<IP>.cer
[Thu Jul  2 10:33:07 UTC 2026] Your cert key is in: /root/.acme.sh/<IP>_ecc/<IP>.key
[Thu Jul  2 10:33:07 UTC 2026] The intermediate CA cert is in: /root/.acme.sh/<IP>_ecc/ca.cer
[Thu Jul  2 10:33:07 UTC 2026] And the full-chain cert is in: /root/.acme.sh/<IP>_ecc/fullchain.cer
[Thu Jul  2 10:33:08 UTC 2026] ARI suggestedWindow: 2026-07-05T16:28:24Z to 2026-07-05T19:39:13Z
[Thu Jul  2 10:33:08 UTC 2026] Next renewal time picked from ARI window: 2026-07-05T16:49:35Z
[INF] Certificate issued successfully for IP: <IP> 
It seems that you are using sudo, please read this page first:
https://github.com/acmesh-official/acme.sh/wiki/sudo
[ERR] Certificate files not found after installation # ???

How to reproduce the problem

  1. sudo 3x-ui
  2. 20
  3. 6
  4. attempt to get cert

Expected behavior

No response

Actual behavior

Error at the end

Relevant logs


Screenshots

No response

3x-ui version

3.4.2

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24 Minimal AArch

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @skorphil on GitHub (Jul 2, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5741 ### Describe the bug Cant get cert via sudo 3x-ui -> 20 -> 6 ```bash [Thu Jul 2 10:33:07 UTC 2026] Your cert is in: /root/.acme.sh/<IP>_ecc/<IP>.cer [Thu Jul 2 10:33:07 UTC 2026] Your cert key is in: /root/.acme.sh/<IP>_ecc/<IP>.key [Thu Jul 2 10:33:07 UTC 2026] The intermediate CA cert is in: /root/.acme.sh/<IP>_ecc/ca.cer [Thu Jul 2 10:33:07 UTC 2026] And the full-chain cert is in: /root/.acme.sh/<IP>_ecc/fullchain.cer [Thu Jul 2 10:33:08 UTC 2026] ARI suggestedWindow: 2026-07-05T16:28:24Z to 2026-07-05T19:39:13Z [Thu Jul 2 10:33:08 UTC 2026] Next renewal time picked from ARI window: 2026-07-05T16:49:35Z [INF] Certificate issued successfully for IP: <IP> It seems that you are using sudo, please read this page first: https://github.com/acmesh-official/acme.sh/wiki/sudo [ERR] Certificate files not found after installation # ??? ``` ### How to reproduce the problem 1. `sudo 3x-ui ` 2. `20` 3. `6` 4. attempt to get cert ### Expected behavior _No response_ ### Actual behavior Error at the end ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.4.2 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24 Minimal AArch ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:36:23 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 2, 2026):

I traced this against the current x-ui.sh source (menu 20 → 6 maps to ssl_cert_issue_for_ip()). The flow there is:

  1. ~/.acme.sh/acme.sh --issue -d <IP> --standalone --server letsencrypt --certificate-profile shortlived --days 6 --httpport <port> --force (x-ui.sh:1609-1617) — this is what succeeded and produced your Your cert is in: /root/.acme.sh/<IP>_ecc/... / Certificate issued successfully lines.
  2. ~/.acme.sh/acme.sh --installcert -d <IP> --key-file /root/cert/ip/privkey.pem --fullchain-file /root/cert/ip/fullchain.pem --reloadcmd \"systemctl restart x-ui ...\" (x-ui.sh:1634-1637) — this is supposed to copy the just-issued cert into /root/cert/ip/.
  3. x-ui.sh then checks that /root/cert/ip/fullchain.pem and /root/cert/ip/privkey.pem actually exist (x-ui.sh:1639-1647). That check is intentionally file-based rather than exit-code-based (see the comment at x-ui.sh:1632-1633) specifically because a failing reloadcmd alone can make --installcert return non-zero even though the files were copied fine. In your case the check still failed, which produced [ERR] Certificate files not found after installation — meaning step 2 genuinely did not create those two files, not just a false-positive exit code.

The It seems that you are using sudo... line is printed by acme.sh itself (not 3x-ui code), and its position in your log — right where --installcert starts — suggests that call is failing or exiting early in your environment. Your pasted log doesn't include whatever --installcert itself printed between that warning and the final [ERR] line, which would normally contain the actual reason.

To pin this down, could you provide:

  1. The full, unredacted terminal output between the sudo warning and [ERR] Certificate files not found after installation (i.e. whatever --installcert printed).
  2. Output of ls -la /root/.acme.sh/<IP>_ecc/ — to confirm the source .cer/.key files acme.sh reported actually exist there.
  3. Confirmation of how you're logged in: a non-root user running sudo 3x-ui, or already a root shell with a redundant sudo — i.e. is $SUDO_USER actually set to a different account in your session.
  4. ~/.acme.sh/acme.sh --version.

As a workaround to try in the meantime: open a real root shell first (sudo -i or su -) so $SUDO_USER is unset for the session, then run x-ui (without sudo) and retry option 20 → 6.

This reply was generated automatically by an AI agent; a maintainer may follow up.

<!-- gh-comment-id:4864860311 --> @github-actions[bot] commented on GitHub (Jul 2, 2026): I traced this against the current `x-ui.sh` source (menu `20` → `6` maps to `ssl_cert_issue_for_ip()`). The flow there is: 1. `~/.acme.sh/acme.sh --issue -d <IP> --standalone --server letsencrypt --certificate-profile shortlived --days 6 --httpport <port> --force` (`x-ui.sh:1609-1617`) — this is what succeeded and produced your `Your cert is in: /root/.acme.sh/<IP>_ecc/...` / `Certificate issued successfully` lines. 2. `~/.acme.sh/acme.sh --installcert -d <IP> --key-file /root/cert/ip/privkey.pem --fullchain-file /root/cert/ip/fullchain.pem --reloadcmd \"systemctl restart x-ui ...\"` (`x-ui.sh:1634-1637`) — this is supposed to copy the just-issued cert into `/root/cert/ip/`. 3. `x-ui.sh` then checks that `/root/cert/ip/fullchain.pem` and `/root/cert/ip/privkey.pem` actually exist (`x-ui.sh:1639-1647`). That check is intentionally file-based rather than exit-code-based (see the comment at `x-ui.sh:1632-1633`) specifically because a failing `reloadcmd` alone can make `--installcert` return non-zero even though the files were copied fine. In your case the check still failed, which produced `[ERR] Certificate files not found after installation` — meaning step 2 genuinely did not create those two files, not just a false-positive exit code. The `It seems that you are using sudo...` line is printed by `acme.sh` itself (not 3x-ui code), and its position in your log — right where `--installcert` starts — suggests that call is failing or exiting early in your environment. Your pasted log doesn't include whatever `--installcert` itself printed between that warning and the final `[ERR]` line, which would normally contain the actual reason. To pin this down, could you provide: 1. The full, unredacted terminal output between the sudo warning and `[ERR] Certificate files not found after installation` (i.e. whatever `--installcert` printed). 2. Output of `ls -la /root/.acme.sh/<IP>_ecc/` — to confirm the source `.cer`/`.key` files acme.sh reported actually exist there. 3. Confirmation of how you're logged in: a non-root user running `sudo 3x-ui`, or already a `root` shell with a redundant `sudo` — i.e. is `$SUDO_USER` actually set to a different account in your session. 4. `~/.acme.sh/acme.sh --version`. As a workaround to try in the meantime: open a real root shell first (`sudo -i` or `su -`) so `$SUDO_USER` is unset for the session, then run `x-ui` (without `sudo`) and retry option `20` → `6`. *This reply was generated automatically by an AI agent; a maintainer may follow up.*
Author
Owner

@skorphil commented on GitHub (Jul 2, 2026):

Choose an option: 6
Let's Encrypt SSL Certificate for IP Address
This will obtain a certificate for your server's IP using the shortlived profile.
Certificate valid for ~6 days, auto-renews via acme.sh cron job.
Port 80 must be open and accessible from the internet.

Do you want to proceed? [Default y]: y
[INF] Starting automatic SSL certificate generation for server IP... 
[INF] Using Let's Encrypt shortlived profile (~6 days validity, auto-renews) 
[INF] Server IP detected: [REDACTED_IP] 
Do you have an IPv6 address to include? (leave empty to skip): 
Port to use for ACME HTTP-01 listener (default 80): 
[INF] Using port 80 to issue certificate for IP: [REDACTED_IP] 
[INF] Port 80 is free and ready for standalone validation. 
[Thu Jul  2 10:48:48 UTC 2026] Changed default CA to: https://acme-v02.api.letsencrypt.org/directory
[Thu Jul  2 10:48:49 UTC 2026] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Thu Jul  2 10:48:49 UTC 2026] Standalone mode.
[Thu Jul  2 10:48:49 UTC 2026] Creating domain key
[Thu Jul  2 10:48:49 UTC 2026] The domain key is here: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].key
[Thu Jul  2 10:48:49 UTC 2026] Single domain='[REDACTED_IP]'
[Thu Jul  2 10:48:51 UTC 2026] Getting webroot for domain='[REDACTED_IP]'
[Thu Jul  2 10:48:51 UTC 2026] [REDACTED_IP] is already verified, skipping http-01.
[Thu Jul  2 10:48:51 UTC 2026] Verification finished, beginning signing.
[Thu Jul  2 10:48:51 UTC 2026] Let's finalize the order.
[Thu Jul  2 10:48:51 UTC 2026] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/3494839116/527802395066'
[Thu Jul  2 10:48:53 UTC 2026] Downloading cert.
[Thu Jul  2 10:48:53 UTC 2026] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/0551ae933ca0ba1363d1f3278fe9694bf373'
[Thu Jul  2 10:48:53 UTC 2026] Cert success.
-----BEGIN CERTIFICATE-----
[REDACTED_CERTIFICATE_DATA]
-----END CERTIFICATE-----
[Thu Jul  2 10:48:53 UTC 2026] Your cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].cer
[Thu Jul  2 10:48:53 UTC 2026] Your cert key is in: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].key
[Thu Jul  2 10:48:53 UTC 2026] The intermediate CA cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/ca.cer
[Thu Jul  2 10:48:53 UTC 2026] And the full-chain cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/fullchain.cer
[Thu Jul  2 10:48:54 UTC 2026] ARI suggestedWindow: 2026-07-05T16:44:11Z to 2026-07-05T19:55:00Z
[Thu Jul  2 10:48:54 UTC 2026] Next renewal time picked from ARI window: 2026-07-05T17:21:08Z
[INF] Certificate issued successfully for IP: [REDACTED_IP] 
It seems that you are using sudo, please read this page first:
https://github.com/acmesh-official/acme.sh/wiki/sudo
[ERR] Certificate files not found after installation 
    1. Get SSL (Domain)
    2. Revoke & Remove
    3. Force Renew
    4. Show Existing Domains
    5. Set Cert paths for the panel
    6. Get SSL for IP Address (6-day cert, auto-renews)
    0. Back to Main Menu
Choose an option
  1. There is nothing there

3 with sudo
4. already provided

<!-- gh-comment-id:4864977845 --> @skorphil commented on GitHub (Jul 2, 2026): 1. ``` Choose an option: 6 Let's Encrypt SSL Certificate for IP Address This will obtain a certificate for your server's IP using the shortlived profile. Certificate valid for ~6 days, auto-renews via acme.sh cron job. Port 80 must be open and accessible from the internet. Do you want to proceed? [Default y]: y [INF] Starting automatic SSL certificate generation for server IP... [INF] Using Let's Encrypt shortlived profile (~6 days validity, auto-renews) [INF] Server IP detected: [REDACTED_IP] Do you have an IPv6 address to include? (leave empty to skip): Port to use for ACME HTTP-01 listener (default 80): [INF] Using port 80 to issue certificate for IP: [REDACTED_IP] [INF] Port 80 is free and ready for standalone validation. [Thu Jul 2 10:48:48 UTC 2026] Changed default CA to: https://acme-v02.api.letsencrypt.org/directory [Thu Jul 2 10:48:49 UTC 2026] Using CA: https://acme-v02.api.letsencrypt.org/directory [Thu Jul 2 10:48:49 UTC 2026] Standalone mode. [Thu Jul 2 10:48:49 UTC 2026] Creating domain key [Thu Jul 2 10:48:49 UTC 2026] The domain key is here: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].key [Thu Jul 2 10:48:49 UTC 2026] Single domain='[REDACTED_IP]' [Thu Jul 2 10:48:51 UTC 2026] Getting webroot for domain='[REDACTED_IP]' [Thu Jul 2 10:48:51 UTC 2026] [REDACTED_IP] is already verified, skipping http-01. [Thu Jul 2 10:48:51 UTC 2026] Verification finished, beginning signing. [Thu Jul 2 10:48:51 UTC 2026] Let's finalize the order. [Thu Jul 2 10:48:51 UTC 2026] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/3494839116/527802395066' [Thu Jul 2 10:48:53 UTC 2026] Downloading cert. [Thu Jul 2 10:48:53 UTC 2026] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/0551ae933ca0ba1363d1f3278fe9694bf373' [Thu Jul 2 10:48:53 UTC 2026] Cert success. -----BEGIN CERTIFICATE----- [REDACTED_CERTIFICATE_DATA] -----END CERTIFICATE----- [Thu Jul 2 10:48:53 UTC 2026] Your cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].cer [Thu Jul 2 10:48:53 UTC 2026] Your cert key is in: /root/.acme.sh/[REDACTED_IP]_ecc/[REDACTED_IP].key [Thu Jul 2 10:48:53 UTC 2026] The intermediate CA cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/ca.cer [Thu Jul 2 10:48:53 UTC 2026] And the full-chain cert is in: /root/.acme.sh/[REDACTED_IP]_ecc/fullchain.cer [Thu Jul 2 10:48:54 UTC 2026] ARI suggestedWindow: 2026-07-05T16:44:11Z to 2026-07-05T19:55:00Z [Thu Jul 2 10:48:54 UTC 2026] Next renewal time picked from ARI window: 2026-07-05T17:21:08Z [INF] Certificate issued successfully for IP: [REDACTED_IP] It seems that you are using sudo, please read this page first: https://github.com/acmesh-official/acme.sh/wiki/sudo [ERR] Certificate files not found after installation 1. Get SSL (Domain) 2. Revoke & Remove 3. Force Renew 4. Show Existing Domains 5. Set Cert paths for the panel 6. Get SSL for IP Address (6-day cert, auto-renews) 0. Back to Main Menu Choose an option ``` 2. There is nothing there 3 with sudo 4. already provided
Author
Owner

@MHSanaei commented on GitHub (Jul 2, 2026):

Fixed in 62f30390. Root cause: acme.sh guards every non-install command behind its sudo check — when a non-root user runs the panel scripts via sudo, it prints the sudo-wiki warning and exits before doing anything unless FORCE is set. All our --issue calls already passed --force (which is why issuance succeeded), but none of the --installcert calls did, so installation aborted before copying the files and the script reported "Certificate files not found after installation". Every --installcert in x-ui.sh / install.sh / update.sh now passes --force to match. Until the next release, sudo -i first and then running x-ui works around it.

<!-- gh-comment-id:4865443331 --> @MHSanaei commented on GitHub (Jul 2, 2026): Fixed in 62f30390. Root cause: acme.sh guards every non-install command behind its sudo check — when a non-root user runs the panel scripts via `sudo`, it prints the sudo-wiki warning and exits before doing anything unless `FORCE` is set. All our `--issue` calls already passed `--force` (which is why issuance succeeded), but none of the `--installcert` calls did, so installation aborted before copying the files and the script reported "Certificate files not found after installation". Every `--installcert` in x-ui.sh / install.sh / update.sh now passes `--force` to match. Until the next release, `sudo -i` first and then running `x-ui` works around it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3991
No description provided.