trojan-gfw / trojan

An unidentifiable mechanism that helps you bypass GFW.

Home Page:https://trojan-gfw.github.io/trojan/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tzr0125 opened this issue · comments

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.