Tigervnc server fails with HOME variable not set

fedoravnc

The system is Fedora Core 24. It is a recent upgrade from fc23. With fc23 the vncserver started without error. However after the upgrade the follow error occurs:

Unit vncserver@:2.service has begun starting up
vncserver: The HOME environment variable is not set

There have not been any changes to and of the start scripts or .vnc files. Where would vncserver be looking for the HOME variable? Where would the command to set the HOME variable be inserted? What would it look like?

Best Answer

The HOME environment variable is set automatically when you log in. Under normal circumstances you shouldn't find any of the login scripts modifying it in any way.

Environment variables are usually passed unmodified to programs executed in your login session. And there is hardly ever a reason to unset HOME, thus the error condition you mention does not sound very likely.

You can try this command to see your current environment variables:

tr '\0' '\n' </proc/$$/environ

And you can replace $$ with the pid of any process whose environment variables you want to see (though there are obviously security restrictions to which processes you are allowed to look at, if you are not root).

If you find that HOME does exist when you invoke the above from your shell, you can try using strace to see at which point they disappear. You can try:

strace -fve execve vncserver

This will run vncserver and show you which environment variables were passed to vncserver and anything executed by vncserver.

Finally you can try creating a new user to see if the problem relates to a specific user's configuration files or is a systemwide problem.