Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why my trojan server got signal: 2 when I start trojan service? #697

Closed
tzr0125 opened this issue Mar 22, 2024 · 2 comments
Closed

why my trojan server got signal: 2 when I start trojan service? #697

tzr0125 opened this issue Mar 22, 2024 · 2 comments
Assignees

Comments

@tzr0125
Copy link

tzr0125 commented Mar 22, 2024

I build my trojan server following https://trojan-gfw.github.io/trojan/build.
But When try starting the services I got :

~/trojan# systemctl status trojan
● trojan.service - trojan
Loaded: loaded (/lib/systemd/system/trojan.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-03-22 15:54:42 CST; 3s ago                                                                                                                                                                   Docs: man:trojan(1)
https://trojan-gfw.github.io/trojan/config                                                                                                                                                                                                   https://trojan-gfw.github.io/trojan/
Process: 99351 ExecStart=/usr/local/bin/trojan
/usr/local/etc/trojan/config.json (code=exited, status=1/FAILURE)                                                                                                                            Main PID: 99351 (code=exited, status=1/FAILURE)
CPU: 9ms
Mar 22 15:54:41 yisu-65b90bb68ac14 systemd[1]: trojan.service: Main process exited, code=exited, status=1/FAILURE
Mar 22 15:54:41 yisu-65b90bb68ac14 systemd[1]: trojan.service: Failed with result 'exit-code'.
Mar 22 15:54:42 yisu-65b90bb68ac14 systemd[1]: trojan.service: Scheduled restart job, restart counter is at 5.
Mar 22 15:54:42 yisu-65b90bb68ac14 systemd[1]: Stopped trojan.
Mar 22 15:54:42 yisu-65b90bb68ac14 systemd[1]: trojan.service: Start request repeated too quickly.
Mar 22 15:54:42 yisu-65b90bb68ac14 systemd[1]: trojan.service: Failed with result 'exit-code'.
Mar 22 15:54:42 yisu-65b90bb68ac14 systemd[1]: Failed to start trojan.

The log shows it got a signal: 2

[2024-03-21 21:34:06] [WARN] trojan service (server) started at 0.0.0.0:443
[2024-03-21 21:35:16] [WARN] got signal: 2
[2024-03-21 21:35:16] [WARN] trojan service stopped
[2024-03-21 21:35:42] [WARN] trojan service (server) started at 0.0.0.0:443
[2024-03-21 21:35:51] [WARN] got signal: 2
[2024-03-21 21:35:51] [WARN] trojan service stopped
[2024-03-21 21:36:00] [WARN] trojan service (server) started at 0.0.0.0:443
[2024-03-21 21:36:01] [WARN] got signal: 2
[2024-03-21 21:36:01] [WARN] trojan service stopped

Im not sure that I edit my config.json correctly.
This is my config.json:

{
    "run_type": "server",
    "local_addr": "0.0.0.0",
    "local_port": 443,
    "remote_addr": "127.0.0.1",
    "remote_port": 443,
    "password": [
        "mypassword"
    ],
    "log_level": 1,
    "ssl": {
        "cert": "/etc/letsencrypt/fullchain.pem",
        "key": "/etc/letsencrypt/privkey.pem",
        "key_password": "",
        "cipher": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
        "cipher_tls13": "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
        "prefer_server_cipher": true,
        "alpn": [
            "http/1.1",
            "h2"
        ],
        "alpn_port_override": {
            "h2": 81
        },
        "reuse_session": true,
        "session_ticket": false,
        "session_timeout": 600,
        "plain_http_response": "",
        "curves": "",
        "dhparam": ""
    },
    "tcp": {
        "prefer_ipv4": false,
        "no_delay": true,
        "keep_alive": true,
        "reuse_port": false,
        "fast_open": false,
        "fast_open_qlen": 20
    },
    "mysql": {
        "enabled": false,
        "server_addr": "127.0.0.1",
        "server_port": 3306,
        "database": "trojan",
        "username": "trojan",
        "password": "",
        "key": "",
        "cert": "",
        "ca": ""
    }
}

In fact I havent setup mysql yet, but it doesn't related to mysql.

It should start successfully.

@cm-xcju
Copy link

cm-xcju commented Jul 21, 2024

I have the same problem

@tzr0125
Copy link
Author

tzr0125 commented Jul 22, 2024

I have the same problem

I know why and I’m embarrassed. This error code means that I use ctrl+c. Try to check whether the remote port is accessible, whether port 443 is in use (if it is an HTTP service), and whether the certificate file location is correctly specified.

bobbykubesus referenced this issue Aug 1, 2024
* Add two-way authentication.

* Update authenticator.cpp

* Apply suggestions from code review

* Update src/core/authenticator.cpp

Co-authored-by: GreaterFire <32649575+GreaterFire@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants