/etc/environment
is a file used by PAM, meaning it is processed by a log in, which sudo bash
does not do, and (from man sudoers
):
Command environment
Since environment variables can influence program behavior, sudoers provides a means to restrict which
variables from the user's environment are inherited by the command to be run. There are two distinct
ways sudoers can deal with environment variables.
By default, the env_reset option is enabled. This causes commands to be executed with a new, minimal
environment. On AIX (and Linux systems without PAM), the environment is initialized with the contents
of the /etc/environment file.
Note that most GNU/linux systems do use PAM. You could try to get around this by using sudo -i
, to use a login shell. However, this likely will still not work as "login shell" refers to how bash invokes itself, which does not include sourcing /etc/environment
, and you are not actually logging in via PAM.
Your best bet is probably to configure sudo to do what you want.