Skip to content

fix(deb): use apt-get instead of apt in setup scripts - #1962

Open
Martini991 wants to merge 1 commit into
nodesource:masterfrom
Martini991:deb-scripts-use-apt-get
Open

Martini991 wants to merge 1 commit into
nodesource:masterfrom
Martini991:deb-scripts-use-apt-get

Conversation

@Martini991

Copy link
Copy Markdown

Problem

The Debian setup scripts run apt update and apt install. In non-interactive runs (Docker/Podman builds, CI, curl … | bash -) every call prints:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

setup_lts.x prints it three times. apt is the interactive front end; apt(8) says:

The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. […] So you should prefer using these commands [apt-get(8), apt-cache(8)] (potentially with some additional options enabled) in your scripts as they keep backward compatibility as much as possible.

apt-get is not deprecated. #1875 (for #1874) switched the scripts to apt on that premise; this PR goes back to apt-get for the commands the scripts run.

Change

  • scripts/deb/script_generator/base_script.sh: apt update -y → apt-get update -y (twice) and apt install -y … → apt-get install -y …, with the matching comments and error message. Flags are unchanged.
  • Regenerated setup_20/22/24/25/26.x, setup_lts.x and setup_current.x with generator.sh. Applied the same change by hand to setup_16/18/21/23.x, which the generator no longer produces.
  • The hints shown to users (To install Node.js, run: apt install nodejs -y) are unchanged, since they are for interactive use.

The CI workflows still call apt; I can switch them too if you'd like.

Testing

  • bash -n on all changed files.
  • setup_lts.x in a clean debian:trixie-slim container, before and after:
before (master) after
"stable CLI interface" warnings 3 0
exit code 0 0
nodesource.sources, apt preferences, keyring — identical
apt-get install -y nodejs v24.21.0 from NodeSource v24.21.0 from NodeSource

Prepared with the help of Claude Code; I reviewed the change and ran the tests above.

apt is meant for interactive use and prints "WARNING: apt does not have
a stable CLI interface" when run from a script. apt-get is the stable
interface for scripts. Change base_script.sh, regenerate the scripts
with generator.sh, and apply the same change to setup_16/18/21/23.x,
which the generator no longer produces. The install hints shown to
users keep suggesting apt.
@ns-control-tower

Copy link
Copy Markdown

ns-control-tower

Note

Reviewing the latest changes on this PR — this may take a few minutes.
This comment will be updated in place with the findings; no other top-level comments will be posted.

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.

2 participants