wine cmd net command issue

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

wine cmd net command issue

Post by - yo - »

Hi everyone,

I am on archlinux (4.18.16-arch1-1-ARCH) and I need to install PostgreSQL in the wine environment. I went through several issues before getting at the systematic error message:
"problem running post-install step database cluster initialization failed" when installing manually postgresql-10.5-2-windows.exe through wine.

I read a lot and get at the conclusion that I have to manage some folder authorizations and need to run some cmd commands such as:

Code: Select all

net user /add postgres
However, when I run wine cmd and get my windows environment prompt:

Code: Select all

Microsoft Windows 5.1.2600 (3.19)
C:>
and run:

Code: Select all

net user /add postgres
I got this return:
The syntax of this command is:

NET command [arguments]
-or-
NET command /HELP

Where 'command' is one of HELP, START, STOP or USE.
I tried lots of things but I can not figure out why net is answering like that.

Does anybody have an idea?
Thanks for your time.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: wine cmd net command issue

Post by Bob Wya »

@- yo -

Code: Select all

net user /add postgres
Wine doesn't implement the user parameter, for the net command.
Pretty simple really!

In fact the Wine implementation of the net command is very bare bones at present:

Code: Select all

programs/net/Makefile
programs/net/Makefile.in
programs/net/net.c
programs/net/net.rc
programs/net/resources.h
- probably hasn't had much updates since the first implementation in 2007!

Your postgres issues, are probably unrelated to this anyway.
But it's impossible to tell without seeing a full Wine terminal output.
Which, btw, should be enclosed in the forum Code tags - not Quote tags.

I'm suspect getting Postgres databases to work, under Wine, will be of super low importance to Wine Developers.
Given databases will probably run a lot better, as native Linux applications!

Bob
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

Re: wine cmd net command issue

Post by - yo - »

Thanks for your answer Bob Wya.
Wine doesn't implement the user parameter, for the net command.
That explains lots of things, thanks.

So, there is my general situation. I want to run an application that only runs on Windows environment. I don't want a dual boot and I really would like to avoid a virtual machine. So I want to use wine. However, this application needs postgresql installed and running at service to run. And I can not succeed installing postgresql on wine. Every time I get a final error message:

Code: Select all

Problem running the post-install step. Installation may not complete correctly.
Meaning that the permissions are not okay and I need to run it with a different user with other users permissions (for this reason I needed to use net). So now I understand that there is only one user when running wine and it is administrator. So I need another solution.


I decided to try to install the postgresql linux version on my archlinux system and connect to it with the Windows Postgres ODBC driver on wine. And here I get another problem. I need to install psqlodbc_10_03_0000-x86 through the psqlodbc_x86.msi file. And I can not install any msi file, every time I run:

Code: Select all

wine msiexec /i *.msi
or
wine start *.msi
I get:

Code: Select all

fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
I installed different libraries but can not solve the msi installation..

Do you have an idea? msi file installation is really not supported by wine yet?

If I install Postgresql on linux and Postgres with Postgres ODBC driver on wine do you think I will be able to run my application on wine?

Thanks.
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

Re: wine cmd net command issue

Post by - yo - »

Still unable to install a msi file.

Code: Select all

rm -rf ~/.wine
WINEARCH=win32 WINEPREFIX=~/.wine winecfg
(winecfg --> Windows 10)

Code: Select all

wine msiexec /i psqlodbc_10_03_0000-x86/psqlodbc_x86.msi
fixme:ntdll:NtLockFile I/O completion on lock not implemented yet

winetricks mdac27

wine msiexec /i psqlodbc_10_03_0000-x86/psqlodbc_x86.msi
fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
Everything seems clean and I can not install a msi file. I tried with wine-staging too, same result.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: wine cmd net command issue

Post by DarkShadow44 »

Install works just fine for me. The fixme can be ignored. Got the msi from https://www.postgresql.org/ftp/odbc/versions/msi/

You don't even get the installer window to show up?
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

Re: wine cmd net command issue

Post by - yo - »

Thanks for the reply.

I got the msi from this site and tried other msi files with the same error.

