The solution is to add your variable to /etc/profile. Then everything works as expected!
Of course you MUST do it as a root user with sudo nano /etc/profile. If you edit it with any other way the system will complain with a damaged /etc/profile, even if you change the permissions to root.