Throne icon indicating copy to clipboard operation
Throne copied to clipboard

BUG: Tun Mode Setup Errors and Internet Loss on Exit

Open Hcode00 opened this issue 1 year ago • 42 comments

Describe the problem

When trying to use Tun mode, I get these errors:

Failed to run chown root:root /opt/Throne/Core code is 32512 Failed to run chmod u+s /opt/Throne/Core

Then I have to run these commands manually in the terminal using sudo.

But after that, I run into another issue that I don't know if it is related to the previous issue: when I exit the app while connected to a profile like vmess or trojan, the internet stops working in the whole system until I connect again, then stop the connection before exiting.

Expected behavior:

  1. The chown and chmod commands should run automatically without needing manual sudo input.
  2. The internet connection should work normally after exiting the app, whether connected to a profile or not, without needing to reconnect and disconnect to restore it.

Actual behavior:

  1. The chown and chmod commands fail, requiring manual sudo execution.
  2. The internet connection is completely lost system-wide after exiting the app if a profile was active before exiting, and only resumes after restarting the app, connecting to a profile, and then properly disconnecting before closing the app.

How to reproduce

Install the Throne application on an Arch Linux system.

Attempt to enable Tun mode within the application.

Observe the chown and chmod errors.

Manually run sudo chown root:root /opt/Throne/Core and sudo chmod u+s /opt/Throne/Core in the terminal.

Connect to a vmess or trojan profile using the application.

Exit the Throne application while still connected to the profile.

Observe that the system's internet connection is no longer working.

To restore internet, open the Throne application, connect to a profile, then disconnect from the profile, and then exit the application.

log

sing-box: v1.11.15 Core listening at 127.0.0.1:39275 Failed to run chown root:root /opt/Throne/Core code is 32512 Failed to run chmod u+s /opt/Throne/Core

Hcode00 avatar Jul 22 '25 12:07 Hcode00

I have similar problems from version 4.3.5 in Arch / Endeavouros systems. Connection via WiFi, the network disappears if you get out of the application when the profile is activated, I do not observe unnecessary processes in the dyspecher. The solution is still one, start Throne, turn off the profile and leave the program. I saw a message that the way out of the program was changed, it seems to me this reason. If you stop the core or program forcibly (Killall -9, Pkill -9, etc.), then the network disappears, apparently it is important to stop the profile before closing. I have long been using scripts without -9 options for quick exit, but now it’s not a job as well as a regular exit from the application. The latest working version is 4.3.5, it works well even if the core is changed to more new.

di1905 avatar Jul 22 '25 23:07 di1905

Clarification. Arch/Eos, xfce4, kernels 5.10 (with latest patches) or latest Zen kernel. NetworkManager + openresolv-3.17 (AWG works with it), but tried updating, nothing changes. Link to resolv.conf or resolv.conf file (tried in different ways). Other proxy programs including Sing-box kernel do not have such problems with Tun.

di1905 avatar Jul 22 '25 23:07 di1905

i also have this issue arch zen latest (6.15.7-zen) closing the app without either stopping profile or turning off Tun Mode completely disconnects the internet connection doesnt matter what interface im using. wifi, or android usb tether.

XSilverTH avatar Jul 23 '25 02:07 XSilverTH

For the sake of interest, I also checked on Win10 (also installed just in case). In a similar situation, on the latest build, the network does not drop, however, after re-enabling the application, Tun does not always turn on and very often after that, such errors appear (version Neko 4.3.5 works fine and there are no errors).

Image Image

di1905 avatar Jul 23 '25 05:07 di1905

Then I have to run these commands manually in the terminal using sudo.

It is most likely caused by you environment. Make sure pkexec is installed and apps can use it.

The exit bug is fixed in https://github.com/throneproj/Throne/actions/runs/16462546934, please try it and submit feedback.

Mahdi-zarei avatar Jul 23 '25 05:07 Mahdi-zarei

Dear developers, I bow low to you for the prompt fix. At first glance, everything works fine in Arch now, I'll check in Win10 later. Thank you and good luck to you!

di1905 avatar Jul 23 '25 10:07 di1905

In Endeavors and Win10 everything is fine too. As for pkexec, this package is not even in AUR and in five other repositories, I remember using it in Debian but it was a long time ago. In Arch I do everything via sudo, sudo dbus-launch.

Image Image

di1905 avatar Jul 23 '25 10:07 di1905

As for pkexec, this package is not even in AUR and in five other repositories, I remember using it in Debian but it was a long time ago.

It is not a package, it is part of polkit. It should be available on almost all properly configured linux desktops, it allows for asking to run an elevated command and asks for password through GUI. I suggest you diagnose this on your end as it is needed for automatic chown and chmod of the Core file.

Mahdi-zarei avatar Jul 23 '25 11:07 Mahdi-zarei

It's clear, I haven't changed anything in Arch settings for a long time, it works fine for several years. But I installed EndeavourOS relatively recently and I haven't changed anything in it and haven't deleted it as a backup. This tun error appeared on both systems, so I thought that this might happen to me. I transferred the settings from 4.3.5, everything is OK. The test was also registered and is now saved, I ran it and it seems that it works no worse than in the old version!

