One thing you are mistaken about is that
/etc/environment requires a reboot to reload. This is incorrect. The only time the file is read is on login, when the PAM stack is activated – specifically
pam_env.so, which reads the file.
Logging out and back in would apply the changes – and in fact you must do this if you want all your processes to receive the new environment. All other "solutions"2 will only apply the environment to the single shell process, but not to anything you launch through the GUI including new terminal windows.1
If you're fine with that, though – the lack of
export commands can be compensated for with
set -a and
set +a. However, it still remains a poor way, as the file doesn't use quoting either. But this should work fine:
while read -r env; do export "$env"; done
1 GNOME Session Manager provides a way to change its own environment, but only during the
$ gdbus call -e -d org.gnome.SessionManager -o /org/gnome/SessionManager \
-m org.gnome.SessionManager.Setenv "foo" "bar"
Error: GDBus.Error:org.gnome.SessionManager.NotInInitialization: Setenv
interface is only available during the Initialization phase
gdb is not a solution (unless you are grawity).