I was thinking last night, as I was deep into researching where the path is set when using Systemd (of course, /etc/environment by default), that it would be ironic to get a related question on the topic today. And look - Here it is!
The problem you are seeing isn't that WSL doesn't "shut down" (it does), or even that it "saves state" (it doesn't). The problem is simply that /etc/environment doesn't (normally) get processed on WSL.
This is because /etc/environment is a PAM construct -- It's typically read into the environment by pam_env.so during login.
However, as you've probably noticed, there's no real concept of a "login" in WSL. It never asks for your username or password, as the real security comes from your Windows account and permissions.
You can force a login that invokes PAM (and thus reads /etc/environment) with something like:
sudo su - $USER
You might want to just set the variables in either:
~/.bashrc -- If you only need them for something in an interactive session
~/.bash_profile -- If you need them for all sessions under the "login" shell.
- Or another config file if you are using a different shell.
/etc/environment is really meant for variables that should be set for all users in a multi-user system. WSL is really designed with a single default, developer user in mind.
Ubuntu sometimes listed some additional information on login (greeting, current time, etc.) ..., but I never see this info now
That's the message-of-the-day functionality, and it should typically only display once a day. Just wait until tomorrow, and you'll probably see it again.
/etc/profilewon't it work? – Eyjafl Jul 25 '22 at 14:23/etc/profileis sourced by the shell itself, and I'm fairly sure the default 22.04 configuration will do so under WSL. – NotTheDr01ds Jul 25 '22 at 14:40