When I run the command the installer window pop-up 0.1 second and then nothing, just the error message.
I reinstalled wine (3 different versions, staging, 2.19, 3.19) and still have this issue, I don't understand.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: wine cmd net command issue

Post by Bob Wya »

- yo - wrote:Hi everyone,

I am on archlinux (4.18.16-arch1-1-ARCH) and I need to install PostgreSQL in the wine environment. I went through several issues before getting at the systematic error message:
"problem running post-install step database cluster initialization failed" when installing manually postgresql-10.5-2-windows.exe through wine.

I read a lot and get at the conclusion that I have to manage some folder authorizations and need to run some cmd commands such as:
...
You can workaround this issue by the using the rather hooky implementation of runas.exe, only present in the Wine Staging branch.

Postgres 10.5.1 - from Download PostgreSQL Binaries - will start up, on my system, with:

Code: Select all

wine runas /trustlevel:0x20000 postgres.exe
See: Bug 40613 - Multiple applications require UAC implementation to run installer/app as a normal user instead of administrator (WhatsApp Desktop, Smartflix, Squirrel Installers, OneDrive) .

Bob
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: wine cmd net command issue

Post by DarkShadow44 »

Not sure if UAC is the problem, I run arch linux too and the msi installs properly - even with normal wine. Already tried a fresh WINEPREFIX?
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: wine cmd net command issue

Post by Bob Wya »

DarkShadow44 wrote:Not sure if UAC is the problem, I run arch linux too and the msi installs properly - even with normal wine. Already tried a fresh WINEPREFIX?
@DarkShadow44

That was me answering OP's original question, about installing and using the Windows version of PostgreSQL server...
Rather than the move to make things even more complicated by involving an Linux ODBC bridge.

Bob
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: wine cmd net command issue

Post by DarkShadow44 »

Sorry Bob, you're right of course.
Back to the problem at hand we have the installer log:

Code: Select all

Executing cscript //NoLogo "C:\Program Files (x86)\PostgreSQL\10/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Program Files (x86)\PostgreSQL\10" "C:\Program Files (x86)\PostgreSQL\10\data" 5432 "DEFAULT" 0
So this makes it pretty clear. Installer logs are often useful, keep that in mind. :)

Snipped from the the output:

Code: Select all

unning bootstrap script ... Execution of PostgreSQL by a user with administrative permissions is not
permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromises.  See the documentation for
more information on how to properly start the server.
child process exited with exit code 1
initdb: removing contents of data directory "C:/Program Files (x86)/PostgreSQL/10/data"
There seem to be multiple issues here:
1) vbscript bugs
2) Doesn't run with admin rights
3) Doesn't like builtin msvcrt
4) Doesn't like win64
5) bug 40489 - wbemprox does not support ASSOCIATORS query

Workarounds:
1) winetricks wsh57
2) use wine stating, wine runas /trustlevel:0x20000
3) winetricks vcrun2013
4) use win32
5) doesn't really help: (from win7 take wbemcomn.dll, wbemprox.dll, add override for wbemprox, wintricks ole32 - though this breaks the startup of the program due to the ole32 override...)

Got it to install (mostly) with

Code: Select all

WINEARCH=win32 wineboot
#Copying files and adding override
winetricks -q vcrun2013 wsh57 ole32
wine runas /trustlevel:0x20000 postgresql-10.5-2-windows.exe
It can't start the server due to 5), but it might still work when starting manually. Don't guarantee success though.
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

Re: wine cmd net command issue

Post by - yo - »

Thanks a lot for all your responses.

I made some progress. My msi install issue did not have any link with wine. I have 2 screens, I spent the last days running the msi installs in terminals in one of my screen and systematically got an error. Today I opened a terminal on my other screen and the window installer popup and stays without any problem. So, you were right about the issue and indeed the warning was just a warning and did not have any link with the popup problem. I use i3wm (tiling window manager), I guess it was a bug regarding the floating windows in my first screen (not very sure). Anyway, I can install a msi file now..

Now I have two solutions. Try to install everything on wine as Bob Wya suggested in order to simplify the process or try to do it with a bridge to linux.

I tried the wine runas /trustlevel:0x20000 with winetricks wsh57 on wine staging and finally got the same error about not being able to finalize the process as before. I will dig a little more tomorrow.

