Portable Cygwin: Windows Registry Entries?

Thomas Wolff towo@towo.net
Thu Jul 31 08:36:11 GMT 2025



Am 30.07.2025 um 20:22 schrieb Jon Turney via Cygwin-apps:
> On 28/07/2025 14:01, Matthew Sheets via Cygwin-apps wrote:
>> I've been poking around at what might be needed to facilitate a 
>> portable Cygwin setup, and registry activity is one of the aspects 
>> that would need to be addressed.
>>
>> Are there any flags, options, special environment variables, etc. 
>> that would prevent Cygwin from making any registry changes?
>>
>> Cygwin FAQ 2.24 states the following:
>> "Cygwin doesn't store anything important in the registry anymore for 
>> quite some time. There's no reason to save, restore or delete it."
>>   - https://www.cygwin.com/faq.html#faq.setup.registry
>>
>> After a fresh install to a clean system with a recent 
>> CygwinSetup-x86_64.exe (June 30), registry entries like the following 
>> can be found:
>> [HKEY_CURRENT_USER\SOFTWARE\Cygwin\Installations]
>> "e022582115c10879"="\\??\\C:\\cygwin64"
>>
>> [HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Installations]
>> "e022582115c10879"="\\??\\C:\\cygwin64"
>
> These are records of the "installation key", a hash of the path Cygwin 
> is installed in (which is, um, added to the names of internal objects 
> to so that multiple cygwin installations are isolated from each other, 
> or something like that)
>
> This is written to the registry by the DLL, purely for informational 
> purposes, I think.
>  > [HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup]
>> "rootdir"="C:\\cygwin64"
> This last registry entry is written by setup.This is only used to 
> store the selected installation root directory, so that setup can 
> default to it, next time you run it.
It may also confuse setup as I reported some months ago. With two 
installations (one for testing), setup was permantly switched to 
proposing the test root, even after installing for the main working 
installation again.
I'd suggest to drop this registry writing (i.e. make --no-write-registry 
the default). Setup should check whether it's being called from within a 
cygwin installation tree and use that, or fallback to the default.

>
> You can prevent this with the '--no-write-registry' setup option.
>
>> This seems to be somewhat alluded to under FAQ 2.20.7, which covers 
>> Cygwin uninstall:
>> "Finally, if you want to be thorough you can delete the registry tree 
>> Software\Cygwin under HKEY_LOCAL_MACHINE and/or HKEY_CURRENT_USER. 
>> However, if you followed the directions above you will have already 
>> removed everything important. Typically only the installation 
>> directory has been stored in the registry at all."
>>   - https://www.cygwin.com/faq.html#faq.setup.uninstall-all
>>
>>
>> My initial thought was that these registry changes perhaps might be 
>> made by the Setup executable, but in a search of the Setup source 
>> code, nothing jumped out at me, but there were a few potential users 
>> of reg_key::set_string() within the searchable repos on GitHub.
>>   * https://cygwin.com/cgit/cygwin-apps/setup/tree/
>
> See https://cygwin.com/cgit/cygwin-apps/setup/tree/mount.cc#n97
>
>>   * 
>> https://github.com/search?q=repo%3Acygwin%2Fcygwin+set_string&type=code
>
> and 
> https://cygwin.com/cgit/newlib-cygwin/tree/winsup/cygwin/mm/cygheap.cc#n139
>



More information about the Cygwin-apps mailing list