Re: Postgres Cygwin Install-as-Service on XP Pro/Home Mini

From: Jason Tishler <jason(at)tishler(dot)net>
To: Kevin Wong <kevin-wong(at)usa(dot)net>
Cc: pgsql-cygwin <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: Postgres Cygwin Install-as-Service on XP Pro/Home Mini
Date: 2002-11-13 15:25:57
Message-ID: 20021113152556.GA1372@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Kevin,

On Mon, Nov 11, 2002 at 07:40:05PM -0700, Kevin Wong wrote:
> Sorry about the delay in responding.

No problem.

> I'd be happy to help, hence my original e-mail in the first place.
> :-)

Thanks for your offer to help it is much appreciated.

> Now, I'm not sure where to put my comment about the difference between
> the /usr /doc/<packagename> directory and the
> /usr/doc/Cygwin/<packagename> directory.
>
> [snip]
>
> Anyways, enough on that topic.

I feel your pain, but I did try to help by adding the following to
/usr/doc/postgresql-7.2.2/FAQ_MSWIN:

A pre-built PostgreSQL is part of the standard Cygwin distribution
and is installed by Cygwin's setup.exe. You are encouraged to use
this version unless it does not meet your needs. Please read the
README file, /usr/doc/Cygwin/postgresql-${version}.README, where
"${version}" is the version (e.g., 7.2).

Unfortunately, the Cygwin port was named "MSWIN" and not "Cygwin".
Maybe this can (or should) be changed when the native Win32 PostgreSQL
port is release?

> In all of what's to follow, I'm assuming that Cygwin and the Postgres
> data directories to be used are all on NTFS volumes. I have yet to
> try any of this with Cygwin and/or Postgres on VFAT volumes mounted in
> Cygwin. I think this is an important note for the Postgres/Cygwin
> readme.

Agreed -- I will add this as an issue to my README.

Note that I asked multiple times for Windows 9x/Me users to run the
regression test and report their results to the list. Unfortunately, I
have not gotten any takers.

Are there any Windows 9x/Me users willing to run the regression test?

> Unfortunately, I don't have XP Pro on-hand to verify my comments with
> 100% accuracy.

I agree that XP Pro should be the same as NT/2000. Are there any XP Pro
users that can confirm or deny this?

> First of all, in terms of the Postgres/Cygwin readme, as I mentioned
> in the previous e-mail, there is also a lack of command-line
> user/user-group/security management tools in XP Home, which are
> probably found in XP Pro. So, those steps must be omitted, which I
> see you've done here.

In XP Home, is there a way to create users via the GUI?

> Secondly, because of application-level security model limitations in
> XP Home, it doesn't look like Cygipc or Postgres can be run as
> anything but the filesystem owner.

What do you mean by "filesystem owner?" The user that owns the files?

> Or, at least the owner of the relevant Postgres directories. That is,
> the SYSTEM user cannot be used as the account for executing the Cygipc
> and Postgres services.

Are you sure about cygipc? Under NT/2000, cygipc can run just fine
under SYSTEM. You even contradict this below.

> Nor can a "postgres" user, created for this purpose. The services
> just would refuse to run when I tried either the SYSTEM or postgres
> users.

Why is a "postgres" user different than a "Cygwin installer user" in this
context?

> I never fully worked this out, ...
> [snip]

Please try again. If XP Home supports multiple users, then I really
would like to use the standard "postgres" user account to be consistent
will all other PostgreSQL installations.

> Basically, things only seemed to work when the account for services
> execution was the same as the filesystem owner -- and that account
> must be an "administrative" user, not a "guest."

What is an XP Home "administrative" user? How does one create such a
user or modify an existing user to become one? Can one make the
"postgres" user an "administrative" user?

> We should premise all of your blended steps with the direction that
> the user launch a Cygwin shell, after logging-in to XP Home as the
> user under which Cygwin and Postgres were originally installed. And,
> very importantly, that user must be an "administrative" user. Again,
> this is all because of the security model limitations in XP Home.

I will add the above, but only if we can't get the "postgres" user to
work.

> Also, we can't forget to mention the need to obtain/install Cyg-ipc,
> either.

The above is already in my README.

> Now, assuming the user does login to XP Home as the Cygwin/Postgres
> installer, and is an administrative user, and has installed Cyg-ipc,
> let's look at each of your revised steps...
>
> 1. Install the cygipc ipc-daemon as a NT service:
>
> $ ipc-daemon --install-as-service
>
> Yep. Works. This uses the SYSTEM user as the login for the service.
> That actually works just fine. To be strictly consistent, we could
> instruct the user to change the account in the Services Control Panel
> applet to match the user in the next step, but it's probably
> unnecessary.

I recommend leaving this as is to be consistent with NT/2000/XP Pro.

> 2. Install postmaster as a NT service:
>
> $ cygrunsrv --install postmaster --path /usr/bin/postmaster
> --args "-D /usr/share/postgresql/data -i" --dep ipc-daemon
> --termsig INT --shutdown
>
> I would change --install postmaster to read --install "Cygwin
> Postgres" <note double quotes>, to keep the display of the Cyg-ipc and
> Postgres entries in the Services Control Panel applet grouped
> together.

The above is a stylistic preference and not a functional one. I will
leave it as is. Of course, users can choose their preferred service
name.

> We also must add a -- user <Cygwin installer user> (need double quotes
> if there are spaces in the user name) ...
> [snip]

I would really like to determine whether or not a "postgres" user can be
used. If not, then we will go with your "Cygwin installer user"
suggestion.

> 3. Create the PostgreSQL data directory:
>
> $ mkdir /usr/share/postgresql/data
>
> 4. Start the cygipc ipc-daemon:
>
> $ net start ipc-daemon # [1]
>
> 5. Initialize PostgreSQL
>
> $ initdb -D /usr/share/postgresql/data
>
> 6. Start postmaster:
>
> $ net start postmaster # [1]
>
> 7. Connect to PostgreSQL:
>
> $ psql template1
>
> [1] Cygwin's bin directory (e.g., C:\Cygwin\bin) must be added to
> the Windows NT/2000/XP's system PATH and the machine rebooted for
> the SCM to find cygwin1.dll.
>
> Everything above is just fine.

Good.

> I would also suggest adding C:\Cygwin\sbin, and C:\Cygwin\usr\sbin to
> the PATH in note [1].

Why? I don't see the need.

> The only point of confusion that I had when reading the file was the
> [x] numbers, only afterwards realizing that you were indicating a
> reference to the notes below. I suggest making a quick note at the
> top of the readme for clarity.

Agreed. The footnotes were added as an afterthought. Unfortunately, my
PostgreSQL README had become harder to understand than I would like.
Sigh...

> Note that the ipc-daemon and postmaster services are installed to
> run under whatever user account XP Home uses for services.
>
> Obviously, this isn't quite the case anymore, and can probably be
> excluded.

Agreed.

> Phew. That was long, but hopefully, complete.

Wow! Thanks for the above. I really appreciate your time and the very
valuable information provided.

BTW, are you willing to run the regression test under XP Home and report
the results to the list? I can help you set it up, if you are
interested.

Thanks,
Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Kevin Wong 2002-11-13 17:41:06 Re: Postgres Cygwin Install-as-Service on XP Pro/Home Mini
Previous Message Abel Coronado 2002-11-12 16:24:06 PostGIS problem