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

After close the SSH connection, the clash service will automatically close #23

Closed
LeeSpo opened this issue Jan 12, 2023 · 10 comments
Closed
Labels
bug Something isn't working

Comments

@LeeSpo
Copy link

LeeSpo commented Jan 12, 2023

I use this on RaspPie 3 (OS: RHEL Branch), which severs as a proxy server.
Following the instructions and setting up, all things run smoothly as expected.
However, after closing the SSH connection, the service automatically turns to loaded status.
Manually re-login and executiveing the clashrup start , it starts working. Closing the SSH connection, it downs again.
I'm wondering how to fix that.
BTW, how to enable clashrup start when the system boots? I've tried systemctl enable clash but it returned clash.service not found.
Thanks 😵‍💫

@spencerwooo spencerwooo added the bug Something isn't working label Jan 12, 2023
@spencerwooo
Copy link
Owner

However, after closing the SSH connection, the service automatically turns to loaded status.

Yes, because you (as the user who created the systemd service) logged out, which will automatically stop all user-created systemd services. You would need to invoke clashrup as a sudo user, with some locations changed (in clashrup.toml):

clash_binary_path = "/usr/local/bin/clash"
clash_config_root = "/etc/clash/"
user_systemd_root = "/etc/systemd/system/"

Additionally, all systemctl commands are hard-coded as user actions currently (with --user), so options like start, status, log, etc., will no longer work under sudo mode. You need to manually call these commands (as in sudo systemctl status clash).

@spencerwooo
Copy link
Owner

BTW, how to enable clashrup start when the system boots?

After creating the systemd service as root, the service should start on boot.

@spencerwooo
Copy link
Owner

Again, clashrup is not designed to be used as root currently, so all operations I mentioned above may or may not work :(

@LeeSpo
Copy link
Author

LeeSpo commented Jan 13, 2023

Again, clashrup is not designed to be used as root currently, so all operations I mentioned above may or may not work :(

I tried to setup clashrup using sudo -i
It returned:
Failed to connect to bus: No such file or directory

@LeeSpo
Copy link
Author

LeeSpo commented Jan 13, 2023

Yes, because you (as the user who created the systemd service) logged out, which will automatically stop all user-created systemd services. You would need to invoke clashrup as a sudo user, with some locations changed (in clashrup.toml):

But that's weird.
I installed it twice because I re-installed the OS for some reason.
The first time, it worked, no existing after closing SSH. It works perfectly.
The second time, doing the same process, it exited. 😨

Sorry for my poor English.

@spencerwooo
Copy link
Owner

spencerwooo commented Jan 13, 2023

Just published a new version which modifies the systemd file to use default.target instead of the original multi-user.target. After some investigation, I think the best option would be to:

@LeeSpo
Copy link
Author

LeeSpo commented Jan 13, 2023

image
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/utils.rs:103:47
Another bug occured after fixing a bug 🤣

@spencerwooo
Copy link
Owner

lol, you need to change your settings back remember? (Config file ~/.config/clashrup.toml)

@spencerwooo
Copy link
Owner

spencerwooo commented Jan 14, 2023

... which modifies the systemd file to use default.target instead of the original multi-user.target

I found that after this modification, even without loginctl enable-linger {username}, my clash systemd service was not stopped after logging out. I wonder if that is the case on your side? @LeeSpo

Closing this issue for now as I believe this is fixed. If not, feel free to reopen.

@LeeSpo
Copy link
Author

LeeSpo commented Jan 15, 2023

I found that after this modification, even without loginctl enable-linger {username}, my clash systemd service was not stopped after logging out.

The same on my side and I think it's perfectly solved. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants