Title: Non Portable binary, doesn't work with sudo or without LD_LIBRARY_PATH · Issue #871 · actions/setup-python · GitHub
Open Graph Title: Non Portable binary, doesn't work with sudo or without LD_LIBRARY_PATH · Issue #871 · actions/setup-python
X Title: Non Portable binary, doesn't work with sudo or without LD_LIBRARY_PATH · Issue #871 · actions/setup-python
Description: Description: Python binary is compiled with rpath that's /opt/hostedtoolcache/Python. Now, latest github runners define RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY differently than /opt/hostedtoolcache and that installs python at /home/runner...
Open Graph Description: Description: Python binary is compiled with rpath that's /opt/hostedtoolcache/Python. Now, latest github runners define RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY differently than /opt/hostedtoolcache ...
X Description: Description: Python binary is compiled with rpath that's /opt/hostedtoolcache/Python. Now, latest github runners define RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY differently than /opt/hostedtoolca...
Opengraph URL: https://github.com/actions/setup-python/issues/871
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Non Portable binary, doesn't work with sudo or without LD_LIBRARY_PATH","articleBody":"**Description:**\r\nPython binary is [compiled](https://github.com/actions/python-versions/blob/main/builders/ubuntu-python-builder.psm1#L34) with `rpath` that's `/opt/hostedtoolcache/Python`. Now, latest github runners define `RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY ` differently than `/opt/hostedtoolcache` and that installs python at `/home/runner/_work/_tool/Python/`. So, with this, there are 2 issues. \r\n1. `sudo python --version` doesn't work ( See Error section) because most systems's doesn't allow passing LD_LIBRARY_PATH due to security issues.\r\n2. `python --version` doesn't work without setting environment variable **_LD_LIBRARY_PATH_**\r\n\r\noutput of ldd : \r\n```\r\nrunner@arss-runner-xxxx-runner-5jvhz:~/_work/_tool/Python/3.12.3/x64/bin$ ldd python3\r\n\tlinux-vdso.so.1 (0x00007ffceb776000)\r\n\tlibpython3.12.so.1.0 =\u003e not found\r\n\tlibc.so.6 =\u003e /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7ccc75c000)\r\n\t/lib64/ld-linux-x86-64.so.2 (0x00007f7ccc991000)\r\n```\r\n\r\nError:\r\n```\r\npython: error while loading shared libraries: libpython3.9.so.1.0: \r\ncannot open shared object file: No such file or directory\r\n```\r\n\r\n**What could be the reason:**\r\n\r\n rpath is hardcoded to `/opt/hostedtoolcache/Python`. if we use $ORIGIN, binaries will be portable. Fix is raised here https://github.com/actions/python-versions/pull/275\r\n\r\n**Action version:**\r\nv5.1.0\r\n\r\n**Platform:**\r\n- [x] Ubuntu\r\n- [ ] macOS\r\n- [ ] Windows\r\n\r\n**Runner type:**\r\n- [ ] Hosted\r\n- [x] Self-hosted\r\n\r\n**Tools version:**\r\nAll versions of Python 3.9.x, 3.10.x, etc.\r\n\r\n**Repro steps:** \r\nYou can easily reproduce using following steps. And also, you can unset `LD_LIBRARY_PATH` and just use without sudo\r\n```\r\n steps:\r\n - uses: actions/setup-python@v5\r\n with:\r\n python-version: '3.12'\r\n - run: |\r\n sudo python --version\r\n```\r\n\r\n**Expected behavior:**\r\nThere are times we need to use `sudo python` and Most system ( also not acceptable to pass) doesn't pass LD_LIBRARY_PATH as environment variable due to security issues.\r\n\r\n**Actual behavior:**\r\n`sudo python --version` to work.","author":{"url":"https://github.com/jaswanthikolla","@type":"Person","name":"jaswanthikolla"},"datePublished":"2024-05-19T00:36:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/871/setup-python/issues/871"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e620d752-0341-faef-1702-9e230ba26ab8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E08:1610AC:38E6DE:4CF726:69696BBC |
| html-safe-nonce | dee9eb4a70b9e332dcd728324e9bc4105155431ea74144dbe28db54b27b8a9e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTA4OjE2MTBBQzozOEU2REU6NENGNzI2OjY5Njk2QkJDIiwidmlzaXRvcl9pZCI6IjQwMDc2ODQxMDM2Mzk0OTM1NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5cb7b2648cf48e6118256cb2117c43d7dd6005a840f8abe60c8549a7699caa42 |
| hovercard-subject-tag | issue:2304359248 |
| github-keyboard-shortcuts | repository,issues,actions,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/actions/setup-python/871/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b5fe7dd2604d43239ba84185ac24771d0d2d30ee3cc4f55d3d80a402193b7bfa/actions/setup-python/issues/871 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b5fe7dd2604d43239ba84185ac24771d0d2d30ee3cc4f55d3d80a402193b7bfa/actions/setup-python/issues/871 |
| og:image:alt | Description: Python binary is compiled with rpath that's /opt/hostedtoolcache/Python. Now, latest github runners define RUNNER_TOOL_CACHE/AGENT_TOOLSDIRECTORY differently than /opt/hostedtoolcache ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jaswanthikolla |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| turbo-cache-control | no-preview |
| go-import | github.com/actions/setup-python git https://github.com/actions/setup-python.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 192625525 |
| octolytics-dimension-repository_nwo | actions/setup-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 192625525 |
| octolytics-dimension-repository_network_root_nwo | actions/setup-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ec4d88fbe7ed62446d90b0a6d8e6db4248a8f8b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width