Failed to install Pharo

I am trying to install Pharo, and the Pharo Launcher. Both seem to be packaged for NixOS, as the packages pharo and pharo-launcher exist. However, when I try to run Pharo Launcher, for example, I get an error message about thread priority settings, and immediately exits.

using VM selected by image type.
  image: /nix/store/w1k82nkjwwcx1l1wcnrqx0xca7hdyxis-pharo-launcher-2017.02.28/share/pharo-launcher/pharo-launcher.image
  type:  Smalltalk image Spur 32b +C+NF (6521)
  vm:    /nix/store/4fxdvwh580sis75ijri4bixrjqmmymyy-pharo-spur32/bin/pharo-spur
pthread_setschedparam failed: Operation not permitted
This VM uses a separate heartbeat thread to update its internal clock
and handle events.  For best operation, this thread should run at a
higher priority, however the VM was unable to change the priority.  The
effect is that heavily loaded systems may experience some latency
issues.  If this occurs, please create the appropriate configuration
file in /etc/security/limits.d/ as shown below:

cat <<END | sudo tee /etc/security/limits.d/pharo.conf
*      hard    rtprio  2
*      soft    rtprio  2
END

and report to the pharo mailing list whether this improves behaviour.

You will need to log out and log back in for the limits to take effect.
For more information please see
https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux

I tried this on two different NixOS machines, and it fails on both, so I wonder if it is possible to install pharo-launcher and make it work right away, or if one has to tweak some settings before?

I have tried setting the limit with ulimit -S -H 2, but I’m not even sure that’s the right thing to do. In any cases, this doesn’t work.

I don’t know the answer, but I can report that the pharo VM that NixOS (stable) installs DOES work with a Cuis smalltalk image. So something must have changed in recent Pharo images (but I’ve been unable to find out what).

1 Like

You can set the limits with `security.pam.services.*.limits

See NixOS Search

2 Likes

I’m also trying to use pharo-launcher. The program briefly appears and immediately exits for me as well.

Using this as a template, in my configuration.nix I set the following:

security.pam.services.pharo-launcher.limits = [
{ domain = “*”; item = “rtprio”; type = “soft”; value = “2”; }
{ domain = “*”; item = “rtprio”; type = “hard”; value = “2”; }
];

But I did not see any changes from the above error.

the contents of /etc/pam.d/pharo-launcher are

# Account management.
account required pam_unix.so

# Authentication management.
auth sufficient pam_unix.so   likeauth try_first_pass
auth required pam_deny.so

# Password management.
password sufficient pam_unix.so nullok sha512

# Session management.
session required pam_env.so conffile=/etc/pam/environment readenv=0
session required pam_unix.so
session required /nix/store/sv0xrwv6nc92adfpn29x7fcis91590p0-linux-pam-1.5.2/lib/security/pam_limits.so conf=/nix/store/ks4m89dr78rb6jz0msjidazr5an959pl-limits.conf

Which doesn’t seem to even mention the limits. Did I do it wrong?

1 Like

It’s probably in /nix/store/ks4m89dr78rb6jz0msjidazr5an959pl-limits.conf

The last time I used Pharo, I had to load an old image because the VMs in Nixpkgs were too old.

Try the Pharo 40627 image.

Ah, yes I see it there. But how do I tell pharo-launcher to use that?
(And if it is using it, then it’s still crashing despite being aware of the setting. In which case: the launcher is crashing immediately before I even get to select an image, so I’m out of steps to try.)

This screenshot is from last year. It looks like I downloaded an older Pharo image and then called Pharo directly.

1 Like

Ah cool. Grabbing the 40627 image from here and then just extracting and calling pharo Pharo-40627.image did the trick.
Thank you so much!

For whoever might want to fix the bug instead of working around it:

The latest Pharo I can run by just calling pharo filename.image is 60547. After that there is a naming convention change. Things in the 70 directory no longer have a number as their zip file name, and extracting the ‘stable-64’ dated 2020-6-29 yields Pharo7.0.5-0-64bit-fd8c156.image which produces the same error we get from pharo-launcher.

So the breaking change was somewhere between pharo 6 and 7.
I notice that the stable-64 zip also has significantly more files than just the .changes and .image. Combined with the fact the naming convention of the .zip changed I infer there was probably some major architectural change in this time. Finding out exactly what happened there might be helpful.
Maybe that’s when they added the separate heartbeat thread or decided it needed increased priority?

(Also a warning for anyone with a high resolution display: The setting ‘Display scale factor’ is not available in 60547 although it is present in newer Pharo versions as shown here. So I ended up having to just use a VM to run the program anyway to make text legible.)

2 Likes

Thank you a lot for your input, @emmanuelrosa and @NerveCoordinator. Setting security.pam.services.pharo-launcher.limits did not help for the heartbeat thread, but the following did:

security.pam.loginLimits = 
  let entry = type: {
    inherit type;
    domain = "*";
    item = "rtprio";
    value = "2";
  }; in [ (entry "hard") (entry "soft") ];

After that (logout / login for it to take effect), I tried the various VMs provided on nixpkgs, with the Pharo 9.0 image.

$ pharo-cog pharo-90.image
This interpreter (vers. 6505) cannot read image file (vers. 68021).
Press CR to quit... [I press Return]
$ pharo-spur pharo-90.image
This interpreter (vers. 6505) cannot read image file (vers. 68021).
Press CR to quit... [I press Return, once again]
$ pharo-spur64 pharo-90.image
[A window opens]

With pharo-spur64, a window actually opens:

However, I can’t do much. Clicking anywhere does nothing, clicking on the Pharo logo just makes it turn blue

Trying to close the window just makes a weird, grey rectangle appear. It doesn’t always have the same size, nor the same position.

I found no way to make it disappear. Clicking on the Pharo logo still just make it turn blue, and trying to close the window again does nothing more. Finally, Ctrl-C in the terminal closes it without further output.

1 Like

Also, just running pharo-launcher opens a window, then instantly crashes. Again, I tried running the different VMs provided in nixpkgs with the image bundled with pharo-launcher.

$ pharo-cog /nix/store/.../pharo-launcher.image
This interpreter (vers. 6505) cannot read image file (vers. 6521).
Press CR to quit...
$ pharo-spur /nix/store/.../pharo-launcher.image
[a window opens, then the program instantly crashes with exit code 1]
$ pharo-spur64 /nix/store/.../pharo-launcher.image
This interpreter (vers. 68021) cannot read image file (vers. 6521).
Press CR to quit...
$

Also, I noticed the version of the VMs (6.X) and of pharo-launcher (2017.X.X) seems quite old. Maybe that’s the issue?