because anydesk does not finish updating correctly?

This is the content of the file, any suggestions?

#!/bin/bash

set -e

command_exists()
{
        command -v "$1" > /dev/null 2>&1
}

if [ "$1" = configure ]; then

        INITSYS=$(ls -al /proc/1/exe | awk -F' ' '{print $NF}' | awk -F'/' '{print $NF}')

        if [ "systemd" == "$INITSYS" ]; then
                if [ -e /etc/systemd/system/anydesk.service ]; then
                        rm /etc/systemd/system/anydesk.service
                fi
                cp /usr/share/anydesk/files/systemd/anydesk.service /etc/systemd/system/anydesk.service
                systemctl daemon-reload
                deb-systemd-invoke enable anydesk
                deb-systemd-invoke start anydesk
        elif [ "init" == "$INITSYS" ]; then
                if [ -e /etc/init.d/anydesk ]; then
                        rm /etc/init.d/anydesk
                fi
                chmod +x /usr/share/anydesk/files/init/anydesk
                ln -s /usr/share/anydesk/files/init/anydesk /etc/init.d/anydesk
                update-rc.d anydesk defaults
                invoke-rc.d anydesk start
        fi

        command_exists update-menus && update-menus
        command_exists update-desktop-database && update-desktop-database
        command_exists xdg-desktop-menu && xdg-desktop-menu forceupdate
fi

I guess the idea was to run it manually to see where it fails

/var/lib/dpkg/info/anydesk.postinst

Both, now that we know the script we can interpret its output better.

Hi

I have manually executed the commands that appear in the script and it accepts them but the error persists

When you execute the script as a whole, does it not throw any helpful error message?

No, not error

root@DietPi:~# /var/lib/dpkg/info/anydesk.postinst
root@DietPi:~#

Ah sorry, it requires an argument:

/var/lib/dpkg/info/anydesk.postinst configure

Nothing, not error

root@DietPi:~# /var/lib/dpkg/info/anydesk.postinst configure
Synchronizing state of anydesk.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable anydesk
root@DietPi:~#

Can you check the exit code:

/var/lib/dpkg/info/anydesk.postinst configure
echo $?

Actually I think I know where the issue is:

        command_exists update-menus && update-menus
        command_exists update-desktop-database && update-desktop-database
        command_exists xdg-desktop-menu && xdg-desktop-menu forceupdate

This means, if any of those commands does not exist, the scripts exits with an error code, as the last check returned a “false”. It’s a bug in the postinst script.

To verify:

command -v update-menus
command -v update-desktop-database
command -v xdg-desktop-menu

If any of those does not print a command path back, that’s the reason why the script fails (silently).

I cannot find a package source repository of AnyDesk, otherwise we could fix that for them by changing the lines into this:

        ! command_exists update-menus || update-menus
        ! command_exists update-desktop-database || update-desktop-database
        ! command_exists xdg-desktop-menu || xdg-desktop-menu forceupdate

By this, the last returned check is “true”, if the command does not exist, so the script only fails if running the actual command fails, which is intended.

Hello, I have carried out the steps you indicate and this is the result:

Without modifying the script

root@DietPi:~# /var/lib/dpkg/info/anydesk.postinst configure
Synchronizing state of anydesk.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable anydesk
root@DietPi:~# echo $?
1
root@DietPi:~# command -v update-menus
root@DietPi:~# command -v update-desktop-database
root@DietPi:~# command -v xdg-desktop-menu
root@DietPi:~#

After modifying the script with the three lines that you indicate changing $$ by ||

root@DietPi:~# /var/lib/dpkg/info/anydesk.postinst configure
Synchronizing state of anydesk.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable anydesk
/var/lib/dpkg/info/anydesk.postinst: line 32: update-menus: command not found

Line 32 is:

32 command_exists update-menus || update-menus

Good,

any help with this?

Greetings

it might be good to have it reported to anydesk, if this is a bug within the apt package

valdragas
Sorry for the late reply. Please add the leading "! " to the front of the three lines. You can copy paste the copy block:

        ! command_exists update-menus || update-menus
        ! command_exists update-desktop-database || update-desktop-database
        ! command_exists xdg-desktop-menu || xdg-desktop-menu forceupdate

Hello,

It seems that after executing it with the MichaIng indications, the error no longer appears.

A greeting

Great. I’ll report this the AnyDesk.

Hello,

We know if it is better to open a new topic although it is related to the same thing, but today anydesk has stopped working again throwing this error:

root@DietPi:~# systemctl status anydesk
● anydesk.service - AnyDesk
   Loaded: loaded (/etc/systemd/system/anydesk.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-05-17 08:35:34 BST; 17min ago
  Process: 7920 ExecStart=/usr/bin/anydesk --service (code=exited, status=127)
 Main PID: 7920 (code=exited, status=127)

May 17 08:35:34 DietPi systemd[1]: Started AnyDesk.
May 17 08:35:34 DietPi anydesk[7920]: /usr/bin/anydesk: symbol lookup error: /lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0: undefined symbol: g_direcp_equal
May 17 08:35:34 DietPi systemd[1]: anydesk.service: Main process exited, code=exited, status=127/n/a
May 17 08:35:34 DietPi systemd[1]: anydesk.service: Failed with result 'exit-code'.



root@DietPi:~# dpkg -l |grep libgdk
ii  libgdk-pixbuf2.0-0:armhf       2.38.1+dfsg-1                       armhf        GDK Pixbuf library
ii  libgdk-pixbuf2.0-common        2.38.1+dfsg-1                       all          GDK Pixbuf library - data files

What is the problem now?

probably as well something that might need to be reported to anydesk?

But it has been working correctly and after a reset of the PI this error has started to appear

MichaIng
found an older issue related to anydesk https://dietpi.com/forum/t/install-anydesk-version-5/3752/1

Not sure if it’s the same issue. Interesting is that the symbol g_direcp_equal (from the error message) does not exist at all, but g_direct_equal does. Looks like a simple typo in their code then. But not sure how it could have been successfully compiled like that in the first place and why it worked at first :thinking:.