8

On Windows, I have a C:\msys32 folder (containing what I believe to be a MSYS2 install) created for/by an ESP32 development environment (located in ~/esp). The MSYS home folder includes my Windows username.

Now when I copy that install to another computer, suddenly that folder changes names which I find disturbing by itself, as this isn't "my folder", it is just a name to get around a Linux requirement, it could be some fixed (canonical) name such as 'user'.

More significantly this behaviour means my install isn't portable. Whe I copy the msys32 folder to another computer everything either breaks, or doesn't make any sense. For me it would be best if that username was simply removed from the path, but I'll take second best, which is to give it a fixed name. How can I do that?

PS I understand the goal of msys is to recreate a Linux environment, but please consider that "multi-user" is a dinosaur in todays world where most people are "multi-computer".

8
  • It should be portable, but if your username on the new machine is different then it will create a new /home/<username> directory of course. It's also possible that some /etc/fstab or /etc/passwd editing took place. Newer cygwin/msys versions don't need /etc/passwd and in your case a custom /etc/fstab is also not necessary, I think.
    – T Nierath
    Commented May 9, 2018 at 12:34
  • @TNierath Note I explicitly do NOT want to know these things: portable is portable. The username is redundant, this is not a real install, just a dev environment. So the "of course" you mention is really not "of course" to me. That <username> you mention, better be something fixed. I believe that will better attend most users, as nobody cares about usernames, as long as they are distinct. But thank you, you obviously know what you're talking about.
    – user287749
    Commented May 9, 2018 at 13:02
  • Note that this really breaks otherwise portable installs: apps like Eclipse use the home folder, and it will be wrong. A global search and replace of the username does not resolve.
    – user287749
    Commented May 9, 2018 at 13:07
  • Well, it isn't portable in that sense. Cygwin simulates a POSIX environment, that means when you start a shell it expects a username, which is derived from your windows account. The programs in /usr /bin and settings in /etc are always the same since they are global settings. For your needs, it shouldn't matter if a new user directory with default config files is created on the fly. However, since the install was created by "ESP32" it could have modified the /etc config files.
    – T Nierath
    Commented May 9, 2018 at 14:21
  • @TNierath "that means when you start a shell it expects a username, which is derived from your windows account". That may seem perfectly logical to you, but it really isn't. Why should that username be the same as my windows account? Why doesn't it allow me to choose? That simple option would make portability possible. Portability means the end of lots of frustrations, for which normal people do not have the time or the means to resolve. But anyhow, there's no way to force a user-selected username (or home folder)? Thanks.
    – user287749
    Commented May 9, 2018 at 18:45

3 Answers 3

0

I'm not quite sure what to make of "everything either breaks, or doesn't make any sense" and if I can help your with that.

Regarding the different userprofiles, home paths, usernames, and how they relate to each other. Keep in mind that every local user account on Windows is always unique anyway, you may log into two Windows machines with the same account name and same password but their SIDs are always different. This usually does not matter for you, only because the default file permmissions are set up for "Authenticated Users" and similar abstract groups.

Similarly on unix, you usually care about the contents of your home folder and file access rights, aside from that the username or underlying UID are of no great concern, it's just the name you have to provide upon login.

Unless "ESP32" did something freaky with the /etc configuration files, things should just work no matter what username is shown on the prompt, setting %HOME% via the Windows system properties is my preferred approach to specify my custom home directory, since programs like the windows build of emacs also respect this setting. If you want a fully self-contained portable solution for exactly one user, then /etc/nsswitch.conf should do the job.

Detailed Information:

PS: Msys is a cygwin derived build environment to help the Windows port of gcc and friends (collectively called mingw) build software on Windows that is in theory cross platform but mostly built on Unix and came to rely on the unix tools for building. That's it. Cygwin aims much higher than that and if you want to, for example, run a ssh server with privilege separation then cygwin de-facto stops being portable due to stuff like file permission problems and missing accounts.

1
  • I was blocked from giving you marks, given my low score on this section, so I did so in some other questions
    – user287749
    Commented May 10, 2018 at 13:57
2

For my needs it was sufficient to edit "db_home: /home/user" in "C:\msys32\etc\nsswitch.conf" before running mingw32.exe.

After running ming32.exe, c:\msys32\home\user will be created, with the usual files in it. It is the new home folder. Now all paths in userspace are constants, and installs can be zipped up and copied to another PC, and all install problems vanish.

0

Today, I found a nice MSYS2 portable package here: MSYS2 Portable | PortableApps.com - Portable software for USB, portable and cloud drives with direct download.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .