ivan-hc / AM

AppImage package manager to install, update and manage ALL of them, system-wide or locally, thanks to its ever-growing AUR-inspired database listing 2000+ portable apps and programs for GNU/Linux. The first, real centralized repository to manage your AppImages with the ease of APT and the power of PacMan.
https://portable-linux-apps.github.io
GNU General Public License v3.0
497 stars 39 forks source link

My saga installing Krita #466

Closed MauricioLucas closed 6 months ago

MauricioLucas commented 6 months ago

In February, I installed Krita with AM, but it didn't work on my "Linux Mint Cinnamon 21.2". I went straight, downloaded it from the website, and realized it was a developer bug. I tested version krita-5.3.0-prealpha and everything worked perfectly. Always having to search for the package among other downloads ended up annoying me, so I thought about testing Krita installation again through AM and received this message:

$am -i krita

mv: unable to get status of './tmp/krita': No such file or directory
chmod: cannot access './krita': No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
◆ "KRITA" INSTALLED (1 MB OF DISK SPACE)
rm: cannot remove '/opt/am/.cache/krita': No such file or directory
$ wget https://raw.githubusercontent.com/ivan-hc/AM/main/INSTALL && chmod a+x ./INSTALL && sudo ./INSTALL^C

 ------------------------------------------------------------------------

   >>  Enjoy your applications without thinking about anything else   <<   

  -----------------------------------------------------------------------

  SITE: https://github.com/IVAN-HC/AM-APPLICATION-MANAGER
$ am -l
grep: /opt/am/x86_64-apps: File or directory not found
cat: /opt/am/x86_64-apps: File or directory not found

 YOU HAVE INSTALLED 30 APPLICATIONS OUT OF  AVAILABLE

 LIST OF THE  APPLICATIONS AVAILABLE IN THE 'AM' REPOSITORY:
(END)
$am -q krita

 SEARCH RESULTS FOR "KRITA" IN THE LIST OF AVAILABLE PROGRAMS:

grep: /opt/am/x86_64-apps: No such file or directory

Anyway, this is just a report of the error and a suggestion to also include the pre-alpha version since the stable version may not work for some people. It would be useful to include a warning to try the pre-alpha version if the stable one doesn't work."

"Thank you for making our lives easier with the 'AM' Application Manager."

ivan-hc commented 6 months ago

hi and thanks, I can't reproduce the issue, is your CLI updated to the last version (am -s or am -u)?

Istantanea_2024-04-22_14-29-07

as you can see, I've no strange outputs and the app is in place (apart the icon, missing in the menu)

ivan-hc commented 6 months ago

I'm on Debian Testing, I use BASH

ivan-hc commented 6 months ago

also, krita acts normally (have you got libfuse2 installed? these old AppImages need this library)

Istantanea_2024-04-22_14-35-51

ivan-hc commented 6 months ago

I've thested this also with AM instead of AppMan, using the option --debug

am -i --debug krita

I only had the output of "wget" and a error about "mv" that have not found the .desktop file in one of the places the script searches for... but the installation is correct as well

ivan-hc commented 6 months ago
$am -i krita

mv: unable to get status of './tmp/krita': No such file or directory
chmod: cannot access './krita': No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
grep: ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
sed: cannot read ./krita: No such file or directory
◆ "KRITA" INSTALLED (1 MB OF DISK SPACE)
rm: cannot remove '/opt/am/.cache/krita': No such file or directory

these are errors during the installation, it seems that the installation process have not found the installation script "$arg" (in your case is krita)

$ wget https://raw.githubusercontent.com/ivan-hc/AM/main/INSTALL && chmod a+x ./INSTALL && sudo ./INSTALL^C

 ------------------------------------------------------------------------

   >>  Enjoy your applications without thinking about anything else   <<   

  -----------------------------------------------------------------------

  SITE: https://github.com/IVAN-HC/AM-APPLICATION-MANAGER

