http://bugs.winehq.org/show_bug.cgi?id=15894
Colin Close itchka@compuserve.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |itchka@compuserve.com
--- Comment #15 from Colin Close itchka@compuserve.com 2010-03-09 20:04:17 --- I have looked into this problem in some detail and have determined that even with these patches the postmaster service is not starting. The reason for this is twofold. Firstly when the installer runs it executes a program called initdb.exe this is a standard utility in postgresql. This program creates the directory and files for the basic administrative db. Alas on completion this program attempts to start the postmaster service. If this fails then the previously created configuration files are deleted. The postmaster service will always fail as it must be started as an unprivileged user. The installer tries to create this user but fails because wine does not know how to create a password. It is forbidden to start the service by the db owner.
From version postgresql 8.2 onward it is possible to start the service using
the pg_ctl.exe binary. This new feature starts the server and then drops all privileges. This functionality is not available in the initdb.exe program which tries to start postmaster as an unprivileged user. the pg_ctl functionality is I think intended as a test mode. I have been able to test this mode by doing the following:- Obtain the windows binary tree from the postgresql site, unzip it and copy everything under the psql directory into a directory named postgresql in the wine c_drive. Run the following commands from within the bin directory of the tree:- wine cmd initdb -n -D c:\postgresql\data The -n flag disables the deletion of the files created even though the server fails to start properly. Remember initdb does not have the special functionality.
If one exits the wine console and checks the process tree one finds that the wineservice appears to be running but any attempt to connect to it failed for me. Kill these services. Run "wine cmd" again and after some time the following message will be displayed.
pg_ctl: no operation specified Try "pg_ctl --help" for more information.
Wine has tried to start the server using pg_ctl but its registry entry is not complete. If you exit you will again find that the wine services processes are running. Kill them again (I thinks wineserver -k may not be enough, I found that services.exe continued to run.).
Open the the system registry in a text editor and search for pg_ctl service edit the the Start key such that dword:00000003 this disables the service at start up so that it can be started manually. Now from the posresql bin directory run "pg_ctl.exe start -D c:\postgresql\data" to try and manually start the server. This what you get.
fixme:advapi:CreateRestrictedToken (0xbc, 0x1, 2, 0x81f45c, 0, (nil), 0, (nil), 0x81f44c): stub Failed to create restricted token: 120 pg_ctl: could not start server: exit code was 5
Alas we are at a fixme. Can anything be done with this?
I have run the various utilities such as psql and pgadmin3 under wine and have been able to connect the a linux postgresql server with full functionality so it is only the server part of postgresql that is broken
In summary it would be possible to install and run postgresql in wine by using a "winetricks" approach given that CreateRestrictedToken can be fixed. It will not be possible to use the distributed msi installer for postgresql because it uses initdb to set up and start the server. The installer could be changed (it's available from cvs) to implement the workaround but in truth a simple script and the binary sources would suffice.
Colin Close