1

I have installed MSYS2. First, I had my HOME in /home/Laurent, / being c:/msys64 in Windows. Then I made different thinks, install Mingw, CMake, and especially msysgit, which has its own MSYS setup. Then when I run a MSYS2 shell, my HOME is now the Windows one: c:/Users/Laurent. Probably I did some weird things.

In /etc/profile, I can read:

  # Here is how HOME is set, in order of priority, when starting from Windows
  #  1) From existing HOME in the Windows environment, translated to a Posix path
  #  2) from /etc/passwd, if there is an entry with a non empty directory field
  #  3) from HOMEDRIVE/HOMEPATH
  #  4) / (root)

So it seems that my MSYS2 has "switched" to the default HOME (1). Here is /etc/passwd concerning my account:

Laurent:unused:1001:513:U-Win7\Laurent,S-1-5-21-1379731639-3004223336-974672684-1001:/home/Laurent:/bin/bash

Shall I replace it with:

Laurent:unused:1001:513:S-1-5-21-1379731639-3004223336-974672684-1001:/home/Laurent:/bin/bash

to restore my initial setup ? I am not sure of the syntax of this line which is not familiar to what I know from standard Linux distributions, and I would not like to mess my setup and possibly loose my shell history.

  • I tried my own suggestion after doing a backup, it does not work. – lalebarde Mar 18 '14 at 11:03
  • I have discovered that the Windows environment variable HOME is used by /etc/profile. So I have modified it to c:/msys64/home/Laurent and it works. Surprisingly, pwd returns /usr/home/Laurent instead of /home/Laurent I expected. /usr exists in the shell, but is not in Windows Explorer. Besides, / and /usr are identical like if /usr was a soft link to / - touching a file is repercuted in the other and in c:\msys64\. – lalebarde Mar 18 '14 at 11:41
  • The msysgit home was not affected. Its /etc/profile does not manage HOME the same way. I think it works because it has not permissions on the MSYS2 tree, but I am not sure. – lalebarde Mar 18 '14 at 12:04
2

Changing the Windows environment variable HOME solves the problem.

Under Windows 7, go to START Button / Computer / Context menu -> Properties / Advanced system parameters / Advanced system parameters tab / Environment variables, then select HOME and Modify.

Warning: my translation in english may not be the exact one you may have on your system.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.