Why are environment variables written at the end of "/etc/environment" file not working?

I add the following environment variables to the end of “/etc/environment”, and reboots


But when I type printenv command, it has no effect of setting the environment variable. How do I solve this issue?


Besides, during my search of the solution, I have 2 more questions as follows.

Q1: Is there a login shell before entering GNOME desktop environment?
Q2: What are those files defining global environment variables and what is their reading sequence?

They are likely overridden, as there are multiple places where you can set them, depending on the scope.

I got the ones from /etc/environment by using sudo no idea why?

To be more specific, I was installing Chinese input methods on my laptop (Manjaro-GNOME) , with Wayland as the default. I typed the 3 following commands with the 4 lines added to the end of /etc/environment, and after reboots it works normally on gedit, but not the case on Firefox.

  1. sudo pacman -S fcitx5-im
    which includes 1) fcitx5 2) fcitx5-configtool 3) fcitx5-gtk 4) fcitx5-qt
  2. sudo pacman -S fcitx5-chewing
  3. sudo pacman -S fcitx5-table-extra

So I added the following command, trying to figure it out myself.

  1. sudo pacman -S fcitx5-diagnose
  2. fcitx5-diagose

But the output seems to involve many further topics that I’m not familiar with… I paste the first problem here for reference.

Frontends setup:



    Environment variable XMODIFIERS is “@im=ibus” instead of “@im=fcitx”. Please check if you have
    exported it incorrectly in any of your init files.

    Please set environment variable XMODIFIERS to “@im=fcitx” using the tool your distribution pro
    vides or add export XMODIFIERS=@im=fcitx to your ~/.xprofile. See Input Method Related Environm
    ent Variables: XMODIFIERS

    If you are using gnome>=3.6, you may want to uninstall ibus or remove ibus-daemon in ord
    er to use any input method other than ibus. See Note for GNOME Later than 3.6 for more detail as well as alternative solutions.

    Xim Server Name from Environment variable is ibus.

  2. XIM_SERVERS on root window:

    Xim server name is the same with that set in the environment variable.

The principle is the same as specified in the linked topics.
X11 commands, variables and ~/.xprofile will not work on Wayland.