Noticed during support cases, Phoenix deployments and personal development machines: In UCS 5.0 the bash command line completion does not work in screen and sudo sessions that are not login sessions. After running `. /etc/profile` the commands in /etc/profile.d/bash_completion.sh are run and bash completion works. If `echo $BASH_COMPLETION_VERSINFO` doesn't produce output, then that's not been loaded. It works when you get a login shell as root directly.
Workaround: . /etc/profile.d/bash_completion.sh
Created attachment 10962 [details] Proposed patch Can we try with this one? I manually edited /etc/bash.bashrc on one of my VMs and rebooted it.
A "interactive *non*-login shell" starts sourcing `bashrc` instead of `profile`. In Debian the later `profile` always sources the former `bashrc` by default. While /etc/bash.bashrc does *not* source `bash_completion.sh`, this is done explicitly by /etc/skel/.bashrc which normal users get by default. Completion is neither sourced by /root/.profile nor by /root/.bashrc For a "root" *login* shell it still is sourced via /etc/profile These files are all installed by package "base-files" and shipped in /usr/hsare/base-files/{dot.{profile,bashrc},profile} But `screen` or `sudo` do *not* get completion sourced: Both do *not* use a "login-shell" by default; you have to explicitly request that using `sudo -i` or `screen -s -bash`. As such they use `/root/.bashrc` only, which does not source completion. See <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=275623#54> <https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html> # interactive login `bash --login` | `-bash` +- `--noprofile` +- /etc/profile | . /etc/bash.bashrc | . /etc/profile.d/*.sh | . /etc/profile.d/bash_completion.sh +--+- $HOME/.bash_profile +- $HOME/.bash_login +- $HOME/.profile . $HOME/.bashrc `sh --login` | `-sh` +- `--noprofile` +- /etc/profile +- $HOME/.profile # interactive non-login shell `bash -i` +--+- `--norc` +- `--rcfile …` +- $HOME/.bashrc +- /etc/bash.bashrc `sh -i` +- $ENV # non-interactive non-login shell `bash -c` | `#!/bin/bash` +- $BASH_ENV `sh -c` | `#!/bin/sh` NOTHING (In reply to Nikola Radovanovic from comment #2) > Created attachment 10962 [details] > Proposed patch No, the "bug" is in /root/.bashrc (AKA /usr/share/base-files/dot.bashrc) not sourcing /etc/profile.d/bash_completion.sh (In reply to Arvid Requate from comment #0) > In UCS 5.0 the bash command line completion does not work in screen and sudo > sessions that are not login sessions. Use `sudo -i` or `screen -s -bash` for now.
Thank you!
A good way to fix this issue is to edit the template and remove the 'out' commands (marked with #), so that bash completion can be used. vim /etc/univention/templates/files/etc/bash.bashrc # enable bash completion in interactive shells -#if ! shopt -oq posix; then -# if [ -f /usr/share/bash-completion/bash_completion ]; then -# . /usr/share/bash-completion/bash_completion -# elif [ -f /etc/bash_completion ]; then -# . /etc/bash_completion -# fi -#fi +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi if [ -e "$HOME/.univention-environment" ]; then . "$HOME/.univention-environment" To write the changes in the bashrc make an commit: ucr commit /etc/bash.bashrc Bash completion should now work. You can verify that the profile is loaded by running the following command and should get a output. echo $BASH_COMPLETION_VERSINFO Example: root@dc0:~# echo $BASH_COMPLETION_VERSINFO 2 It would be great to include an update to release the fix, as the main improvements come from the patch file. This bug has been around for three years, and now we have a solid solution to resolve it. Let's take this opportunity to address it promptly!
Package build for 5.2-1 Successful build Package: univention-base-files Version: 11.0.13 Branch: 5.2-0 Scope: errata5.2-1 User: jtorres Host: ladda
QA: OK upgrade: OK
<https://errata.software-univention.de/#/?erratum=5.2x113>