Score:4

Terminal opened from Terminal opened from Files fails to find user settings

cn flag

I have just performed a fresh install of Ubuntu 21.04 (formerly using 20.10) on my desktop. However, I am facing an problem with GNOME Terminal.

If I open the Terminal via the keyboard shortcut or the right-click menu on my desktop, everything works fine. If I open Terminal via the file browser (Files), however, the initial window works fine but any subsequent Terminal tabs/windows I open from within that one fail to find my terminal settings.

So:

  • Open Terminal via keyboard shortcut/desktop right-click menu: OK
  • Open new Terminal window/tab from previous: OK
  • Open new Terminal window via Files right-click menu: OK
  • Open new Terminal window/tab from previous: BROKEN

Every time, the fourth situtation shows the sudo tip (so clearly can't find ~/.sudo_as_admin_successful), shows the current location in the prompt as /home/<username> rather than ~, produces no output for echo $HOME, etc.

It seems to have no idea where to look for terminal settings, but only when opened from another Terminal window that was opened from Files. whoami shows the same user for both working and non-working Terminals.

I've copied the clean .profile and .bashrc from /etc/skal/, as well as logging out and in and restarted my computer, but nothing has helped.

vanadium avatar
cn flag
Cannot reproduce that on Ubuntu 21.04, although my instance is an upgrade, no clean install.
Score:3
cn flag

I've managed to fix this, but I have no idea what happened.

Fix

Go into the Terminal window hamburger menu > ‘Preferences’ > ‘⟨profile name⟩’ sidebar item > ‘Command’ tab and check ‘Run command as a login shell’. I've left all other settings as I found them:

enter image description here

Re: @steeldriver's comment below, if I leave this option unchecked it is unchecked in all Terminal windows, both the ones that work and the ones that don't. So presumably checking the option has no effect on the originally-working windows, and only comes into play in the fourth, originally-broken scenario.

Explanation

I'll leave this for a little bit before accepting it as the answer in case anybody can provide a more detailed explanation of what happened.

hr flag
This may be the "right" answer but it would be interesting to know why it is necessary - processes *should* inherit a working environment from their parent, so I wonder why that's not happening in this case?
08915bfe02 avatar
cn flag
@steeldriver I've expanded the answer a little - AFAICT, the processes *are* inheriting the parent environment.
hr flag
Thanks for the update - I was actually referring to inheritance of *environment variables* (the stuff you would see in the output of the `printenv` command) rather than the terminal's user-preferences - which AFAIK are stored in the dconf database rather than inherited as such.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.