Page 1 of 1
Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 10:24 am
by andyprough
Problem: anydesk [remote desktop software] always autostarts with the system. This is highly undesirable in some cases (although it is desirable in others).
Dilemma: Instructions are widely available online on how to disable anydesk autostart on systemd distros and on Mac and Windows machines, but not for sysvinit. The systemd instructions do not work on sysvinit, nor do the Mac or Windows instructions.
Solution:
The only solution I've been able to figure out that works is to delete the "S03anydesk" file from runlevels 2 through 5:
/etc/rc2.d/S03anydesk
/etc/rc3.d/S03anydesk
/etc/rc4.d/S03anydesk
/etc/rc5.d/S03anydesk
UPDATE - per advice from @dolphin_oracle, here is the best solution:
1. Edit /etc/init.d/anydesk with editor of choice to remove runlevels from the headers for the Default-Start line. Change from:
Code: Select all
### BEGIN INIT INFO
# Provides: anydesk
# Required-Start: $dbus udev networking
# Required-Stop: $dbus udev networking
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: AnyDesk global service
# Description: AnyDesk global service
### END INIT INFO
Change to the following, deleting runlevels 2, 3, 4 and 5 from Default-Start:
Code: Select all
### BEGIN INIT INFO
# Provides: anydesk
# Required-Start: $dbus udev networking
# Required-Stop: $dbus udev networking
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: AnyDesk global service
# Description: AnyDesk global service
### END INIT INFO
2. Save, close the editor, and run the following commands:
Code: Select all
sudo update-rc.d anydesk remove
sudo update-rc.d anydesk defaults
This removes the instructions for the anydesk service to be started with runlevels 2,3,4,5. After this change and rebooting, anydesk no longer autostarts, but the anydesk service still starts and runs fine when manually starting from the XFCE menu.
Issue: [UPDATE - Issue resolved, no longer a concern]
Not sure if this will cause any damage to the system, as I'm not very knowledgeable about sysvinit runlevel scripts. I may be doing something wildly wrong here, but just wanted to start the conversation. Please jump in and tell me if this is incorrect procedure or likely to cause damage to the system.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 6:49 pm
by JayM
Can't you run
and disable the anydesk service without removing those files?
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 7:03 pm
by dolphin_oracle
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 7:49 pm
by andyprough
Looks like you're removing anydesk scripts from all runlevels? I think I still need to leave the halt scripts in runlevels 0, 1, and 6. But maybe I'm wrong.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 7:56 pm
by andyprough
JayM wrote: ↑Thu Dec 03, 2020 6:49 pm
Can't you run
and disable the anydesk service without removing those files?
I thought about that and looked at it, but was wondering if I might somehow ruin anydesk's functionality if I remove the service altogether. As I said though, this is an area where I don't have much experience. Right now it is working exactly as needed with those above changes. I'm just wondering if I'm doing anything harmful to the system by deleting the scripts.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 8:11 pm
by JayM
basically you don't want it to always run as a service but only start on demand when the user tells it to, correct? You could stop (but not uninstall or delete the files for) its service then start it on demand with a command-line sitch to start its service, then stop the service when you're through with another command-line switch. These could be done through shell scripts or launchers. See
https://support.anydesk.com/Command_Line_Interface
So,
to start the service and
to stop it again.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 8:51 pm
by dolphin_oracle
I suppose you could change the headers in the script to match whatever runlevels you want, then
Code: Select all
sudo update-rc.d anydesk remove
sudo update-rc.d anydesk defaults
which defaults would be whatever runlevels you choose.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Dec 03, 2020 9:49 pm
by andyprough
dolphin_oracle wrote: ↑Thu Dec 03, 2020 8:51 pm
I suppose you could change the headers in the script to match whatever runlevels you want, then
Code: Select all
sudo update-rc.d anydesk remove
sudo update-rc.d anydesk defaults
which defaults would be whatever runlevels you choose.
Oh that is perfect! You are right, when I delete runlevels from the script header and run the update-rc.d commands, it removes the startup scripts and retains the halt scripts in the appropriate runlevels. And now there should be no confusion for the init system because of a mismatch between headers and placement of scripts. Excellent, thank you.
Re: Disabling anydesk autostart on sysvinit
Posted: Tue Sep 14, 2021 1:07 am
by kevtardis
Greetings!
This is just what I'm looking for, but I'm unclear as to what needs to be done.
Do I just create an executable script that runs on startup containing the two update-rc.d commands?
Or am I supposed to make the edits to /etc/init.d/anydesk listed in the first post, and then create an executable script that runs on startup containing the two update-rc.d commands?
Or something else? Please excuse my confusion, but I'd hate to make things worse by making some bad assumptions. Thanks.
Re: Disabling anydesk autostart on sysvinit
Posted: Tue Sep 14, 2021 5:11 am
by fehlix
The solution to disable "autostart" of anydesk as system service and autostart on user level was given here:
viewtopic.php?p=577730#p577730
as:
AnyDesk service:
Autostart:
Code: Select all
printf "[Desktop Entry]\nHidden=true\n" > ~/.config/autostart/anydesk_global_tray.desktop
There is no need to have an init-script for shutdown/reboot runlevels left enabled, if system level service have not been started in the first place.
Re: Disabling anydesk autostart on sysvinit
Posted: Tue Sep 14, 2021 9:58 am
by kevtardis
Perfect - that did it.
Thanks andyprough!
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 10:44 am
by quantumalchemy
On ..
update-rc.d anydesk disable
I Get ->
insserv: warning: current start runlevel(s) (empty) of script `anydesk' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `anydesk' overrides LSB defaults (0 1 6).
Failed to disable unit, unit anydesk.service does not exist
this thing (anydesk) is Crazy!
lots of solutions none work .. running on latest ver of mx (4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux
using - anydesk - install / repo info here:
http://deb.anydesk.com/howto.html?_ga=2 ... 1632166372
And No way of stopping this thing..
anydesk --stop-service - No go
service anydesk stop - No go
service anydesk status shows (-) not running but:
anydesk --get-status - shows "online"
** Only way to stop this thing is to -->
pkill -f "anydesk"
kill -9 #
Then it Hangs when you try and restart with --> anydesk --service
** I also gave the appimage a go for host and client (thinking what the hell .. sounded like a good idea)
works on my MX laptop
But not on MX (same ver) and same hardware on remote host --> complains about missing libraries .. YeeeeSH!
Anyone have a clue on a real working solution?
Thanks!
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 11:43 am
by fehlix
quantumalchemy wrote: ↑Thu Sep 23, 2021 10:44 am
Anyone have a clue on a real working solution?
The solution was already provided within this thread.
Now here an update:
How to install and disable andesk startup service in MX Linux.
Installing the downloaded deb from anydesk directly did not work in the past, so we added some tweaks to make installation and uninstall work in MX Linux.
Installation:
Open MX Package Installer (MXPI), type into search field anydesk, mark anydesk for installation and click install.
Disable startup servcice:
With booted sys-V-init do just this:
The removal of an autostart entry within session and startup, as shown in my last post, seems not be needed anymore, b/c anydesk when start as service, will now initiate the user/session startup through dbus.
For any detailed question, one would accept posting "QSI" (Quick System Info)
HTH
+++EDIT+++: adjusted some typos...
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 12:15 pm
by quantumalchemy
Thanks for the info on mx-packageinstaller tweeks so it will run
seems to be a catch 22 .. cant ssh and run mx-packageinstaller (errors)
-- anyway to install a package using mx-packageinstaller (repo) via ssh ?
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 12:22 pm
by fehlix
quantumalchemy wrote: ↑Thu Sep 23, 2021 12:15 pm
Thanks for the info on mx-packageinstaller tweeks so it will run
seems to be a catch 22 .. cant ssh and run mx-packageinstaller (errors)
-- anyway to install a package using mx-packageinstaller (repo) via ssh ?
if ssh is just terminal, not sure whether a terminal only install with mx-packageinstaller is prepared.
But assume a proper ssh-tunneled x-session would do, at least I don't see a reason why not.
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 12:39 pm
by quantumalchemy
using ssh -X (ssh-tunneled x-session)
command shown in mx >>
su-to-root -X -c mx-packageinstaller
==== AUTHENTICATING FOR org.mxlinux.mx-pkexec ===
Authentication is required to run this application
Authenticating as: root
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
This incident has been reported.
jec@jec:~
TRY 2
[sudo] password for user:
X11 connection rejected because of wrong authentication.
qt.qpa.screen: QXcbConnection: Could not connect to display localhost:10.0
Could not connect to any X display.
TRY 3 >> just ->
$ mx-packageinstaller
==== AUTHENTICATING FOR org.mxlinux.mx-pkexec ===
Authentication is required to run this application
Authenticating as: root
Password: (pw for root)
$
** (process:12206): ERROR **: 12:33:04.220: Got unexpected EOF while reading from controlling terminal.
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
/usr/bin/mx-pkexec: line 73: 12206 Trace/breakpoint trap pkexec /usr/bin/mx-pkexec "${@}"
-bash: oot: command not found
not looking good .. seems you need to be using the gui only to access?
Re: Disabling anydesk autostart on sysvinit
Posted: Thu Sep 23, 2021 1:19 pm
by fehlix
quantumalchemy wrote: ↑Thu Sep 23, 2021 12:39 pm
using ssh -X (ssh-tunneled x-session)
command shown in mx >>
su-to-root -X -c mx-packageinstaller
==== AUTHENTICATING FOR org.mxlinux.mx-pkexec ===
Authentication is required to run this application
Authenticating as: root
Password:
polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
==== AUTHENTICATION FAILED ===
Error executing command as another user: Not authorized
This incident has been reported.
jec@jec:~
TRY 2
[sudo] password for user:
X11 connection rejected because of wrong authentication.
qt.qpa.screen: QXcbConnection: Could not connect to display localhost:10.0
Could not connect to any X display.
TRY 3 >> just ->
$ mx-packageinstaller
==== AUTHENTICATING FOR org.mxlinux.mx-pkexec ===
Authentication is required to run this application
Authenticating as: root
Password: (pw for root)
$
** (process:12206): ERROR **: 12:33:04.220: Got unexpected EOF while reading from controlling terminal.
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
/usr/bin/mx-pkexec: line 73: 12206 Trace/breakpoint trap pkexec /usr/bin/mx-pkexec "${@}"
-bash: oot: command not found
not looking good .. seems you need to be using the gui only to access?
Gui only was tested. ssh-tunneled X-session probably something to look into.
Re: Disabling anydesk autostart on sysvinit
Posted: Sat Oct 30, 2021 9:12 am
by yyy
fehlix wrote: ↑Thu Sep 23, 2021 11:43 am
Disable startup servcice:
With booted sys-V-init do just this:
The removal of an autostart entry within session and startup, as shown in my last post, seems not be needed anymore, b/c anydesk when start as service, will now initiate the user/session startup through dbus.
Does this work in MX 21 KDE? Because I get the error:
"insserv: warning: could not find all dependencies for $dbus"
Re: Disabling anydesk autostart on sysvinit
Posted: Sat Oct 30, 2021 3:46 pm
by fehlix
yyy wrote: ↑Sat Oct 30, 2021 9:12 am
Does this work in MX 21 KDE? Because I get the error:
"insserv: warning: could not find all dependencies for $dbus"
Seems those warnings do not have any other implications.
The reason seems to be within the provided init-script of anydesk package as they use a not defined facility name "$dbus" instead of "dbus".
You can manually fix it this way:
Code: Select all
sudo sed -i '/^# Required-St/s:$dbus:dbus:' /etc/init.d/anydesk
Not sure it's worth to fix the provided anydesk deb-package,
as warnings are kind of "info for the package developer to fix something" - means for normal user: to be ignored.

Re: Disabling anydesk autostart on sysvinit
Posted: Sun Oct 31, 2021 1:21 am
by yyy
I see, thank you for the explanation. But anydesk keeps on autostarting on startup!
Re: Disabling anydesk autostart on sysvinit
Posted: Sun Oct 31, 2021 8:23 am
by fehlix
Update:
Disable / Enable anydesk startup
During installation with MX Package Installer some error/warning message show up,when installing anydesk.
The installation will proceed anyway
One reason for warnings is missing fix with the init-script provided.
Manually fix anydesk init script this way, to avoid further complains:
# fix anydesk init-script after installation
Code: Select all
sudo sed -i '/^# Required-St/s:$dbus:dbus:' $(readlink -e /etc/init.d/anydesk)
In order to avoid automatic starting of anydesk service:
Disable anydesk startup
* Disable startup of anydesk 'global' service
# SysV-init
Code: Select all
sudo update-rc.d -f anydesk remove
# systemd
* Disable startup of anydesk 'local' service - disable autostart
Code: Select all
printf '[Desktop Entry]\nHidden=true\n' | tee ~/.config/autostart/anydesk_global_tray.desktop
In order to re-enable automatic starting of anydesk service:
Enable anydesk startup
* Enable startup of anydesk 'global' service
# SysV-init
# systemd
* Check anydesk startup service is enabled
# SysV-init
anydesk 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# systemd
* Enable startup of anydesk 'local' service - enable autostart
Code: Select all
rm ~/.config/autostart/anydesk_global_tray.desktop
HTH

Re: Disabling anydesk autostart on sysvinit
Posted: Sun Oct 31, 2021 10:05 am
by yyy
I gave these 2 commands, as you wrote, and anydesk does not autostart anymore.
Code: Select all
sudo sed -i '/^# Required-St/s:$dbus:dbus:' $(readlink -e /etc/init.d/anydesk)
sudo update-rc.d -f anydesk remove
Before that, I was entering only the second one, and anydesk keeped on auto starting.
Thank you!
Re: Disabling anydesk autostart on sysvinit
Posted: Sun Oct 31, 2021 11:01 am
by fehlix
yyy wrote: ↑Sun Oct 31, 2021 10:05 am
I gave these 2 commands, as you wrote, and anydesk does not autostart anymore.
Code: Select all
sudo sed -i '/^# Required-St/s:$dbus:dbus:' $(readlink -e /etc/init.d/anydesk)
sudo update-rc.d -f anydesk remove
Before that, I was entering only the second one, and anydesk keeped on auto starting.
Thank you!
In my tests with a freshly installed MX-21 KDE, it was required in addtition to those to:
* Disable startup of anydesk 'local' service - disable autostart
Code: Select all
printf '[Desktop Entry]\nHidden=true\n' | tee ~/.config/autostart/anydesk_global_tray.desktop
in order to stop anydesk from startup. Testet when booted with both SysV-init and systemd.
Re: Disabling anydesk autostart on sysvinit
Posted: Wed Nov 03, 2021 11:28 am
by yyy
I am using MX 21 KDE as well. I may have given the command you refer to earlier, in order to fix the problem. I am not sure. Anyway, now it works as I want. Thank you for your help!
Re: Disabling anydesk autostart on sysvinit
Posted: Tue Nov 30, 2021 1:19 pm
by yyy
I tested again, in a fresh MX 21 Xfce install, and fehlix is right: all these 3 commands are required:
Code: Select all
sudo sed -i '/^# Required-St/s:$dbus:dbus:' $(readlink -e /etc/init.d/anydesk)
sudo update-rc.d -f anydesk remove
printf '[Desktop Entry]\nHidden=true\n' | tee ~/.config/autostart/anydesk_global_tray.desktop