Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenSUSE] zypper download command requires root #30

Open
brookslogan opened this issue Aug 20, 2024 · 4 comments
Open

[OpenSUSE] zypper download command requires root #30

brookslogan opened this issue Aug 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@brookslogan
Copy link

brookslogan commented Aug 20, 2024

As a normal user on OpenSUSE Tumbleweed, rspm::enable() encounters an error trying to install reqs:

rspm::enable()
#> Downloading and installing required utilities...
#> Root privileges are required to run this command.
#> Error: something went wrong, utilities not available

This appears to be due to zypper -d (= zypper --download-only) still requiring root privileges.

I expect that this problem also occurs on OpenSUSE Leap:

podman run opensuse/leap bash -c "zypper install -y sudo && useradd --create-home testuser && sudo -u testuser bash -c '(cd ~ && zypper --pkg-cache-dir /home/testuser install -dy patchelf)'"

also produces Root privileges are required to run this command. when attempting to use zypper -d.

Potential alternatives

Treat reqs as preqs instead and forcing user to get root to install them

Not as smooth as the current approach, but not too bad.

zypper --pkg-cache-dir . download <name>

There is zypper download that doesn't require root privileges. Some notes:

  • nonissue?: zypper download does not appear to automatically download dependencies, though this may not be an issue:
    • ldd probably already exists, at least on opensuse/{leap,tumbleweed} images from Docker Hub (and zypper install ldd would fail anyway, as it's not recognized as a package or capability name)
    • Running zypper install patchelf on the above containers appears to only install patchelf and no additional (dependency) packages, so it looks like fresh systems may already have all of its dependencies.
    • (If other packages are needed, there's zypper info --requires <name>, though its output seems pretty unfriendly; hopefully somewhere there's a better option.)
  • issue: even if the rpm is successfully downloaded, rpm_install() routes to rpm2archive, which isn't installed by default, and which zypper install can't find.
    • My rspm:::rpm_version() is '4.19.1.1'. But the ver >= "1000.0" command seems to successfully run when I manually try it. Perhaps the rpm_version logic could be adjusted to avoid this issue.
    • This likely also happens on Leap: the opensuse/leap image has an rpm --version of RPM version 4.14.3, but no rpm2archive installed, and zypper install rpm2archive doesn't find it as a package or capability.
part of `sudo zypper install patchelf` output
The following NEW package is going to be installed:
  patchelf

1 new package to install.
`zypper info --requires patchelf` output
Loading repository data...
Reading installed packages...


Information for package patchelf:
---------------------------------
Repository     : Main Repository (OSS)
Name           : patchelf
Version        : 0.18.0-3.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 284.4 KiB
Installed      : No
Status         : not installed
Source package : patchelf-0.18.0-3.1.src
Upstream URL   : https://nixos.org/patchelf.html
Summary        : A utility for patching ELF binaries
Description    : 
    PatchELF is a simple utility for modifing existing ELF executables and
    libraries.  It can change the dynamic loader ("ELF interpreter") of
    executables and change the RPATH of executables and libraries.
Requires       : [15]
    libstdc++.so.6()(64bit)
    libstdc++.so.6(GLIBCXX_3.4)(64bit)
    libstdc++.so.6(CXXABI_1.3)(64bit)
    libc.so.6(GLIBC_2.38)(64bit)
    libgcc_s.so.1()(64bit)
    libgcc_s.so.1(GCC_3.0)(64bit)
    libstdc++.so.6(CXXABI_1.3.9)(64bit)
    libgcc_s.so.1(GCC_3.3.1)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.29)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.9)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.18)(64bit)
    libstdc++.so.6(GLIBCXX_3.4.26)(64bit)
    libstdc++.so.6(CXXABI_1.3.5)(64bit)

Further issues down the line, at least for Tumbleweed

  • issue: Tumbleweed doesn't seem to actually be supported by the Posit package manager, but the only sort of feedback hinting that something may be going wrong (with pak::pkg_install at least) seems to be a one-time "ℹ source packages are missing from packagemanager.posit.co" as it apparently routes everything to install from source instead.
    • options(repos) points me to https://packagemanager.posit.co/all/__linux__/opensuse20240809/latest, which points to https://packagemanager.posit.co/all/__linux__/opensuse20240809/latest/src/contrib/PACKAGES, which contains the message "Distribution with identifier 'opensuse20240809' not supported or not enabled". (As opposed to https://packagemanager.posit.co/cran/__linux__/opensuse155/latest/src/contrib/PACKAGES which is actually a package listing.)
    • But for OpenSUSE Leap it seems like the zypper download + >= "1000.0" approach might successfully work. I haven't fully tested this yet though.
@Enchufa2
Copy link
Member

  • rpm2archive is the preferred utility when it's available. It appeared in rpm version 4.12, see the release notes, so I'm surprised that openSUSE doesn't include it. Does this mean that they choose to avoid building it? If this is the case, I suppose we would need to select one method or another based on the availability, instead of the rpm version.

  • If Posit no longer supports Tumbleweed, then we no longer support it either, because it makes no sense if there are no binaries to download. So I'll remove it from the docs, and let's talk about Leap exclusively, please.

  • The way this works, we basically need a command that, given a package or capability, resolves the packages needed and downloads them without root privileges to a given location. If zypper download does not resolve dependencies, then it's not going to work unfortunately.

@Enchufa2 Enchufa2 changed the title rspm::enable() fails due to lack of root privileges on OpenSUSE (Tumbleweed) rspm::enable() fails due to lack of root privileges on OpenSUSE Aug 20, 2024
@Enchufa2 Enchufa2 changed the title rspm::enable() fails due to lack of root privileges on OpenSUSE [OpenSUSE] zypper download command requires root Aug 20, 2024
@Enchufa2 Enchufa2 added the bug Something isn't working label Aug 20, 2024
@Enchufa2
Copy link
Member

After a quick look, maybe this is just not possible with zypper. Maybe this is only possible via dnf.

@brookslogan
Copy link
Author

brookslogan commented Aug 20, 2024

Thanks for taking a look! Double-checking the rpm2archive part: zypper search --provides rpm2archive seems to confirm that rpm2archive isn't available. I'll need to check later whether OpenSUSE provides a recommendation/reasoning what to use and why rpm2archive isn't there. However, I do see rpm2cpio on the system as well, if that explains anything.

@brookslogan
Copy link
Author

brookslogan commented Aug 20, 2024

And in case it was lost in wordiness: zypper download seems like it would currently "work", it's just fragile. (Because the base OpenSUSE system currently appears to contain all the dependencies of patchelf already, and already has the other reqs.) [I've only tested this on a container so far, though.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants