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

install zef as user #91

Closed
bazzaar opened this issue Aug 4, 2022 · 17 comments
Closed

install zef as user #91

bazzaar opened this issue Aug 4, 2022 · 17 comments

Comments

@bazzaar
Copy link

bazzaar commented Aug 4, 2022

System is Opensuse Leap 15.4, on x86_64

The command that's detailed in the rakudo_pkg readme, to install zef as user -

  /opt/rakudo-pkg/bin/install-zef

... didn't work for me. One of the tests failed with the message complaining about sic. not finding a dependency(s).

I seem to remember npm might have been mentioned too?

I tried a couple of times, no luck, (deleting the .zef dir after each failed attempt)

and then tried using the different instructions on the ugexe/zef github page -

   git clone https://github.com/ugexe/zef.git
   cd zef  
   raku -I. bin/zef install .

which successfully installed zef without error. (Subsequently I've been able to install all the modules I need.)

Also, since then I found that npm / nodejs were not installed on my (new build) system, and have now added them.

I looked for a page or section that detailed rakudo / zef system dependencies, but did not find anything.

@nxadm
Copy link
Owner

nxadm commented Sep 10, 2022

HI @bazzaar,

I am not able to reproduce it on a fresh openSUSE Leap 15.4 install:

$ podman run -ti --rm opensuse/leap:15.4
18094fc5064d:/ # zypper install curl sudo
Retrieving repository 'Update repository of openSUSE Backports' metadata .[done]
Building repository 'Update repository of openSUSE Backports' cache ......[done]
Retrieving repository 'Non-OSS Repository' metadata ......................[done]
Building repository 'Non-OSS Repository' cache ...........................[done]
Retrieving repository 'Main Repository' metadata .........................[done]
Building repository 'Main Repository' cache ..............................[done]
Retrieving repository 'Update repository with updates from SUSE Linux Ente[done]
Building repository 'Update repository with updates from SUSE Linux Enterp[done]
Retrieving repository 'Main Update Repository' metadata ..................[done]
Building repository 'Main Update Repository' cache .......................[done]
Retrieving repository 'Update Repository (Non-Oss)' metadata .............[done]
Building repository 'Update Repository (Non-Oss)' cache ..................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 2 NEW packages are going to be installed:
  curl sudo

2 new packages to install.
Overall download size: 2.1 MiB. Already cached: 0 B. After the operation,
additional 7.7 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package sudo-1.9.9-150400.2.5.x86_64
                                           (1/2),   1.7 MiB (  7.0 MiB unpacked)
Retrieving: sudo-1.9.9-150400.2.5.x86_64.rpm .............................[done]
Retrieving package curl-7.79.1-150400.5.6.1.x86_64
                                           (2/2), 463.8 KiB (729.5 KiB unpacked)
Retrieving: curl-7.79.1-150400.5.6.1.x86_64.rpm ..........................[done]

Checking for file conflicts: .............................................[done]
(1/2) Installing: sudo-1.9.9-150400.2.5.x86_64 ...........................[done]
(2/2) Installing: curl-7.79.1-150400.5.6.1.x86_64 ........................[done]
18094fc5064d:/ # curl -1sLf   'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/setup.rpm.sh'   | sudo -E bash
Executing the  setup script for the 'nxadm-pkgs/rakudo-pkg' repository ...

   OK: Checking for required executable 'curl' ...
   OK: Checking for required executable 'rpm' ...
   OK: Detecting your OS distribution and release using system methods ...
 ^^^^: ... Detected/provided for your OS/distribution, version and architecture:
 >>>>:
 >>>>: ... distro=opensuse-leap  version=15.4  codename=15.4  arch=x86_64  
 >>>>:
   OK: Importing 'nxadm-pkgs/rakudo-pkg' repository GPG keys into rpm ...
   OK: Checking for available package manager (DNF/Microdnf/YUM/Zypper) ...
 ^^^^: ... Detected package manager as 'zypper'
   OK: Checking if upstream install config is OK ...
   OK: Fetching 'nxadm-pkgs/rakudo-pkg' repository configuration ...
   OK: Installing 'nxadm-pkgs/rakudo-pkg' repository via zypper ...
   OK: Updating the zypper cache to fetch the new repository metadata ...
   OK: The repository has been installed successfully - You're ready to rock!

18094fc5064d:/ # zypper install rakudo-pkg
Retrieving repository 'nxadm-pkgs-rakudo-pkg-noarch' metadata ............[done]
Building repository 'nxadm-pkgs-rakudo-pkg-noarch' cache .................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  rakudo-pkg

1 new package to install.
Overall download size: 14.5 MiB. Already cached: 0 B. After the operation,
additional 55.0 MiB will be used.
Continue? [y/n/v/...? shows all options] (y): y
Retrieving package rakudo-pkg-2022.7.0-01.x86_64
                                           (1/1),  14.5 MiB ( 55.0 MiB unpacked)
Retrieving: rakudo-pkg-openSUSE15.4-2022.07-01.x86_64.rpm ..[done (671.8 KiB/s)]

Checking for file conflicts: .............................................[done]
(1/1) Installing: rakudo-pkg-2022.7.0-01.x86_64 ..........................[done]
18094fc5064d:/ # /opt/rakudo-pkg/bin/install-zef
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Testing [OK] for zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Installing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>

1 bin/ script [zef] installed to:
/root/.raku/bin
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH

Feel free to reopen the issue if you can reproduce it. Maybe there was a temporary upstream problem? The script downloads the latest released zef from github directly.

@nxadm nxadm closed this as completed Sep 10, 2022
@bazzaar
Copy link
Author

bazzaar commented Sep 20, 2022

Hi @nxadm , I've tried again (this time on another new build, different machine). I still get the same result (see below). The difference might be I'm installing via YAST?

I added the rakudo-pkg repository as per the instructions on the dl.cloudsmith.io [Suse/Zypper] page

aaaa@bbbbbb:~> sudo zypper repos

#  | Alias                        | Name                         | Enabled | GPG Check | Refresh
---+------------------------------+------------------------------+---------+-----------+--------
 2 | nxadm-pkgs-rakudo-pkg        | nxadm-pkgs-rakudo-pkg        | Yes     | (rp) Yes  | Yes
 3 | nxadm-pkgs-rakudo-pkg-noarch | nxadm-pkgs-rakudo-pkg-noarch | Yes     | (rp) Yes  | Yes
 4 | nxadm-pkgs-rakudo-pkg-source | nxadm-pkgs-rakudo-pkg-source | Yes     | (rp) Yes  | Yes

I then installed rakudo-pkg in the YAST package manager.

I added rakudo to the users path,

aaaa@bbbbbb:~> /opt/rakudo-pkg/bin/add-rakudo-to-path

Added rakudo to PATH. You can activate the changes by typing:

aaaa@bbbbbb:~> source /home/aaaa/.profile
aaaa@bbbbbb:~> which raku
/opt/rakudo-pkg/bin/raku

Then tried the zef install,

aaaa@bbbbbb:~> /opt/rakudo-pkg/bin/install-zef

===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
[zef]         # Failed test 'right exception type (X::Zef::UnsatisfiableDependency)'
[zef]         # at SETTING::src/core.c/Exception.pm6 line 64
[zef]         # Expected: X::Zef::UnsatisfiableDependency
[zef]         # Got:      X::Method::NotFound
[zef]         # Exception message: No such method 'payload' for invocant of type 'X::Multi::NoMatch'
[zef]         # You failed 1 test of 2
[zef]     # Failed test 'did we throws-like X::Zef::UnsatisfiableDependency?'
[zef]     # at t/distribution-depends-parsing.t line 282
[zef]     # You failed 1 test of 4
[zef] # Failed test 'X::Zef::UnsatisfiableDependency'
[zef] # at t/distribution-depends-parsing.t line 253
[zef] # You failed 1 test of 35
===> Testing [FAIL]: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
Aborting due to test failure: zef:ver<0.13.8>:auth<github:ugexe>:api<0> (use --force-test to override)
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH

aaaa@bbbbbb:~>

I didn't know how to reopen this issue, so I've just added this comment.

@nxadm nxadm reopened this Sep 21, 2022
@silentTeee
Copy link
Contributor

Looks like this issue also occurs with Fedora 36. Just did a fresh install and was able to install rakudo-pkg via the automated bash script, but the moment I tried to run install-zef, I got the same error.

[alex@localhost-live ~]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
[zef]         # Failed test 'right exception type (X::Zef::UnsatisfiableDependency)'
[zef]         # at SETTING::src/core.c/Exception.pm6 line 64
[zef]         # Expected: X::Zef::UnsatisfiableDependency
[zef]         # Got:      X::Method::NotFound
[zef]         # Exception message: No such method 'payload' for invocant of type 'X::Multi::NoMatch'
[zef]         # You failed 1 test of 2
[zef]     # Failed test 'did we throws-like X::Zef::UnsatisfiableDependency?'
[zef]     # at t/distribution-depends-parsing.t line 282
[zef]     # You failed 1 test of 4
[zef] # Failed test 'X::Zef::UnsatisfiableDependency'
[zef] # at t/distribution-depends-parsing.t line 253
[zef] # You failed 1 test of 35
===> Testing [FAIL]: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
Aborting due to test failure: zef:ver<0.13.8>:auth<github:ugexe>:api<0> (use --force-test to override)
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[alex@localhost-live ~]$ 

@nxadm
Copy link
Owner

nxadm commented Oct 13, 2022

It is weird I can't reproduce it:

$ podman run -ti --rm fedora:36
WARN[0000] Failed to decode the keys ["storage.options.ostree_repo"] from "/home/me/.config/containers/storage.conf". 
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:36...
Getting image source signatures
Copying blob 62946078034b done  
Copying config 2ecb6df959 done  
Writing manifest to image destination
Storing signatures
[root@ef8d21a2a300 /]# curl -1sLf \
  'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/setup.rpm.sh' \
  | sudo -E bash
Executing the  setup script for the 'nxadm-pkgs/rakudo-pkg' repository ...

   OK: Checking for required executable 'curl' ...
   OK: Checking for required executable 'rpm' ...
   OK: Detecting your OS distribution and release using system methods ...
 ^^^^: ... Detected/provided for your OS/distribution, version and architecture:
 >>>>:
 >>>>: ... distro=fedora  version=36  codename=Container  arch=x86_64  
 >>>>:
   OK: Importing 'nxadm-pkgs/rakudo-pkg' repository GPG keys into rpm ...
   OK: Checking for available package manager (DNF/Microdnf/YUM/Zypper) ...
 ^^^^: ... Detected package manager as 'dnf'
 NOPE: Checking for dnf dependency 'yum-utils' ...
   OK: Attempting to install 'yum-utils' ...
 NOPE: Checking for dnf dependency 'dnf-plugin-config-manager' ...
   OK: Attempting to install 'dnf-plugin-config-manager' ...
   OK: Checking if upstream install config is OK ...
   OK: Fetching 'nxadm-pkgs/rakudo-pkg' repository configuration ...
   OK: Installing 'nxadm-pkgs/rakudo-pkg' repository via dnf ...
  RUN: Updating the dnf cache to fetch the new repository metadata ...Importing GPG key 0xB1C6CC6B:
 Userid     : "rakudo-pkg gpg (Key for nxadm/rakudo-pkg) <rakudo-pkg@apt-get.be>"
 Fingerprint: A2E8 E32E 64BE 8EFD 6C3F 1F7E 0DD4 CA7E B1C6 CC6B
 From       : https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/gpg.0DD4CA7EB1C6CC6B.key
Importing GPG key 0xB1C6CC6B:
 Userid     : "rakudo-pkg gpg (Key for nxadm/rakudo-pkg) <rakudo-pkg@apt-get.be>"
 Fingerprint: A2E8 E32E 64BE 8EFD 6C3F 1F7E 0DD4 CA7E B1C6 CC6B
 From       : https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/gpg.0DD4CA7EB1C6CC6B.key
Importing GPG key 0xB1C6CC6B:
 Userid     : "rakudo-pkg gpg (Key for nxadm/rakudo-pkg) <rakudo-pkg@apt-get.be>"
 Fingerprint: A2E8 E32E 64BE 8EFD 6C3F 1F7E 0DD4 CA7E B1C6 CC6B
 From       : https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/gpg.0DD4CA7EB1C6CC6B.key
   OK: Updating the dnf cache to fetch the new repository metadata ...
   OK: The repository has been installed successfully - You're ready to rock!

[root@ef8d21a2a300 /]# raku
bash: raku: command not found
[root@ef8d21a2a300 /]# dnf install rakudo-pkg
Last metadata expiration check: 0:00:27 ago on Thu Oct 13 06:13:20 2022.
Dependencies resolved.
================================================================================
 Package         Arch        Version           Repository                  Size
================================================================================
Installing:
 rakudo-pkg      x86_64      2022.7.0-01       nxadm-pkgs-rakudo-pkg       14 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 14 M
Installed size: 55 M
Is this ok [y/N]: y
Downloading Packages:
rakudo-pkg-Fedora36-2022.07-01.x86_64.rpm        12 MB/s |  14 MB     00:01    
--------------------------------------------------------------------------------
Total                                            12 MB/s |  14 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : rakudo-pkg-2022.7.0-01.x86_64                          1/1 
  Verifying        : rakudo-pkg-2022.7.0-01.x86_64                          1/1 

Installed:
  rakudo-pkg-2022.7.0-01.x86_64                                                 

Complete!
[root@ef8d21a2a300 /]# /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Testing [OK] for zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Installing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>

1 bin/ script [zef] installed to:
/root/.raku/bin
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[root@ef8d21a2a300 /]# useradd user2 -d /home/user2 -m -s /bin/bash
[root@ef8d21a2a300 /]# sudo -i -u user2
[user2@ef8d21a2a300 ~]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Testing [OK] for zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Installing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>

1 bin/ script [zef] installed to:
/home/user2/.raku/bin
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH

Is it a recent installation? Is rakudo-pkg up-to-date (dnf upgrade)? Very puzzling.

@silentTeee
Copy link
Contributor

@nxadm yeah, by sheer coincidence, I had installed Fedora 36 in a VM via the ISO on their official page minutes before my first comment to test whether an issue with another Raku module occurred in Fedora. I had run the setup script for rakudo-pkg as a regular user, then used sudo dnf to install rakudo-pkg, then tried to call zef-install as you saw.

Unlikely as it may be, could there be a difference in the configuration when yoi install in a container?

@silentTeee
Copy link
Contributor

Or perhaps the fact that you installed zef as root first? Seems unlikely though. Let me try and capture my entire terminal output from the beginning to the end of the rakudo-pkg setup and see if it gives us a hint...

@silentTeee
Copy link
Contributor

Alright, here is everything I see, from the initial setup of the package in dnf as a source to the attempt to install zef:

[alex@fedora ~]$ curl -1sLf \
  'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/setup.rpm.sh' \
  | sudo -E bash
Executing the  setup script for the 'nxadm-pkgs/rakudo-pkg' repository ...

   OK: Checking for required executable 'curl' ...
   OK: Checking for required executable 'rpm' ...
   OK: Detecting your OS distribution and release using system methods ...
 ^^^^: ... Detected/provided for your OS/distribution, version and architecture:
 >>>>:
 >>>>: ... distro=fedora  version=36  codename=Workstation  arch=x86_64  
 >>>>:
   OK: Importing 'nxadm-pkgs/rakudo-pkg' repository GPG keys into rpm ...
   OK: Checking for available package manager (DNF/Microdnf/YUM/Zypper) ...
 ^^^^: ... Detected package manager as 'dnf'
 NOPE: Checking for dnf dependency 'yum-utils' ...
   OK: Attempting to install 'yum-utils' ...
 NOPE: Checking for dnf dependency 'dnf-plugin-config-manager' ...
   OK: Attempting to install 'dnf-plugin-config-manager' ...
   OK: Checking if upstream install config is OK ...
   OK: Fetching 'nxadm-pkgs/rakudo-pkg' repository configuration ...
   OK: Installing 'nxadm-pkgs/rakudo-pkg' repository via dnf ...
   OK: Updating the dnf cache to fetch the new repository metadata ...
   OK: The repository has been installed successfully - You're ready to rock!

[alex@fedora ~]$ raku
bash: raku: command not found...
Install package 'rakudo' to provide command 'raku'? [N/y] n


[alex@fedora ~]$ sudo dnf install rakudo-pkg
Fedora 36 - x86_64 - Updates                     41 kB/s | 7.3 kB     00:00    
Fedora Modular 36 - x86_64 - Updates            189 kB/s |  21 kB     00:00    
Dependencies resolved.
================================================================================
 Package         Arch        Version           Repository                  Size
================================================================================
Installing:
 rakudo-pkg      x86_64      2022.7.0-01       nxadm-pkgs-rakudo-pkg       14 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 14 M
Installed size: 55 M
Is this ok [y/N]: y
Downloading Packages:
rakudo-pkg-Fedora36-2022.07-01.x86_64.rpm       4.8 MB/s |  14 MB     00:03    
--------------------------------------------------------------------------------
Total                                           4.8 MB/s |  14 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : rakudo-pkg-2022.7.0-01.x86_64                          1/1 
  Verifying        : rakudo-pkg-2022.7.0-01.x86_64                          1/1 

Installed:
  rakudo-pkg-2022.7.0-01.x86_64                                                 

Complete!
[alex@fedora ~]$ raku
bash: raku: command not found...
Install package 'rakudo' to provide command 'raku'? [N/y] n


[alex@fedora ~]$ echo $PATH
/home/alex/.local/bin:/home/alex/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
[alex@fedora ~]$ /opt/rakudo-pkg/bin/add-rakudo-to-path 

Added rakudo to PATH. You can activate the changes by typing:
source /home/alex/.bash_profile

[alex@fedora ~]$ source /home/alex/.bash_profile
[alex@fedora ~]$ raku
Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.

You may want to `zef install Readline`, `zef install Linenoise`, or `zef install Terminal::LineEditor` or use rlwrap for a line editor

To exit type 'exit' or '^D'
[0] > [alex@fedora ~]$ 
[alex@fedora ~]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
[zef]         # Failed test 'right exception type (X::Zef::UnsatisfiableDependency)'
[zef]         # at SETTING::src/core.c/Exception.pm6 line 64
[zef]         # Expected: X::Zef::UnsatisfiableDependency
[zef]         # Got:      X::Method::NotFound
[zef]         # Exception message: No such method 'payload' for invocant of type 'X::Multi::NoMatch'
[zef]         # You failed 1 test of 2
[zef]     # Failed test 'did we throws-like X::Zef::UnsatisfiableDependency?'
[zef]     # at t/distribution-depends-parsing.t line 282
[zef]     # You failed 1 test of 4
[zef] # Failed test 'X::Zef::UnsatisfiableDependency'
[zef] # at t/distribution-depends-parsing.t line 253
[zef] # You failed 1 test of 35
===> Testing [FAIL]: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
Aborting due to test failure: zef:ver<0.13.8>:auth<github:ugexe>:api<0> (use --force-test to override)
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[alex@fedora ~]$ sudo dnf upgrade rakudo-pkg
nxadm-pkgs-rakudo-pkg                           645  B/s | 833  B     00:01    
nxadm-pkgs-rakudo-pkg-noarch                    457  B/s | 833  B     00:01    
nxadm-pkgs-rakudo-pkg-source                    689  B/s | 833  B     00:01    
Dependencies resolved.
Nothing to do.
Complete!
[alex@fedora ~]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
[zef]         # Failed test 'right exception type (X::Zef::UnsatisfiableDependency)'
[zef]         # at SETTING::src/core.c/Exception.pm6 line 64
[zef]         # Expected: X::Zef::UnsatisfiableDependency
[zef]         # Got:      X::Method::NotFound
[zef]         # Exception message: No such method 'payload' for invocant of type 'X::Multi::NoMatch'
[zef]         # You failed 1 test of 2
[zef]     # Failed test 'did we throws-like X::Zef::UnsatisfiableDependency?'
[zef]     # at t/distribution-depends-parsing.t line 282
[zef]     # You failed 1 test of 4
[zef] # Failed test 'X::Zef::UnsatisfiableDependency'
[zef] # at t/distribution-depends-parsing.t line 253
[zef] # You failed 1 test of 35
===> Testing [FAIL]: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
Aborting due to test failure: zef:ver<0.13.8>:auth<github:ugexe>:api<0> (use --force-test to override)
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[alex@fedora ~]$ echo $PATH
/home/alex/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:/home/alex/.local/bin:/home/alex/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
[alex@fedora ~]$ cat .profile
cat: .profile: No such file or directory
[alex@fedora ~]$ 

@silentTeee
Copy link
Contributor

Okay, as a sanity check, I tried running install-zef via sudo and that worked! Then when I ran it as a regular user right after that it also worked. So basically, if the person installing zef doesn't have sudo privileges they won't be able to proceed.

[alex@fedora lib64]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
[zef]         # Failed test 'right exception type (X::Zef::UnsatisfiableDependency)'
[zef]         # at SETTING::src/core.c/Exception.pm6 line 64
[zef]         # Expected: X::Zef::UnsatisfiableDependency
[zef]         # Got:      X::Method::NotFound
[zef]         # Exception message: No such method 'payload' for invocant of type 'X::Multi::NoMatch'
[zef]         # You failed 1 test of 2
[zef]     # Failed test 'did we throws-like X::Zef::UnsatisfiableDependency?'
[zef]     # at t/distribution-depends-parsing.t line 282
[zef]     # You failed 1 test of 4
[zef] # Failed test 'X::Zef::UnsatisfiableDependency'
[zef] # at t/distribution-depends-parsing.t line 253
[zef] # You failed 1 test of 35
^C
[alex@fedora lib64]$ sudo /opt/rakudo-pkg/bin/install-zef 
[sudo] password for alex: 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Testing [OK] for zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Installing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>

1 bin/ script [zef] installed to:
/root/.raku/bin
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[alex@fedora lib64]$ /opt/rakudo-pkg/bin/install-zef 
===> Testing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Testing [OK] for zef:ver<0.13.8>:auth<github:ugexe>:api<0>
===> Installing: zef:ver<0.13.8>:auth<github:ugexe>:api<0>

1 bin/ script [zef] installed to:
/home/alex/.raku/bin
Don't forget to add '~/.raku/bin' to your PATH,
e.g. by adding this to .profile:
export PATH=~/.raku/bin:$PATH
[alex@fedora lib64]$

@silentTeee
Copy link
Contributor

Uhhhh, so I hate to break it to you @nxadm but apparently this is broken on Ubuntu 20.04LTS as well...

@usev6
Copy link

usev6 commented Nov 5, 2022

I stumbled upon the same problem today when trying to run /opt/rakudo-pkg/bin/install-zef on Debian 11.

What I noticed so far was that the underlying error happened here: https://github.com/ugexe/zef/blob/0952bcbcbb/lib/Zef/Client.rakumod#L1084

From what I was able to see from adding some debugging output, the CATCH block didn't caught the expected

X::AdHoc.new(payload => "Cannot locate native library 'libUnavailable.so': libUnavailable.so: cannot open shared object file: No such file or directory")

but a

X::Multi::NoMatch.new(dispatcher => proto method protect (Lock: |) {*}, capture => \(Lock, -> ;; $_? is raw = OUTER::<$_> { #`(Block|4239333600880) ... }))

So a new X::Method::NotFound was thrown (because method payload wasn't found for that X::Multi::NoMatch) and made the test fail.

While I was still debugging, the command /opt/rakudo-pkg/bin/install-zef suddenly succeeded.
I'm trying to dig a bit deeper.

@usev6
Copy link

usev6 commented Nov 5, 2022

It looks like /opt/rakudo-pkg/bin/install-zef works consistently when I execute

$ raku -e 'use NativeCall'

before. (Once is enough.)

And it fails consistently when I don't do that.

Maybe some Rakudo bug with precompilation, NativeCall and using EVAL?

@ugexe Did you by chance see something similar before?

@ugexe
Copy link

ugexe commented Nov 5, 2022

I've never seen such an error, no. It seems like a rakudo precompilation bug to me

@usev6
Copy link

usev6 commented Nov 5, 2022

Thanks for looking.

BTW, the X::Multi::NoMatch seems to come from this call to protect: https://github.com/rakudo/rakudo/blob/bfc6f6db88/lib/NativeCall.rakumod#L296

I'm trying (but struggling) to golf the problem down, before opening an issue over at https://github.com/rakudo/rakudo/issues.

@nxadm
Copy link
Owner

nxadm commented Nov 5, 2022

Thank you all for following this up. It looks like @usev6 found a workaround for the time being (raku -e 'use NativeCall').

Zef is installed for the root user in /opt/rakudo-pkg, but in principle /opt/rakudo-pkg/bin/install-zef just uses raku to install a fresh zef. Maybe it gets confused by existing precompiled dirs in /opt/rakudo-pkg, when it should not.

I'll wait a little to see if @usev6 is able to golf it to pass it on to rakudo, and add the workaround to the packages.

@usev6
Copy link

usev6 commented Nov 5, 2022

I think I've tracked the problem down (or at least have made substantial progress).

If I'm not mistaken the error pops up, because Rakudo tries to precompile stuff (and especially NativeCall) in the lib dir /opt/rakudo-pkg/var/zef/lib/ -- but it doesn't have write permissions to create /opt/rakudo-pkg/var/zef/lib/.precomp if you try to install zef for an unprivileged user.

My golfed version of the problem looks like this. (It only works if NativeCall isn't already precompiled in ~/.raku -- so maybe it's easiest to test with a newly created user.)

$ mkdir -p ~/tmp/rakudo-pkg_gh91/lib
$ cd ~/tmp/rakudo-pkg_gh91
$ cat >lib/Foo.rakumod
use NativeCall;
class Foo {
    method foo {
        sub native_sub is native('Unavailable') { !!! };
        native_sub();
    }
}
^D
$ chmod -w lib
$ raku -Ilib -e 'use Foo; Foo.new.foo'
Cannot resolve caller protect(Lock:U: Block:D); none of these signatures matches:
    (Lock:D: &code, *%_)
  in method setup at /opt/rakudo-pkg/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 line 296
  in method setup at /opt/rakudo-pkg/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 line 366
  in sub raku-nativecall at /opt/rakudo-pkg/share/perl6/core/sources/A153F63283BF744FD66BF7212910E5F389384F6E (NativeCall::Dispatcher) line 46
  in method foo at -e line 5
  in block <unit> at -e line 1

Without the chmod command, the exception which is expected in https://github.com/ugexe/zef/blob/0952bcbcbb/lib/Zef/Client.rakumod#L1084 is thrown:

$ raku -Ilib -e 'use Foo; Foo.new.foo'
Cannot locate native library 'libUnavailable.so': libUnavailable.so: cannot open shared object file: No such file or directory
  in method setup at /opt/rakudo-pkg/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 (NativeCall) line 319
  in method setup at /opt/rakudo-pkg/share/perl6/core/sources/A37F26876B58371B70EDD889AD69F064C90AC2C6 (NativeCall) line 366
  in sub raku-nativecall at /opt/rakudo-pkg/share/perl6/core/sources/A153F63283BF744FD66BF7212910E5F389384F6E (NativeCall::Dispatcher) line 46
  in method foo at /home/christian/tmp/rakudo-pkg_gh91/lib/Foo.rakumod (Foo) line 5
  in block <unit> at -e line 1

@nxadm
Copy link
Owner

nxadm commented Nov 7, 2022

Added the workaround for the moment:
f6ef163

@nxadm
Copy link
Owner

nxadm commented Dec 1, 2023

I will close this as the workaround seems to work. Please re-open if this is broken for you in the last package.

@nxadm nxadm closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants