TechSomething

Debian 10 Buster various problems

Preface #

I've always used Debian
And I've loved it
because it is was straightforward and you could easily solve your issues searching the net.

Issue #

I had some issues because some common (from 20years to now) commands were no longer available,
commands like

and it seemed pretty strange.

Workaround #

I found out that all these executables are already present in the folder /sbin or /usr/sbin,
but these folder are not in the PATH variable.

searching a bit it should be due to /etc/profile:

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi

if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi

which will load the second line of PATH and not the first one that includes our much needed /sbin and /usr/sbin

the solution is to add to
/etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

which will fix the system, at least for my needs.

Ansible task #

Ansible task to achieve that:

    - name: Fix Debian10's shitty executables paths
      lineinfile:
        dest: /etc/environment
        line: 'PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"'
        state: present
      when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '10'

so, the issue is fixed, but please Debian, ripijate.

Update #

As a wise friend of mine pointed out, changing user with

su root

is not the same as doing

su - root

since it won't open a new shell and use the correct variables.
more here:
https://unix.stackexchange.com/questions/15611/what-is-the-difference-between-su-and-su-root

so 50/50 contributory negligence, ball in the center.