Skip to content

setup-r-dependencies: switch back to classic sudo on runners with sudo-rs - #1096

Open
jeroen wants to merge 1 commit into
v2-branchfrom
sudo-alternatives
Open

setup-r-dependencies: switch back to classic sudo on runners with sudo-rs#1096
jeroen wants to merge 1 commit into
v2-branchfrom
sudo-alternatives

Conversation

@jeroen

@jeroen jeroen commented Jul 21, 2026

Copy link
Copy Markdown
Member

Alternative solution for #1094 (see also #1095).

sudo-rs, the default sudo on Ubuntu 25.10+ (and thus ubuntu-26.04 GitHub-hosted runners), does not support bare -E:

sudo: preserving the entire environment is not supported, '-E' is ignored

With the environment dropped, R_LIB_FOR_PAK is empty inside the sudo'd R process, so the pak installation fails.

Instead of changing the sudo invocation, this switches the sudo alternative back to classic sudo before installing pak:

sudo update-alternatives --set sudo /usr/bin/sudo.ws

This is guarded by a check that /usr/bin/sudo.ws exists, so it is a no-op on runners that ship classic sudo only.

Also adds ubuntu-26.04 and ubuntu-26.04-arm to the test matrix so this is exercised in CI.

Fixes #1094

🤖 Generated with Claude Code

sudo-rs, the default sudo on Ubuntu 25.10+ (and thus ubuntu-26.04
GitHub-hosted runners), does not support bare -E:

    sudo: preserving the entire environment is not supported, '-E' is ignored

With the environment dropped, R_LIB_FOR_PAK is empty inside the sudo'd
R process, so the pak installation fails.

Switch the sudo alternative back to classic sudo (/usr/bin/sudo.ws)
when it is available, and add ubuntu-26.04 and ubuntu-26.04-arm to the
test matrix.

Fixes #1094

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.33%. Comparing base (b7484da) to head (6d96816).
⚠️ Report is 3 commits behind head on v2-branch.

Additional details and impacted files
@@            Coverage Diff             @@
##           v2-branch    #1096   +/-   ##
==========================================
  Coverage      83.33%   83.33%           
==========================================
  Files              3        3           
  Lines             12       12           
==========================================
  Hits              10       10           
  Misses             2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@krlmlr

krlmlr commented Jul 22, 2026

Copy link
Copy Markdown
Member

A more sustainable fix might be to use targeted sudo --preserve-env=R_LIB_FOR_PAK or an extension to /etc/sudoers.d as implemented in https://github.com/cynkra/cynkratemplate/pull/88/changes#diff-a5460b4ed10f51fdbcfeb4d7e349088edf5c27f7c5ed9ae26e4038ab95e76708R113-R132 .

@krlmlr

krlmlr commented Jul 22, 2026

Copy link
Copy Markdown
Member

Of course, missed the earlier PR. The /etc/sudoers.d solution in https://github.com/cynkra/cynkratemplate/pull/88/changes#diff-a5460b4ed10f51fdbcfeb4d7e349088edf5c27f7c5ed9ae26e4038ab95e76708R113-R132 keeps sudo -E .

@gaborcsardi

Copy link
Copy Markdown
Member

It seems pretty fragile to pass a subset of env vars. There is no security issue here, we should keep using -E.

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

Successfully merging this pull request may close these issues.

pak fails to install on ubuntu-26.04 hosted runners

3 participants