Byobu does not read aliases defined in /etc/profile.d or in .profile

Bug #1618516 reported by Jonas Björkman
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
byobu
Confirmed
Medium
Unassigned
byobu (Ubuntu)
Triaged
Low
Unassigned

Bug Description

This is tested in RHEL 7.2 so feel free to remove this post if this is not relevant here.

Using a byobu install via linuxbrew (byobu 5.106 and tmux 2.1)

When I start byobu all aliases that are defined in /etc/profile.d/* or in my own .profile are not carried over to byobu. If I run tmux as is, this is not the case, and that makes me suspect that this is not the intended feature of byobu.

Revision history for this message
Jonas Björkman (tintin42) wrote :

OK, after submitting this, I found out that its a duplicate of 525552

So modifying these two files to use the --login option fixes my problem.

bin/byobu-shell
 [ -n "$SHELL" -a -x "$SHELL" ] && exec "$SHELL" --login || exec /bin/sh --login

share/byobu/profiles/tmux
 set -g default-command $SHELL --login

The first one fixes the initial window and the second one fixes any subsequent windows/splits

However, tmux specifically states in the changed file that it wishes, _not_ to read .profile again:
```
# Must set default-command to $SHELL, in order to not source ~/.profile
# BUG: Should *not* hardcode /bin/bash here
set -g default-command $SHELL
```
And indeed, when running tmux on its own (without the --login modification) and adding new windows/splits the aliases from /etc/profile.d/ end .profile are inherited from the original session.

So, somewhere there seems to be a discrepancy how byobu initializes tmux windows.

This is also not a stable solution since as soon as byobu is updated these files will be overwritten.

Changed in byobu:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Raphaël Caruso (altiire) wrote :

Do you have a status on this ?
This is still relevant on Debian 10

My current fix is to manually source /etc/profile when needed...

Revision history for this message
Wileam Yonatan Phan (wileamyp) wrote :

Seconding this. I confirm it is also present in both Ubuntu 18.04.5 LTS and Ubuntu 20.04.1 LTS.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the comments.

I was able to confirm this bug by doing:

# cat >> /etc/profile <<EOF
alias mytest="echo hello"
EOF
# byobu-shell
# mytest
bash: mytest: command not found

This is also present in Groovy and Hirsute, and upstream hasn't replied yet.

Changed in byobu (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Miriam España Acebal (mirespace) wrote :

Hi,

I could be able to reproduce the issue with Sergio's steps in Impish and Jammy as well.

Revision history for this message
Wileam Yonatan Phan (wileamyp) wrote :

To add to the discussion, it looks like byobu also ignores my ~/.bashrc file. It is especially important for me to get this working so I can use Lmod and Spack inside byobu, both of which I load through my ~/.bashrc file with the following snippet:

# Add Lua paths
LUAROCKS_PREFIX=/usr/local
export LUA_PATH="$LUAROCKS_PREFIX/share/lua/5.3/?.lua;$LUAROCKS_PREFIX/share/lua/5.3/?/init.lua;;"
export LUA_CPATH="$LUAROCKS_PREFIX/lib/lua/5.3/?.so;;"

# Lmod
if [ -z "$_INIT_LMOD" ]; then
  # Clear previous definitions of 'module'
  type module > /dev/null 2>&1
  if [ "$?" -eq 0 ]; then
    clearLmod --quiet # Purge all modules and completely remove old Lmod setup
  fi
  export _INIT_LMOD=1 # guard variable is crucial, to avoid breaking existing modules settings
  # Activate Lmod
  export BASH_ENV=/opt/lmod/lmod/init/bash
  source ${BASH_ENV}
  # Load initial modules
  export MODULEPATH=/opt/modulefiles/Compiler:/opt/modulefiles/Linux
  export MODULEPATH_ROOT=/opt/modulefiles
  export LMOD_SYSTEM_DEFAULT_MODULES=gcc:spack
  module --initial_load --no_redirect restore
fi

# Spack
. /opt/spack/share/spack/setup-env.sh

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.