v2ray-core
v2ray-core copied to clipboard
V2ray 5.1.0 unable to run as a systemd service
What version of V2Ray are you using?
5.1.0
What's your scenario of using V2Ray?
I have installed a new server, and the script automatically installed v 5.1.0, unable to run v2ray as a service on Debian 10 Server.
What problems have you encountered?
Starting v2ray as a service exits with (code=exited, status=2). Full error is the following
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
The problem is ExecStart. If I run the line /usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json
in terminal directly I get the following output:
flag provided but not defined: -config Usage of /usr/local/bin/v2ray:
However if I run this /usr/local/bin/v2ray run -c /usr/local/etc/v2ray/config.json
then v2ray will run.
So I edited as root /etc/systemd/system/v2ray.service and changed the file to have the following line
ExecStart=/usr/local/bin/v2ray run -c /usr/local/etc/v2ray/config.json
I then ran the following
systemctl daemon-reload && systemctl restart v2ray
However when I run systemctl status v2ray
I get the following output:
● v2ray.service - V2Ray Service
Loaded: loaded (/etc/systemd/system/v2ray.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/v2ray.service.d
└─10-donot_touch_single_conf.conf
Active: failed (Result: exit-code) since Thu 2022-09-08 02:38:45 UTC; 11min ago
Docs: https://www.v2fly.org/
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Main PID: 1173 (code=exited, status=2)
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Main process exited, code=exited, status=2/INVALIDARGUM
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Failed with result 'exit-code'.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Service RestartSec=100ms expired, scheduling restart.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Scheduled restart job, restart counter is at 5.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: Stopped V2Ray Service.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Start request repeated too quickly.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: v2ray.service: Failed with result 'exit-code'.
Sep 08 02:38:45 ONEVPS220908004518 systemd[1]: Failed to start V2Ray Service.
Please note that it is defaulting back to ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json
and not accepting my edited ExecStart=/usr/local/bin/v2ray run -c /usr/local/etc/v2ray/config.json
What's your expectation?
v2ray should run as a service on the server, however unable to as ExeStart is defaulting back to a faulty launch command.
Please attach your configuration here
{ "inbounds": [{ "sniffing": { "enabled": true, "destOverride": [ "http", "tls" ] }, "port": 8388, "listen": "127.0.0.1", "protocol": "vmess", "settings": { "clients": [ { "id": "4a4a022b-a073-4094-899a-ca04a5c232cd", "level": 1, "alterId": 0, "security": "auto" } ] }, "streamSettings": { "network": "ws", "wsSettings": { "path": "/websocket/" } } }], "outbounds": [{ "protocol": "freedom", "settings": {} },{ "protocol": "blackhole", "settings": {}, "tag": "blocked" }], "routing": { "domainStrategy": "AsIs", "rules": [ { "type": "field", "ip": ["geoip:private", "geoip:cn"], "outboundTag": "block", "protocol": ["bittorrent"] } ] } }
If V2Ray cannot start up, please attach output from --test
command
flag provided but not defined: -config Usage of /usr/local/bin/v2ray:
https://github.com/v2fly/fhs-install-v2ray/issues/243
Thank you, I rolled back to v4.45.0 with the command
bash install-release.sh --version v4.45.0
In your output: Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Your systemd unit is still using a wrong command. You should use v2ray run -config
, not v2ray -config
处理方式1: rm -rf /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf systemctl daemon-reload systemctl restart v2ray 处理方式2: vi /etc/systemd/system/v2ray.service.d/10-donot_touch_single_conf.conf 把ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json 改为ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json systemctl daemon-reload systemctl restart v2ray 处理方式3: 切回老版本: bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --version v4.45.2 就好啦
Don't see any benefit of adding a 'run' to break the software, do not like breaking updates.
In your output:
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Your systemd unit is still using a wrong command. You should use
v2ray run -config
, notv2ray -config
In your output:
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Your systemd unit is still using a wrong command. You should use
v2ray run -config
, notv2ray -config
The issue is this was a fresh install. It's not working out the box. I understand that I can edit files to get it working. The problem is it's not working on a fresh install. Editing files shouldn't be necessary on a new install just to get it to work.
I don't see anything wrong of the systemd script in the repo, it uses v2ray run -config
, which was actually fixed 8 months ago. Download any package for Linux from the release page and you can find it out.
This is the repo for the v2ray itself, not for installation script or third party packages. Nothing here in this repo can install or configure the software for you, instead, it only provides all the necessary files (including the correct systemd script) for you to install. So it's an issue of the installation script you uses, not v2ray.
Also, there is nothing wrong to introduce break changes in a major version update, on the contrary, that's exactly what's a major version update for.
I don't see anything wrong of the systemd script in the repo, it uses
v2ray run -config
, which was actually fixed 8 months ago. Download any package for Linux from the release page and you can find it out.This is the repo for the v2ray itself, not for installation script or third party packages. Nothing here in this repo can install or configure the software for you, instead, it only provides all the necessary files (including the correct systemd script) for you to install. So it's an issue of the installation script you uses, not v2ray.
Also, there is nothing wrong to introduce break changes in a major version update, on the contrary, that's exactly what's a major version update for.
Well I installed from the script install-release.sh downloaded from the v2fly GitHub. I followed official documentation for install and this is the result of how it was setup.
Me too, I used install-release.sh to do the updating, and it's just broken and cannot work any more, until reverted to an old version.
Well I installed from the script install-release.sh downloaded from the v2fly GitHub. I followed official documentation for install and this is the result of how it was setup.
To me, the most important point to a software is backward compatibility, a good one does its job silently, without causing trouble to its users. A good software will first say that a certain feature is deprecated, please use xxx, and it will be removed in the future version, instead of suddenly making a destructive update.
In your output:
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Your systemd unit is still using a wrong command. You should usev2ray run -config
, notv2ray -config
The issue is this was a fresh install. It's not working out the box. I understand that I can edit files to get it working. The problem is it's not working on a fresh install. Editing files shouldn't be necessary on a new install just to get it to work.
I don't use the install-release.sh
so I didn't got why you have an wrong command at first.
Now I wonder why the install-release.sh
write a systemd script itself instead of using the offical one.
In your output:
Process: 1173 ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json (code=exited, status=2)
Your systemd unit is still using a wrong command. You should usev2ray run -config
, notv2ray -config
The issue is this was a fresh install. It's not working out the box. I understand that I can edit files to get it working. The problem is it's not working on a fresh install. Editing files shouldn't be necessary on a new install just to get it to work.
I don't use the
install-release.sh
so I didn't got why you have an wrong command at first.Now I wonder why the
install-release.sh
write a systemd script itself instead of using the offical one.
Install-release.sh is the official script from the v2fly documentation to install v2ray. So the issue appears to be in the script.
Well I installed from the script install-release.sh downloaded from the v2fly GitHub. I followed official documentation for install and this is the result of how it was setup.
Exactly, this is not the repo for the script, you got an error because of an install script, it's better to report the issue to the script instead.
To me, the most important point to a software is backward compatibility, a good one does its job silently, without causing trouble to its users. A good software will first say that a certain feature is deprecated, please use xxx, and it will be removed in the future version, instead of suddenly making a destructive update.
- The only reason this release affects you is that you uses
install-release.sh
and it has not been updated accordingly, not because v2ray-core introduces break changes. - Even if this command change causes troubles to you directly, it's supposed to do so because this is the first Preview release of v5.
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days
Hi, I just had the same exit-code
error problem.
You can get more detailed information about the error by the command journalctl -u v2ray
(scroll down to the end!).
In my case, it told me the error happened because v2ray
couldn't initial the access.log
file, so I deleted that file and this time systemctl start v2ray
worked properly.
Your problem may be different, but the journalctl
was the place I didn't check for two hours of debugging this problem. And it seems like systemctl status v2ray
is not providing much information about the error.
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days
删除 /etc/systemd/system v2ray.service 中的 AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 这一行 大部分是这个原因造成的
如果还不行 journalctl -u v2ray 空格向下滚动查看更多错误信息