I tried the other solution too, I needed mdac27 (not mdac28) to get all the odbc part. Now I have the cliconfg.exe and odbcad32.exe files, not sure what I have to do with them yet.
I guess I have to install psqlodbc. I understand that my original application needs postgresql to be running as a service, so I guess I will have to have it running anyway. But I still have the permission issue. Thanks for your help on that btw :D . I will dig more on that too tomorrow to figure out what I have to do.

Thanks for your time.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: wine cmd net command issue

Post by DarkShadow44 »

tried the wine runas /trustlevel:0x20000 with winetricks wsh57 on wine staging and finally got the same error about not being able to finalize the process as before. I will dig a little more tomorrow.
I still have the permission issue.
We're talking about installing and running windows postgresql here, right?

What permission issue? The "runas /trustlevel:0x20000" takes care of the permissions, the rest is the other issues I described.
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

Re: wine cmd net command issue

Post by - yo - »

So, there are some results:

installing PostgreSQL normally:

Code: Select all

wine runas /trustlevel:0x20000 postgresql-10.5-2-windows.exe
It passes successfully the permission issue (as you said DarkShadow44) except I still get the message error at the end of the process, same error as before:

Code: Select all

problem running post-install step. Installation may not complete correctly. The database cluster initialization failed.
I tried start it manually with:

Code: Select all

wine runas /trustlevel:0x20000 postgres.exe

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
I created a config file from a sample:

Code: Select all

wine runas /trustlevel:0x20000 "postgresql-10.5-1-windows-binaries/pgsql/bin/postgres.exe --config-file=postgresql-10.5-1-windows-binaries/pgsql/share/postgresql.conf"
However every time I rerun the command it asks me for new information in the conf file, I tried to fill them until it asks for the database path where it says me that this folder is not a data folder.
I guess I need to run another executable in order to configure PostgreSQL automatically.


Start PostgreSQL with copying Postgres 10.5.1 Binaries:

Code: Select all

wine runas /trustlevel:0x20000 postgresql-10.5-1-windows-binaries/pgsql/bin/postgres.exe
It works directly, no window installer, however I directly get the same message that I need to precise a config file as before.

Do I have to run a script in order to do all the configuration?


Install PostgreSQL on linux with odbc drivers:

I installed mdac27 to get all the odbc part, I have the cliconfg.exe and odbcad32.exe files.
I installed psqlodbc on wine, no problem. But then I don't know what to do.

Thanks for your time.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: wine cmd net command issue

Post by DarkShadow44 »

- yo - wrote: However every time I rerun the command it asks me for new information in the conf file, I tried to fill them until it asks for the database path where it says me that this folder is not a data folder.
I guess I need to run another executable in order to configure PostgreSQL automatically.

It works directly, no window installer, however I directly get the same message that I need to precise a config file as before.

Do I have to run a script in order to do all the configuration?
Did you read my post properly?

Install with

Code: Select all

WINEARCH=win32 wineboot
winetricks -q vcrun2013 wsh57
wine runas /trustlevel:0x20000 postgresql-10.5-2-windows.exe #Install to C:\PostgreSQL
cd .wine/drive_c/PostgreSQL/bin
wine runas /trustlevel:0x20000 "postgres.exe -D C:/PostgreSQL/data"
Then you can simply connect with

Code: Select all

wine psql -U postgres
The service should also autostart automatically, might not even need to start it manually.
- yo -
Level 1
Level 1
Posts: 7
Joined: Thu Nov 01, 2018 3:45 pm

[SOLVED] run PostgreSQL on wine issues

Post by - yo - »

You are right DarkShadow44.

I run:

Code: Select all

WINEARCH=win32 wineboot
winetricks -q vcrun2013 wsh57
wine runas /trustlevel:0x20000 postgresql-10.5-2-windows.exe #Install to C:\PostgreSQL
cd .wine/drive_c/PostgreSQL/bin
wine runas /trustlevel:0x20000 "postgres.exe -D C:/PostgreSQL/data"
Then I was able to connect to the database through:

Code: Select all

wine psql -U postgres
And able to run my application too.


Thank you very much for your help.
Locked