You are not logged in.

#1 2021-05-27 20:51:39

origamisith
Member
Registered: 2020-07-13
Posts: 29

[SOLVED] Applications not locating $HOME correctly

For some applications that I install, they create a literal folder called '$HOME' in the install directory rather than actually referencing the $HOME bash variable. As a result, files that should go in my ~/.config actually go to <random install location>/'$HOME'/.config. Why would applications do this, and how do I prevent them from doing so? I think this is the root of many weird problems on my system.

Last edited by origamisith (2021-05-28 20:04:29)

Offline

#2 2021-05-27 21:20:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,380

Re: [SOLVED] Applications not locating $HOME correctly

What do you mean by "the install directory"?  Do you mean the current working directory when you run the program?

In any case, the problem is most likely bad quoting in one of your shell rc / profiles.  So post those.  Or a quick check with these commands:

sudo find /etc -type f -exec grep '$HOME' '{}' \+ 2>/dev/null
grep '$HOME' /home/$USER/*

Perhaps the most likely possibility (though a bit of a guess) is that you've recently tried to set some XDG_ variables, and you did so with a single-quoted '$HOME'.

Last edited by Trilby (2021-05-27 21:22:40)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2021-05-27 22:56:13

origamisith
Member
Registered: 2020-07-13
Posts: 29

Re: [SOLVED] Applications not locating $HOME correctly

The output of

sudo find /etc -type f -exec grep '$HOME' '{}' \+ 2>/dev/null

is
https://pastebin.com/DAZd6pvY
The only thing that looks suspcious to me here is a file I didn't know existed, /etc/environment, whose sole contents are:

#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
XDG_CONFIG_HOME=$HOME/.config

Could this break anything? It would make sense if this is the file breaking everything, because I've had config file problems from the beginning of my installation so I do not think I personally misspelled anything in any bash files that could cause these problems.

According to

sudo find . -name '$HOME' | wc -l

there are 85 folders called '$HOME' on my system. Here are all of them: https://pastebin.com/EkVpC39C.
(edit: this list is significant because I have had problems with polybar, IntelliJ Idea, Steam, Origin, OBS plugins, and they all link back to a misplaced config file)

Here is my /etc/bash.bashrc (equivalent to /etc/skel/.bashrc except for one alias): https://pastebin.com/6HVxNiJ5

My /home/$USER/.bashsrc: https://pastebin.com/gPGgUyAb

Last edited by origamisith (2021-05-27 23:03:13)

Offline

#4 2021-05-27 23:00:48

Scimmia
Fellow
Registered: 2012-09-01
Posts: 8,605

Re: [SOLVED] Applications not locating $HOME correctly

/etc/environment is empty (comments only) on a default installation. The comments say it's parsed by pam_env, not a shell; it may not understand $HOME

Last edited by Scimmia (2021-05-27 23:01:05)

Online

#5 2021-05-27 23:31:36

origamisith
Member
Registered: 2020-07-13
Posts: 29

Re: [SOLVED] Applications not locating $HOME correctly

Wow.

I've been existing in this broken install for 9 months now.
It's finally fixed. It was all because of /etc/environment not following the syntax described at https://wiki.archlinux.org/title/environment_variables
Chromium works without crashing after 2seconds. Fonts are changing. (some fonts are totally messed up now lol I can't even see numbers).
I won't ever have to worry about manually resetting the JDK path for IntelliJ again
OBS plugins work
I can actually install games with Lutris
I won't have to manually specify the directory of config files for launching i3, polybar, and picom in my .xinitrc
Nature is healing.
And I believe I can boldly pipe my entire list of '$HOME' clones into a good old fashioned rm -rf command (if I figure out how to safely)

Last edited by origamisith (2021-05-27 23:32:00)

Offline

#6 2021-05-28 01:16:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,380

Re: [SOLVED] Applications not locating $HOME correctly

origamisith wrote:

It was all because of /etc/environment not following the syntax described at https://wiki.archlinux.org/title/environment_variables

Right from that page:

wiki wrote:

/etc/environment is used by the pam_env module and is shell agnostic so scripting or glob expansion cannot be used.

And

wiki wrote:

@{HOME} and @{SHELL} are special variables that expand to what is defined in /etc/passwd. The following example illustrates how to expand the HOME environment variable into another variable:

XDG_CONFIG_HOME   DEFAULT=@{HOME}/.config

Note: The variables ${HOME} and ${SHELL} are not linked to the HOME and SHELL environment variables, they are not set by default.

Last edited by Trilby (2021-05-28 01:19:21)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2021-05-28 03:11:27

origamisith
Member
Registered: 2020-07-13
Posts: 29

Re: [SOLVED] Applications not locating $HOME correctly

Yes, I understand that now. This syntax is what I used to fix the problem. However, I do not recall ever editing this file in the first place. Maybe I did somehow, but again, I did not even know the file existed until today. I remember things started breaking within the first few hours of my install. I don't think I would have manually changed /etc/environment with an XDG variable before even configuring a window manager, given that I was new to Arch. Maybe I did somehow. I'm grateful for the help either way.

Offline

#8 2021-05-28 06:29:21

seth
Member
Registered: 2012-09-03
Posts: 22,196

Re: [SOLVED] Applications not locating $HOME correctly

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB