STR:
1) Define an env variable "HOME" to have the value "C:\Users\Username" (adjust for your username)
2) Clean install http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-x86_64-20141003.exe/download - choosing default options throughout
3) Open msys2_shell.bat
4) Perform "cd ~"
Expected:
Command succeeds.
Actual:
$ cd ~
bash: cd: /home/Ed: No such file or directory
And yet:
$ pwd -W
C:/Users/Ed
$ grep 'Ed' /etc/passwd | cut -d ':' -f 6
/home/Ed
Appears that install/first run didn't set the user up correctly?
Seems like perhaps this was the cause of http://sourceforge.net/p/msys2/tickets/7/#b1d5 too?
I am using that same version and do not have that issue, my home is somewhere else and MSYS2 is detecting it properly.
Check if your MSYSTEM exists and its value.
Have you tried setting the home also in your fstab? See http://stackoverflow.com/questions/24099179/msys2-does-not-source-profile
MSYSTEM was being set to "MSYS" by msys2_shell.bat
Adding this line to fstab fixes my problem:
c:/Users/Ed /home/Ed ntfs binary,posix=0,user 0 0
So it seems like for cases where someone has set a custom value for HOME, the mount isn't being set up properly, and the user has to add a line manually to fstab.
Therefore we either need to fix the auto-mounting (to avoid needing to adjust fstab), or else make the installer/first-run add the line to fstab.
If that is WONTFIX (and even if it isn't, for the short term to reduce confusion), it would be helpful to mention needing to adjust fstab on http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/ or other documentation.
Could someone adjust this ticket title (since I don't seem to have permissions) to something like:
"Using custom HOME location requires undocumented changes to fstab"
More complete STR to replace those in the bug report:
Last edit: Ed 2014-10-28
Works fine with a clean install of the new release (msys2-x86_64-20141113.exe).
Happy to call this fixed now.
Glad it's working for you, but I fear this one's like a bad penny, or Arnold Schwarzenegger .. "I'll be back".
"I'm back"
I was a cygwin user up till about a week ago. I decided to install windows 8.1 fresh. This time I decided to install MSYS2 instead.
The reason I ended up here was because windows environment variable %HOME% was not set and as such I had no access to my FS outside of msys64 dir.
After a few google searches and reading I found out that Git Bash for windows automatically sets the $HOME var. to %USERPROFILE% if %HOME% does not exist. This seems like a logical approach and I would have no problem with doing this if I hadn't of read this on MinWG http://www.mingw.org/wiki/HOWTO_Set_the_HOME_variable_for_cmd_exe
Seems to me this issue could be handled a little more elegantly other then assuming %HOME% is set.
How did you launch the MSYS2 shell?
msys2_shell.bat from the 'MSYS2 Shell' shortcut on the start menu
Please read "/etc/post-install/05-home-dir.post" file. Recently Cygwin/MSYS2 switch to use new scheme for mapping Windows users to Cygwin. To solve your problem you need edit "/etc/nsswitch.conf" file. Find "db_home" line and add "windows" before "cygwin".
Regards,
Alexey.
Thank you Alexey!! Finally the right answer!! This was actually changed way back in Cygwin 1.7.34 in 2009 http://stackoverflow.com/questions/1494658/how-can-i-change-my-cygwin-home-folder-after-installation