The $HOME variable is incorrectly set to "/root" for all users on login on my Raspberry Pi 3B+ board running Ubuntu Server 22.04.
In an SSH session I have to manually $ export HOME=/home/ubuntu and $ source .bashrc (for the default ubuntu user, it's the same for every user I create).
However this annoyance becomes a problem with VS Code remote for example, as it can't read the profile:
stderr> -bash: /root/.bash_profile: Permission denied.
How can I load my user profiles correctly?
I've tried running usermod -d /home/ubuntu ubuntu as suggested in this answer, but everything is apparently ok (usermod: no changes).
Since I'm running the Pi headless I have no xsession as was OPs problem in the linked thread, so I'm a bit at a loss.