Image

di1905 avatar Jul 23 '25 12:07 di1905

Well, to be honest it is hard to find the root cause, and I'm almost sure there isn't much that can be done on my end, so I suggest you run the chmod and chown yourself. It shouldn't be a bother since you only need to run it once per version.

Mahdi-zarei avatar Jul 23 '25 12:07 Mahdi-zarei

polkit was installed in the system, in any case, thanks for the recommendation, I'll read it in my spare time, I'm not very advanced in this.

Image

di1905 avatar Jul 23 '25 12:07 di1905

If that's what you're talking about, then of course I tried it, although in Thunar it was usually enough to check the box

sudo chmod +x ~/Throne/Throne sudo chmod +x ~/Throne/Core

Image

di1905 avatar Jul 23 '25 12:07 di1905

sudo chmod +x ~/Throne/Throne sudo chmod +x ~/Throne/Core

No not this. The core needs to be run as root, the App itself should not run as root as setting system proxy will break if you are root. So I am giving the Core SUID and own it to root, so that it runs as root by default and can manage Tun interfaces freely.

Mahdi-zarei avatar Jul 23 '25 12:07 Mahdi-zarei

Sorry, I mixed up the commands in a hurry, probably it would be more correct like this:

sudo chown -R v ~/Throne/Throne sudo chmod +x ~/Throne/Core

But in any case, I noticed that periodically, after exiting the program via the exit button, sometimes the application cannot complete its work correctly, although the core stops and you have to force it to stop manually, the network does not disappear anymore and this is the main thing, how often and why this happens is still unclear, in the same version 4.3.5 I did not observe this until I returned to it, in the end there is a fully working sing-box (but this is not the same at all).

Image Image Image Image

di1905 avatar Jul 23 '25 14:07 di1905

Thank you for addressing the connection loss on exit issue; it is now resolved.

Well, to be honest it is hard to find the root cause

I think it's a potential interaction with Polkit agent spawning issue, as functionality in this area previously worked as expected. I've attempted using both kde polkit agent and hyprpolkitagent, but neither appears to be launching.

Hcode00 avatar Jul 23 '25 16:07 Hcode00

Hello dear developer! Today I continued testing the Throne 1.0.0-beta.4 build in Arch, xfce4, zen. I moved the folder to /opt/Throne/ for the sake of purity of the experiment ($PATH) and executed: sudo chown root:root /opt/Throne/Core sudo chmod u+s /opt/Throne/Core

I also tried different options for Throne (although this is not required): sudo chown v:v /opt/Throne/Throne sudo chmod +x /opt/Throne/Throne sudo chown v:v /opt/Throne/Throne sudo chmod u+s /opt/Throne/Throne

In fact, you don't need to do anything manually for the kernel because after replacing the files, your script works without errors (the rights change).

All this in different combinations did not help me get rid of the problem when after pressing the "Exit" button periodically (not always) the "Throne" program itself cannot complete its work and remains in the processes.

I also tried to stop the kernel before closing the application without the "-9" option, this may solve the problem of the "Throne" zombie process after exiting, but it also leads to network loss (as before the fix) - Not an option.

I even tried to lower and even delete the interface before and after exiting: sudo ip link set dev throne-tun down sudo ip address flush throne-tun sudo ip link delete throne-tun

This is for fun, because there are no problems with the interface (it is missing after stopping the kernel); sudo ip -br -c addr show

Perhaps this problem is only present in me (ancient hardware, etc.), but I will not stop praising the 4.3.5 build, which works from the home directory, is located nearby and has no problems with the Tun mode, which I use constantly + simple routing. Good luck to you!

Image

di1905 avatar Jul 24 '25 03:07 di1905

So do you mean that 4.3.5 works but 4.3.7 does not? I thought it is might be specific to throne.

Mahdi-zarei avatar Jul 24 '25 04:07 Mahdi-zarei

That's exactly what happens, I tested all builds (including the original). It's interesting that if you replace the kernel from build 4.3.7 in your 4.3.5 build, everything works fine, but not 4.3.6 and above separately. Today I tried to rename the kernel from Throne and put it in 4.3.5, but it didn't work. It's understandable, I'm testing beta sing-box in parallel and there are changes there. I don't understand anything about development (I'm just messing around). Under Linux, I haven't found any more convenient alternative for myself than your program, so I'm watchi

di1905 avatar Jul 24 '25 08:07 di1905

It really is odd... There is only one change that MAY have caused this. Can you try this build? https://github.com/throneproj/Throne/actions/runs/16492827378

Mahdi-zarei avatar Jul 24 '25 09:07 Mahdi-zarei

4.3.5 - works fine in tun mode (no problems) 4.3.6 - Throne 1.0.0-beta.3 - no network after exiting the program Throne 1.0.0-beta.4 - there is a network, but after exiting, Throne sometimes does not complete its work and hangs in processes

di1905 avatar Jul 24 '25 09:07 di1905