what is that "^C" after INSTALL at first line?

$ am -l
grep: /opt/am/x86_64-apps: File or directory not found
cat: /opt/am/x86_64-apps: File or directory not found

 YOU HAVE INSTALLED 30 APPLICATIONS OUT OF  AVAILABLE

 LIST OF THE  APPLICATIONS AVAILABLE IN THE 'AM' REPOSITORY:
(END)
$am -q krita

 SEARCH RESULTS FOR "KRITA" IN THE LIST OF AVAILABLE PROGRAMS:

grep: /opt/am/x86_64-apps: No such file or directory

your errors about "/opt/am/x86_64-apps" are because AM have not a list of applications (that instead should be available in the moment you run -l and -q (you need an internet connection, at least the first time), this is really strange.

All the above look alike a situation in which your PC have no internet connection.

and this is how they should act without internet Istantanea_2024-04-22_14-53-23

it seems that you have no access to github in general, from your terminal.

I can't say that this is a limit to github APIs access per hour, because scripts and list are direct links, no strange mechanisms to find the URL from github APIs... also Krita is not hosted on github but on another domain.

All this is really strange

Samueru-sama commented 6 months ago

(apart the icon, missing in the menu)

Fixed.

and a suggestion to also include the pre-alpha version

Will take a look at that later in the day, if it is easy it will be added as well.

EDIT: How do you get the nightly builds? Because the krita website has this message:

image

ivan-hc commented 6 months ago

the download of krita during the installation is pretty slow... I think there is something on their website that made it slow, I've seen this also with inkscape until yesterday

Samueru-sama commented 6 months ago

the download of krita during the installation is pretty slow... I think there is something on their website that made it slow, I've seen this also with inkscape until yesterday

It wasn't slow on my end. It downloaded in like 30 seconds.

ivan-hc commented 6 months ago

I've installed it 3-4 times with both am and appman and sometime the download was 8 MB/s .... sometime 500 KB/s

Always starts slow, then it decides to run fast or slow. This is the disadvantage of downloading from the upstream developer's site sometime... I'm italian, and the slower ones come from China and Japan.

ivan-hc commented 6 months ago

@MauricioLucas keep me updated if something is changed.

MauricioLucas commented 6 months ago

hi and thanks, I can't reproduce the issue, is your CLI updated to the last version (am -s or am -u)?

"I've always updated using 'am -u,' and after reading your response, I also used 'am -s,' and this was the output that appeared in the terminal.

lucas@Duvale:~$ am -s
-----------------------------------------------------------------------
 Check for any changes between the installation scripts
 in the repository and those used previously...
/opt/am/.cache/0ad-latest: Permission denied
cat: /opt/am/.cache/0ad-latest: File or directory not found

 The installer of 0ad-latest has been changed! 
 See https://github.com/ivan-hc/AM-Application-Manager/blob/main/programs/x86_64/0ad-latest
/opt/am/.cache/bforartists: Permission denied
cat: /opt/am/.cache/bforartists: File or directory not found

 The installer of bforartists has been changed! 
 See https://github.com/ivan-hc/AM-Application-Manager/blob/main/programs/x86_64/bforartists
... (similar messages for other applications) ...
-----------------------------------------------------------------------

 SYNCHRONIZING "AM" VERSION 5.3-3...

mv: cannot get status of '/opt/am/.cache/APP-MANAGER': File or directory not found
 THE "AM" SCRIPT IS NOW UPDATED TO VERSION 5.3-3! 

That's when I realized that at some point, the AM stopped updating because it's already at version 6.6.2. It was an oversight on my part not to have checked that before reporting the error.

MauricioLucas commented 6 months ago

also, krita acts normally (have you got libfuse2 installed? these old AppImages need this library)

Yes, I've been using Krita for a long time, and I have 'libfuse2' because many programs use this library. It's a standard part of Linux Mint.

lucas@Duvale:~$ sudo apt install libfuse2
libfuse2 is already the newest version (2.9.9-5ubuntu3).
0 upgraded, 0 newly installed, 0 to remove."
MauricioLucas commented 6 months ago
$ wget https://raw.githubusercontent.com/ivan-hc/AM/main/INSTALL && chmod a+x ./INSTALL && sudo ./INSTALL^C

what is that "^C" after INSTALL at first line?

This was an error in the message editing, when you copy text from the terminal using Ctrl+C it does that. Don't worry, I used the command line correctly.

For some reason that I haven't identified, using the installation command doesn't overwrite the files from the previous installation.

ivan-hc commented 6 months ago

I don't really understand why you have messages like this:

/opt/am/.cache/0ad-latest: Permission denied

you should have privileges as normal user in /opt/am (no sudo needed there)

have you installed it using the root shell or something?

All these problems are definitelly related to the fact that you have no permissions in /opt/am, and this is strange.

ivan-hc commented 6 months ago

in the INSTALL script there is a command

currentuser=$(who | awk '{print $1}')
chown -R $currentuser /opt/am 2> /dev/null

this allows "currentuser" (i.e. you) to have privileges in that directory.

I can only explain this as an attempt to install it without "chown" (that is pretty impossible) or using a different account from the one you are using now.

Have you got the same issue using AppMan? https://github.com/ivan-hc/AppMan

MauricioLucas commented 6 months ago

After many attempts, I discovered the cause of the problem. I have two other users with sudo permission, and I updated and installed other programs through them. After consolidating everything into just one user:group, I still didn't succeed using the commands, and AM remained outdated. So, I manually removed AM, and 'almost' everything went well, but some errors persist.

I'll take a break, and after resolving them, I'll come back to generate a report.

ivan-hc commented 6 months ago

I've done tests on a VM by adding two accounts and worked, all I had to do is to remove "currentuser" reverences in the INSTALL script an the install.am module.

Since next release you and other users of the same machine will be able to update the AM and all apps, and (if "SUDO" users) also to install the apps.

The installation process will give you and other users all needed permissions to /opt/am

ivan-hc commented 6 months ago

sorry, I've just noticed that not all permissions are allowed on this release.

I was able to add files but not to remove them. I was betrayed by some menus on my UI.

There is still some work to do.

I'm really sorry.

ivan-hc commented 6 months ago

I'd like to add permissions to multiple users... but for security reasons, it seems to be more secure not to allow different users to use AM and suggest AppMan instead.

I was working on a function to add to the CLI

# Determine system architecture and current user
export arch="$HOSTTYPE"
export currentuser="$USER"
if [ "$AMCLI" == am ]; then
    ampathowner=$(ls -ld /opt/am | awk 'NR==1 {print $3}')
    if [ "$ampathowner" != "$currentuser" ]; then
        echo ' 💀 ERROR: you're not the owner of /opt/am, you can't use "AM"'; exit
    fi
fi
ivan-hc commented 6 months ago

@Samueru-sama @MauricioLucas what about adding a warning like this?

# Determine system architecture and current user
export arch="$HOSTTYPE"
export currentuser="$USER"
if [ "$AMCLI" == am ]; then
    ampathowner=$(ls -ld /opt/am | awk 'NR==1 {print $3}')
    if [ "$ampathowner" != "$currentuser" ]; then
        echo ' 💀 ERROR: you are not the owner of /opt/am, so you cannot use "AM"'
        echo '--------------------------------------------------------------------------'
        echo ' The user that have installed "AM" on this system is "'"$ampathowner"'"'
        echo ' you are only allowed to use the installed apps, not to manage them.'
        echo '--------------------------------------------------------------------------'
        echo ' Please, contact "'"$ampathowner"'" to change the ownership of /opt/am or'
        echo ' consider using "AppMan" instead, see https://github.com/ivan-hc/AppMan'
        echo '--------------------------------------------------------------------------'
        exit
    fi
fi

Istantanea_2024-04-23_12-42-11

ivan-hc commented 6 months ago

I'm not good in manage permission like this, in my attempt of yesterday evening I've tried with

chmod -R 0777 /opt/am

but I was unable to run simple commands, also on installed apps.

I really need help here.

ivan-hc commented 6 months ago

@MauricioLucas this is all I can do, sorry

https://github.com/ivan-hc/AM/pull/477

it wasn't exactly what I wanted to do with "AM", but I think for system security reasons it's the best choice to make.

The use of AM and the administration of its installed apps will only be enabled for the user who installed "AM" the first time.

Non-privileged users using the same system will be advised to ask the administrator to change ownership of /opt/am, or at least be advised to use "AppMan" as alternatives.

The use of apps installed with "AM" will be open to everyone, but their updating or any modifications... but also the consultation of the lists... will be entirely at the discretion of the owner of /opt/am or the "root" user ".

Is this a good choice for you?

Samueru-sama commented 6 months ago

I want to add that I can't make the script for the pre-alpha version of krita because the website says that nightly builds are down.

ivan-hc commented 6 months ago

@Samueru-sama I'd like to have your opinion too about https://github.com/ivan-hc/AM/pull/477

ivan-hc commented 6 months ago

Hey folks, I've finally managed to made "AM" work for all users of the system:

I've removed the "$currentuser" environment variable, now all directories (in "AM") will belong to "root" but with all permissions read-write for alla users:

However, I've doubts about security issues if unprivileged users can aceede the files of the applications.

How you see all this? @Samueru-sama @MauricioLucas @zen0bit

All changes are in dev:

https://github.com/ivan-hc/AM/compare/main...dev

ivan-hc commented 6 months ago

I've done all tests on a VM of Debian with two privileged accounts and one unprivileged.

ivan-hc commented 6 months ago

I've tested the change in the install.am module also on AppMan, no issues here.

Istantanea_2024-04-23_22-08-32 png

these instead are the permissions of two apps directories seen from the unprivileged account anda directory manually created by the unprivileged user into a directory of an application installed by a privileged one:

Istantanea_2024-04-23_22-13-23 png

ivan-hc commented 6 months ago

The unprivileged user can't install/remove the apps, but can update everything and consult the lists:

https://github.com/ivan-hc/AM/assets/88724353/deb474cd-e7a2-4b1d-ad82-c70e73e029d1

I don't know why the AM-updater of deadbeef-appimage (your app, @Samueru-sama ) is always updating.

ivan-hc commented 6 months ago

But updates are working, also as unprivileged users

https://github.com/ivan-hc/AM/assets/88724353/bba79971-8b50-44b7-b38f-10b7e72f8e0a

ivan-hc commented 6 months ago

Now all depends on you, @MauricioLucas is this update enough to satisfy your request?

@zen0bit @Samueru-sama any tip?

ivan-hc commented 6 months ago

Permissions between an app installed with AM in main and the one installed with the new module (anydesk) and one of the files into it (on my machine):

Istantanea_2024-04-23_22-31-08 png

zen0bit commented 6 months ago

After short reading here..

I think that apps installed with AM should not be updated by users not in sudo group.

Was thought that AM already install apps for all users. Not really tried since I am only user... mistake

PS: I tried to look in update module. But can't get my head wrap around Tried make indentation consistent and right, but I am still missing something...

ivan-hc commented 6 months ago

@zen0bit in this case we also need to allow only users in "sudo" to edit files installed with AM

zen0bit commented 6 months ago

@zen0bit in this case we also need to allow only users in "sudo" to edit files installed with AM

Should be like that no? I don't see difference between installing/updating (both modify files)

Apps should be usable by all users on system. Not updatable, for that sudo rights needed

If you don't have rights use appman then... (For installing/updating own apps) right?

But AM should work without sudo! Just that part which needs sudo, will ask for password

ivan-hc commented 6 months ago

with this commit I've solved, @zen0bit https://github.com/ivan-hc/AM/commit/61e0f3c641d776293eccbc42dddc67e24752bd8a

ivan-hc commented 6 months ago

so... now only the main installer is left. Normal users should not manage the following files and directories:

Samueru-sama commented 6 months ago

Apps should be usable by all users on system. Not updatable, for that sudo rights needed

I told @ivan-hc the same thing here but he wants to make it different. 🙃

Well it looks like it works now anyway.

ivan-hc commented 6 months ago

the APP-MANAGER script cannot be updated due to ownership (root), also if privileged users have RW permissions

ivan-hc commented 6 months ago

it seems that a main administrator must exist to update the CLI :face_exhaling:

ivan-hc commented 6 months ago

its a mess, I cannot figure out how to solve

ivan-hc commented 6 months ago

I have to add a main administrator, I should reintroduce "$currentuser"

ivan-hc commented 6 months ago

its too much work to do here,when I fix a permission I have issues on another

ivan-hc commented 6 months ago

I think I'll left AM as an open client for all users, as I've said at https://github.com/ivan-hc/AM/issues/466#issuecomment-2073323212 , but updates and permissions on applications will be allowed only for "sudo" users https://github.com/ivan-hc/AM/issues/466#issuecomment-2073598843

ivan-hc commented 6 months ago

All these changes are a total failure... also updating all modules, by resetting everything at the "working" comit above, with all screenshots, gave errors.

Its enough.

I've nothing to do bus disable the usage of AM by other users other than the main one.

ivan-hc commented 6 months ago

Believe me, I've tried in every way, and even the most seemingly feasible solution ended up not succeeding without a hitch.

The only possible and logical solution is to allow a single system administrator to be able to manage "AM" in all ways.

This is also because more system administrators would risk not to be able to have the necessary privileges, for example, to update the CLI to the latest version.

You might as well prevent the use of the CLI by users other than the one who installed "AM". For everything else there is "AppMan", as I had predicted at the beginning.

Istantanea_2024-04-24_03-23-16

Best not to play too much with these admin privileges, folks. This definitive approach will certainly favor the use of "AM" in public facilities, such as schools. All users will be able to use the installed apps, but which ones to install and how to update them will be up to the administrator.

I'm closing.

ivan-hc commented 6 months ago

https://github.com/ivan-hc/AM/pull/480

# Determine system architecture and current user
export arch="$HOSTTYPE"
export currentuser="$USER"
if [ "$AMCLI" == am ]; then
  ampathowner=$(ls -ld /opt/am | awk 'NR==1 {print $3}')
  if [ "$ampathowner" != "$currentuser" ]; then
      echo ' 💀 ERROR: you are not the owner of /opt/am, so you cannot use "AM"'
      echo '--------------------------------------------------------------------------'
      echo ' The user that have installed "AM" on this system is "'"$ampathowner"'"'
      echo ' you are only allowed to use the installed apps, not to manage them.'
      echo '--------------------------------------------------------------------------'
      echo ' Please, contact "'"$ampathowner"'" to change the ownership of /opt/am or'
      echo ' consider using "AppMan" instead, see https://github.com/ivan-hc/AppMan'
      echo '--------------------------------------------------------------------------'
      exit
  fi
fi

Istantanea_2024-04-23_12-42-11

MauricioLucas commented 6 months ago

and a suggestion to also include the pre-alpha version

Will take a look at that later in the day, if it is easy it will be added as well.

EDIT: How do you get the nightly builds? Because the krita website has this message:

The link is this: https://cdn.kde.org/ci-builds/graphics/krita/master/linux/

And I made this script:


#!/bin/bash

# Define the base URL
base_url="https://cdn.kde.org/ci-builds/graphics/krita/master/linux/"

# Use wget to fetch the listing to stdout and grep to filter the file link
file_url=$(wget -q -O - -T 10 ${base_url} | grep -oP 'href="\Kkrita-.*?-prealpha-.*?-x86_64.appimage(?=")' | sort -V | tail -n 1)

# Check if file_url is not empty
if [[ ! -z "$file_url" ]]; then
    # Complete the URL and download with wget, using -c to continue incomplete downloads and -T 10 to set a timeout
    wget -c -T 10 "${base_url}${file_url}" -O "${file_url}"
else
    echo "Failed to find the file."
fi
Samueru-sama commented 6 months ago

I will leave this screenshot here so hopefully one day @ivan-hc decides to do the proper fix:

image

Notice how AM-updater didn't ask for my sudo password even though I chown /opt/htop to root, this is because I have samuel ALL=NOPASSWD: /opt/*/AM-updater in sudoers, and you can also see that ./remove did ask for the password since it isn't in sudoers.

Not to mention that this approach fixes a possible issue that is that if the user tires to run ./remove without sudo it will still remove the application in /opt/$APP including the remove itself, but it wont remove the symlink and the .desktop since that needs root privileges.

(If you wonder why I'm using doas in some of the steps, that is because I have sudo configured to not ask for the password once it is entered once during the current terminal session).

(Also I have no idea what that dbus-launch errors is, the app updated anyway).

The link is this: https://cdn.kde.org/ci-builds/graphics/krita/master/linux/

Thanks for that, will look into adding it.

MauricioLucas commented 6 months ago

I apologize for my delayed response, I was caught up with a significantly overdue task and couldn't devote the same level of attention you extended to me.

I figured out how everything got so complicated. I had changed the automatic login from the user "lucas" to "mao," and even though I was logged in as lucas, when using SUDO in the terminal, the files were created with the user and group "mao." When using sudo, the files were created with the user I had set in /etc/lightdm/lightdm.conf.

When I deleted and reinstalled AM, the new files were owned by user "mao" and group "mao."

After understanding and restoring this, the installation worked correctly.

MauricioLucas commented 6 months ago

Now:

$am -s
-----------------------------------------------------------------------------
 Checking for changes of the installation scripts in the online database...
 ◆ Changed https://github.com/ivan-hc/AM/blob/main/programs/x86_64/freecad
 ◆ Changed https://github.com/ivan-hc/AM/blob/main/programs/x86_64/scribus
 ◆ Changed https://github.com/ivan-hc/AM/blob/main/programs/x86_64/wine-stable
-----------------------------------------------------------------------------
 Check for updates in modules...
 ◆ Downloading database.am (not previously installed)...
chmod: could not access './database.am': No such file or directory
cat: ./database.am: No such file or directory
 ◆ Updating database.am...
mv: could not obtain status from 'tmp/*.am': No such file or directory
 ◆ Updating install.am...
mv: could not obtain status from 'tmp/*.am': No such file or directory
 ◆ Downloading update.am (not previously installed)...
chmod: could not access './update.am': No such file or directory
cat: ./update.am: No such file or directory
 ◆ Updating update.am...
mv: could not obtain status from 'tmp/*.am': No such file or directory
-----------------------------------------------------------------------------

mv: could not obtain status from '/opt/am/.cache/APP-MANAGER': No such file or directory
 ◆ "AM" IS ALREADY UPDATED, CURRENT VERSION 6.6.2-1

 See https://github.com/ivan-hc/AM/commits/main

Remembering that I kept the already installed packages, I deleted the Am folder and carried out the installation from the clone of the GitHub directory.

It would be interesting to include the option "-T 10" in the connectivity check with github.com. Several times the script got stuck, and I had to terminate it with Ctrl+C; it just sits there, and the user doesn't know if it's working or stopped. Only then did I use the command am -s.

In the download options, I would use "-c -T 10" as I did in the script I pasted earlier.