Disabling anydesk autostart on sysvinit

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
andyprough
MX Packager
Posts: 918
Joined: Tue Jul 23, 2019 10:16 pm

Disabling anydesk autostart on sysvinit

#1 Post 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.
Last edited by andyprough on Fri Dec 04, 2020 10:05 am, edited 1 time in total.
Primary Computer - Commodore 64: Processor - MOS 6510/8500, 1.023MHz; Memory - 64kb RAM, 20kB ROM - 8k BASIC V2, 8k Kernel, 4k Character ROM; Display output - 320x200, 16 colours; OS - BASIC V2.0; Weight: 1.8kg

User avatar
JayM
Posts: 6796
Joined: Tue Jan 08, 2019 3:47 am

Re: Disabling anydesk autostart on sysvinit

#2 Post by JayM »

Can't you run

Code: Select all

sudo sysv-rc-conf
and disable the anydesk service without removing those files?
Please read the Forum Rules, How To Ask For Help, How to Break Your System and Don't Break Debian. Always include your full Quick System Info (QSI) with each and every new help request.

User avatar
dolphin_oracle
Developer
Posts: 22051
Joined: Sun Dec 16, 2007 12:17 pm

Re: Disabling anydesk autostart on sysvinit

#3 Post by dolphin_oracle »

Code: Select all

sudo update-rc.d anydesk remove
will work.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
andyprough
MX Packager
Posts: 918
Joined: Tue Jul 23, 2019 10:16 pm

Re: Disabling anydesk autostart on sysvinit

#4 Post by andyprough »

dolphin_oracle wrote: Thu Dec 03, 2020 7:03 pm

Code: Select all

sudo update-rc.d anydesk remove
will work.
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.
Last edited by andyprough on Thu Dec 03, 2020 7:59 pm, edited 1 time in total.
Primary Computer - Commodore 64: Processor - MOS 6510/8500, 1.023MHz; Memory - 64kb RAM, 20kB ROM - 8k BASIC V2, 8k Kernel, 4k Character ROM; Display output - 320x200, 16 colours; OS - BASIC V2.0; Weight: 1.8kg

User avatar
andyprough
MX Packager
Posts: 918
Joined: Tue Jul 23, 2019 10:16 pm

Re: Disabling anydesk autostart on sysvinit

#5 Post by andyprough »

JayM wrote: Thu Dec 03, 2020 6:49 pm Can't you run

Code: Select all

sudo sysv-rc-conf
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.
Primary Computer - Commodore 64: Processor - MOS 6510/8500, 1.023MHz; Memory - 64kb RAM, 20kB ROM - 8k BASIC V2, 8k Kernel, 4k Character ROM; Display output - 320x200, 16 colours; OS - BASIC V2.0; Weight: 1.8kg

User avatar
JayM
Posts: 6796
Joined: Tue Jan 08, 2019 3:47 am

Re: Disabling anydesk autostart on sysvinit

#6 Post 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,

Code: Select all

anydesk --service
to start the service and

Code: Select all

anydesk --stop-service
to stop it again.
Last edited by JayM on Thu Dec 03, 2020 8:58 pm, edited 2 times in total.
Please read the Forum Rules, How To Ask For Help, How to Break Your System and Don't Break Debian. Always include your full Quick System Info (QSI) with each and every new help request.

User avatar
dolphin_oracle
Developer
Posts: 22051
Joined: Sun Dec 16, 2007 12:17 pm

Re: Disabling anydesk autostart on sysvinit

#7 Post 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.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
andyprough
MX Packager
Posts: 918
Joined: Tue Jul 23, 2019 10:16 pm

Re: Disabling anydesk autostart on sysvinit

#8 Post 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.
Primary Computer - Commodore 64: Processor - MOS 6510/8500, 1.023MHz; Memory - 64kb RAM, 20kB ROM - 8k BASIC V2, 8k Kernel, 4k Character ROM; Display output - 320x200, 16 colours; OS - BASIC V2.0; Weight: 1.8kg

kevtardis
Posts: 14
Joined: Thu Jun 07, 2018 3:26 pm

Re: Disabling anydesk autostart on sysvinit

#9 Post 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.

User avatar
fehlix
Developer
Posts: 12613
Joined: Wed Apr 11, 2018 5:09 pm

Re: Disabling anydesk autostart on sysvinit

#10 Post 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:

Code: Select all

sudo update-rc.d anydesk remove
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.

Post Reply

Return to “Tips & Tricks by users”