Skip to content

Install.sh breaks on recent Debian versions without sudo #2528

Closed
@tovine

Description

@tovine

When I tried to run the install.sh setup script on my Debian Buster machine, the dpkg step broke because it couldn't find ldconfig and start-stop-daemon. This is because of the way su is invoked (I don't use sudo).

See output from the installer log:

$ sh install.sh
Debian GNU/Linux 10 (buster)
Installing v3.8.0 deb package from GitHub releases.

+ mkdir -p ~/.cache/code-server
+ curl -#fL -o ~/.cache/code-server/code-server_3.8.0_amd64.deb.incomplete -C - https://github.com/cdr/code-server/releases/download/v3.8.0/code-server_3.8.0_amd64.deb
################################################################################################################################################################################################## 100.0%################################################################################################################################################################################################## 100.0%
+ mv ~/.cache/code-server/code-server_3.8.0_amd64.deb.incomplete ~/.cache/code-server/code-server_3.8.0_amd64.deb
+ su -c 'dpkg -i ~/.cache/code-server/code-server_3.8.0_amd64.deb'
Password:
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

But both those executables are indeed present on my system:

# which start-stop-daemon
/usr/sbin/start-stop-daemon

and

# which ldconfig
/usr/sbin/ldconfig

The issue here is that the su version bundled with recent Debian versions has changed the default behavior so that the shell spawned is not by default a login shell if no user name i specified; therefore one must invoke it with su root or su - to get the expected behavior (that used to be the default).

After making this minor change to the setup script, everything works fine (PR incoming in a moment):

$ sh install.sh
Debian GNU/Linux 10 (buster)
Installing v3.8.0 deb package from GitHub releases.

+ Reusing ~/.cache/code-server/code-server_3.8.0_amd64.deb
+ su - -c 'dpkg -i ~/.cache/code-server/code-server_3.8.0_amd64.deb'
Password:
Selecting previously unselected package code-server.
(Reading database ... 148921 files and directories currently installed.)
Preparing to unpack .../code-server_3.8.0_amd64.deb ...
Unpacking code-server (3.8.0) ...
Setting up code-server (3.8.0) ...

To have systemd start code-server now and restart on boot:
  sudo systemctl enable --now code-server@$USER
Or, if you don't want/need a background service you can run:
  code-server
  • Web Browser: N/A
  • Local OS: N/A
  • Remote OS: Debian GNU/Linux 10 (buster)
  • Remote Architecture: amd64
  • code-server --version: 3.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions