Thread: Uninstalling PostgreSQL

Uninstalling PostgreSQL

From
"- Barry -"
Date:
I want to uninstall PostgreSQL and all related packages. I don't even need Cygwin, so I've been trying to delete the cygwin directory, since there is no cygwin uninstaller.
 
The first problem was an "access is denied" message for cygcrypt-0.dll. Then I deleted the postgres user's account and did some stuff with permissions and various other things, and I was able to delete cygcrypt-0.dll, but then I had the same problem with cygcygipc-2.dll, and I don't want to figure out exactly what I did to delete cygcrypt-0.dll and apply it to each problem-file individually. I want an easy, directory-wide solution. But I have a feeling I'll need cygcrypt-0.dll back to fix the next problem.
 
I tried using chmod and chown on the cygwin directory at the Windows command prompt (the cygwin console no longer exists), but it seemed to fail. Maybe I used the wrong commands. I didn't get any error, but I still wasn't able to delete the cygwin directory, and the properties still said "read only." When I unchecked "read only" and clicked "apply" and "ok", I got an "Error applying attributes" pop-up about C:\cygwin\tmp\cygipc2_2. I heard that indicates encryption, but the "encrypt contents to secure data" box for that file is not checked. This is why I have a feeling I need cygcrypt-0.dll back.
 
I also tried deleting as many files as I could, in small groups, starting with the bin directory, from the top of the list down. The show stopper that time was "The file 'bzless' is a system file. If you remove it, you're computer or one of your programs may no longer work correctly. I think I got a similar warning for cygcrypt-0.dll, but I wasn't as brave this time and didn't try to remove it.
 
Any suggestions for removing my cygwin directory and all of its contents in a safe way, along with anything PostgreSQL might have done, would be appreciated.
 
Thanks,
Barry
 
 

Re: Uninstalling PostgreSQL

From
"Leeuw van der, Tim"
Date:
Hi Barry,
 
First, check that all your cygwin services are stopped, specifically the cygipc service. See your services control panel. However, you can't remove them there, you need to either hack the registry for that or the ipc-daemon2.exe with the proper commandline-options.
 
regards,
 
--Tim
-----Original Message-----
From: pgsql-cygwin-owner@postgresql.org [mailto:pgsql-cygwin-owner@postgresql.org]On Behalf Of - Barry -
Sent: dinsdag 22 juni 2004 13:39
To: pgsql-cygwin@postgresql.org
Subject: [CYGWIN] Uninstalling PostgreSQL

I want to uninstall PostgreSQL and all related packages. I don't even need Cygwin, so I've been trying to delete the cygwin directory, since there is no cygwin uninstaller.
 
The first problem was an "access is denied" message for cygcrypt-0.dll. Then I deleted the postgres user's account and did some stuff with permissions and various other things, and I was able to delete cygcrypt-0.dll, but then I had the same problem with cygcygipc-2.dll, and I don't want to figure out exactly what I did to delete cygcrypt-0.dll and apply it to each problem-file individually. I want an easy, directory-wide solution. But I have a feeling I'll need cygcrypt-0.dll back to fix the next problem.
 
I tried using chmod and chown on the cygwin directory at the Windows command prompt (the cygwin console no longer exists), but it seemed to fail. Maybe I used the wrong commands. I didn't get any error, but I still wasn't able to delete the cygwin directory, and the properties still said "read only." When I unchecked "read only" and clicked "apply" and "ok", I got an "Error applying attributes" pop-up about C:\cygwin\tmp\cygipc2_2. I heard that indicates encryption, but the "encrypt contents to secure data" box for that file is not checked. This is why I have a feeling I need cygcrypt-0.dll back.
 
I also tried deleting as many files as I could, in small groups, starting with the bin directory, from the top of the list down. The show stopper that time was "The file 'bzless' is a system file. If you remove it, you're computer or one of your programs may no longer work correctly. I think I got a similar warning for cygcrypt-0.dll, but I wasn't as brave this time and didn't try to remove it.
 
Any suggestions for removing my cygwin directory and all of its contents in a safe way, along with anything PostgreSQL might have done, would be appreciated.
 
Thanks,
Barry
 
 

Re: Uninstalling PostgreSQL

From
"- Barry -"
Date:
> First, check that all your cygwin services are stopped, specifically
> the cygipc service. See your services control panel. However, you
> can't remove them there, you need to either hack the registry for
> that or the ipc-daemon2.exe with the proper commandline-options.

I disabled Cygwin IPC Daemon 2 and postmaster. There's no other service
beginning with "cyg". Now when I try deleting the cygwin directory, instead
of the "access is denied" for cygcygipc-2.dll, I get "Cannot delete share,
access is denied," and I still get the "Error applying attributes" pop-up
about C:\cygwin\tmp\cygipc2_2 when I try unclicking read-only.

Barry


Re: Uninstalling PostgreSQL

From
Frank Seesink
Date:
Barry,

Basic removal of Cygwin is to shutdown any processes, reverse the order
of things like installs of Windows services, then simply delete the
C:\cygwin directory from Windows (e.g., via the Explorer).  But from
what you write, it sounds like you ripped the legs out from under
yourself before you should have and you likely have gotten burned by the
file permission settings in place.  Typically, apps like PostgreSQL will
lock down their data directories so only the user defined to run the
service/daemon have rights to the files.  In PostgreSQL's case, that is
typically the 'Postgres' user you defined in Windows to run the
postmaster service.

At this stage, you've put yourself in a place where you'll need to think
like a Windows admin.  Making sure you are logged in with Administrative
rights in Windows, do the following:

1.  Using Windows Explorer to navigate to the directory above the Cygwin
install.  Typically this is C:\ as you usually install Cygwin in C:\cygwin.

2.  RIGHT-click on the 'cygwin' folder, go to the Securities tab, and
then do what is needed to take ownership of the directory tree as
yourself (as Admin), and give yourself full rights to do anything, and
propogate that security setting down the tree.  (This may or may not
work, so keep reading).

3.  Delete the Cygwin folder.  If you have issues, then here's the next
level.  Go into C:\cygwin and start removing directories from there...
'bin', 'etc', 'home', 'lib'...  If you have a problem with one, skip it
for now.  If any, it will likely be 'var', in which is 'postgresql', in
which is 'data', a directory which is locked down to the 'postgres'
user.  Since you likely are NOT logged in as the 'postgres' user, though
you are 'god' on the box, you don't have permission to delete the
files/folders.

4.  At this stage, you're down to the offending directories.  Drill down
to the lowest level in the directory tree you can get to.  At this
point, you need to start right-clicking and changing the security
settings to give yourself enough rights so you CAN delete
directories/files, or at least enough rights to drill down further to
the lowest level and THEN setting things so you can delete them.  I
suggest you drill down and work your way back, as sometimes lower
directories do not inherit from their parents, requiring a piecemeal
deletion.

In the end, though, it simply comes down to this:  Removing Cygwin means
gutting the \cygwin directory from the drive, removing any items from
your Start menu, and if you installed any services (like postmaster via
cygrunsrv), then you should have first removed those services before
gutting the install, and if not, it's time to drill down in the Registry
and remove them by hand (services are defined in
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Pretty?  No.  But then, you created the situation by not reading enough
first to know how to admin Cygwin.  Do this kind of removal with ANY
Windows application and you risk running into such things.

I grant you, the fact no universal Cygwin uninstaller exists is
frustrating, but on a technical level, it's borderline impossible.
Cygwin provides a complete Unix environment in Windows, and as such,
comes with the usual Unix admin work.  Throw in that you're still in
Windows, and you basically better have admin skills on both platforms.
It is not a click/install affair with a pretty GUI meant for neophytes.
  But once you realize that it's just about files/directories, it's
removal is still far easier than Windows apps which hook in hard to the
Registry and, if manually removed, cause Windows to barf.

Anyway, just do the above and you should be able to remove Cygwin.  And
please note that, while folks here are helping you, at this stage you
aren't really asking about PostgreSQL under Cygwin anymore.  You're
asking about basic Cygwin issues, so technically these posts belong on
the Cygwin mailing list.

Best of luck.


- Barry - wrote:
>>First, check that all your cygwin services are stopped, specifically
>>the cygipc service. See your services control panel. However, you
>>can't remove them there, you need to either hack the registry for
>>that or the ipc-daemon2.exe with the proper commandline-options.
>
>
> I disabled Cygwin IPC Daemon 2 and postmaster. There's no other service
> beginning with "cyg". Now when I try deleting the cygwin directory, instead
> of the "access is denied" for cygcygipc-2.dll, I get "Cannot delete share,
> access is denied," and I still get the "Error applying attributes" pop-up
> about C:\cygwin\tmp\cygipc2_2 when I try unclicking read-only.
>
> Barry
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

Re: Uninstalling PostgreSQL

From
"- Barry -"
Date:
Frank,

> 1.  Using Windows Explorer to navigate to the directory above the Cygwin
> install.  Typically this is C:\ as you usually install Cygwin in
C:\cygwin.
>
> 2.  RIGHT-click on the 'cygwin' folder, go to the Securities tab, and
> then do what is needed to take ownership of the directory tree as
> yourself (as Admin), and give yourself full rights to do anything, and
> propogate that security setting down the tree.  (This may or may not
> work, so keep reading).
>
> 3.  Delete the Cygwin folder.  If you have issues, then here's the next
> level.  Go into C:\cygwin and start removing directories from there...
> 'bin', 'etc', 'home', 'lib'...  If you have a problem with one, skip it
> for now.  If any, it will likely be 'var', in which is 'postgresql', in
> which is 'data', a directory which is locked down to the 'postgres'
> user.  Since you likely are NOT logged in as the 'postgres' user, though
> you are 'god' on the box, you don't have permission to delete the
> files/folders.
>
> 4.  At this stage, you're down to the offending directories.  Drill down
> to the lowest level in the directory tree you can get to.  At this
> point, you need to start right-clicking and changing the security
> settings to give yourself enough rights so you CAN delete
> directories/files, or at least enough rights to drill down further to
> the lowest level and THEN setting things so you can delete them.  I
> suggest you drill down and work your way back, as sometimes lower
> directories do not inherit from their parents, requiring a piecemeal
> deletion.

Already tried all that. I couldn't get lower than usr/share/data. I
unchecked "read only" for the data directory and clicked "apply" and still
got "access is denied" when trying to delete it. Then when I looked at
"sharing and security" for the data directory, it was back to "read-only".
Whether I try undoing read-only for the directory alone or all sub
directories, same thing. This is after I removed the password from the
Owner's account (the only account), and removed "The registry tree
`Software\Cygnus Solutions' under HKEY_LOCAL_MACHINE and/or
HKEY_CURRENT_USER, " as instructed to do by Cygwin's FAQ:

----------------------
How do I uninstall all of Cygwin?
Setup has no automatic uninstall facility. Just delete everything manually:

    * Cygwin shortcuts on the Desktop and Start Menu
    * The registry tree `Software\Cygnus Solutions' under HKEY_LOCAL_MACHINE
and/or HKEY_CURRENT_USER.
    * Anything under the Cygwin root folder, `C:\cygwin' by default.
    * Anything created by setup in its temporary working directory.

It's up to you to deal with other changes you made to your system, such as
installing the inetd service, altering system paths, etc. Setup would not
have done any of these things for you.
----------------------

And after rebooting. All this was done after trying to delete /cygwin from
the postgres user's account (before I deleted the account).

> Pretty?  No.  But then, you created the situation by not reading enough
> first to know how to admin Cygwin.

Maybe if I had edited the registry before trying to delete /cygwin from the
postgres account, it would have worked, but the above steps aren't numbered,
and I didn't know they had to be performed in a certain order. I don't think
I turned off Cygwin IPC daemon 2 and Postmaster at that time either, but I
had no idea (and still don't) of what programs, processes, etc. might be
causing the /cygwin directory be "currently in use."

> please note that, while folks here are helping you, at this stage you
> aren't really asking about PostgreSQL under Cygwin anymore.  You're
> asking about basic Cygwin issues, so technically these posts belong on
> the Cygwin mailing list.

I did pop in on the current Uninstalling cygwin thread in the Cygwin mailing
list. At http://cygwin.com/ml/cygwin/2004-06/msg00974.html it says:

"...first kill all running cygwin programs and services. killall script in
distro and automatic detection of cygwin services
   still pending."

So, I don't know what to kill. I figured the problem might be due to
PostgreSQL because of various permissions I had to set (though I never
risked doing "chmod a+rw /var/log # could adversely affect other daemons" as
it says at
http://www.tishler.net/jason/software/postgresql/postgresql-7.3.4.README),
and because there might be some other special database locking or encryption
going on.

I'm thinking of downloading Cygwin again and playing with permissions from
that console. Yesterday chmod and chown didn't give me an error from the
Windows command prompt, but today they do. Or maybe I'll add postgres as a
user again and try stuff from that account.

The Cygwin directory appears to take up only 8K, so I guess it's not that
bad anyway.

Barry

P.S.  Here are two Windows desktop icons that I created for PostgreSQL. I
won't be needing them anymore. I hereby grant the world permission to use
them without restriction:
http://www.polisource.com/PublicMisc/PostgreSQL.ico
http://www.polisource.com/PublicMisc/PostgreSQL_2.ico


Re: Uninstalling PostgreSQL

From
Frank Seesink
Date:
- Barry - wrote:
...
> Already tried all that. I couldn't get lower than usr/share/data. I

    Hmmm.  Sounds like you're reading out of date instructions.  The
default has been /var/postgresql/data for a bit now.  Used to be
/usr/share/postgresql/data.

> unchecked "read only" for the data directory and clicked "apply" and still
> got "access is denied" when trying to delete it. Then when I looked at
> "sharing and security" for the data directory, it was back to "read-only".
> Whether I try undoing read-only for the directory alone or all sub
> directories, same thing. This is after I removed the password from the
> Owner's account (the only account), and removed "The registry tree
> `Software\Cygnus Solutions' under HKEY_LOCAL_MACHINE and/or
> HKEY_CURRENT_USER, " as instructed to do by Cygwin's FAQ:

    ???  This just doesn't sound right.  First, I'm not referring to the
generic read-only checkbox you see in the 'General' tab of the
Properties dialog box.  I'm referring to the 'Security' tab where you
specify who the owner of a file/directory is, and what rights each user
has.  This, of course, assumes you're running under some form of Windows
NT (NT 4, 2000, XP) and NOT the Win9x family (95/98/Me), where this kind
of issue should not be occurring as there are no such file
permissions/security there.

> ----------------------
> How do I uninstall all of Cygwin?
> Setup has no automatic uninstall facility. Just delete everything manually:
>
>     * Cygwin shortcuts on the Desktop and Start Menu
>     * The registry tree `Software\Cygnus Solutions' under HKEY_LOCAL_MACHINE
> and/or HKEY_CURRENT_USER.
>     * Anything under the Cygwin root folder, `C:\cygwin' by default.
>     * Anything created by setup in its temporary working directory.
>
> It's up to you to deal with other changes you made to your system, such as
> installing the inetd service, altering system paths, etc. Setup would not
> have done any of these things for you.
> ----------------------
>
> And after rebooting. All this was done after trying to delete /cygwin from
> the postgres user's account (before I deleted the account).

    "after trying to delete /cygwin from the postgres user's account
(before I deleted the account)"?  What does this mean?  You do not
delete a directory from an account.  Windows is a monolithic directory
structure, where you have permissions set on who can access what
folder/file.  If you deleted C:\cygwin, it's gone from the system, not
from an account.  You do understand this, right?

...
> I did pop in on the current Uninstalling cygwin thread in the Cygwin mailing
> list. At http://cygwin.com/ml/cygwin/2004-06/msg00974.html it says:
>
> "...first kill all running cygwin programs and services. killall script in
> distro and automatic detection of cygwin services
>    still pending."
>
> So, I don't know what to kill. I figured the problem might be due to
> PostgreSQL because of various permissions I had to set (though I never
> risked doing "chmod a+rw /var/log # could adversely affect other daemons" as
> it says at
> http://www.tishler.net/jason/software/postgresql/postgresql-7.3.4.README),
> and because there might be some other special database locking or encryption
> going on.

    Ok, last time.  Basic Windows admin step here.  RIGHT-click in a blank
area of the taskbar and choose 'Task Manager' from the popup menu.
Click the 'Processes' tab in the Windows Task Manager that appears.
This should list every running process in your system.  Click the 'Image
Name' column a few times until the list is sorted alphabetically.  This
makes it easier to see what's truly running on your computer.

    Do you see processes with image names like 'cygrunsrv.exe',
'cygserver.exe', 'ipc-daemon2.exe' or 'postgres.exe'?  If so, click once
on each to highlight, then click [End Process] to kill.  Now try to
delete the remaining Cygwin files.

> I'm thinking of downloading Cygwin again and playing with permissions from
> that console. Yesterday chmod and chown didn't give me an error from the
> Windows command prompt, but today they do. Or maybe I'll add postgres as a
> user again and try stuff from that account.

    That won't work.  Windows NT/2000/XP does not work the way you appear
to think that it does.  Speaking strictly Windows NT/2000/XP here, when
you create a user, Windows generates what is known as a RID (Relative
ID), basically a local 'Social Security Number' if you will.  It then
adds this to the system's SID (System ID), another randomly generated
number which was created when this copy of Windows was installed.  The
SID/RID defines the user, much like a SSN.  The name you see (e.g.,
'postgres') is purely for your benefit.  All the internal references to
the user, such as a file/directory that the user has rights to, stores
only the user's RID.

    When you delete a user, you basically unhook the name from the RID.  If
you then right away create a new user with the same name, guess what?
That's not the same user.  Sure, the name appears the same.  But since
you had to create a 'new user', Windows generated a new RID.  Again,
much like a second Bob coming to work at the same office.  What sets the
Bobs apart is their SSN.

    Anyway, deleting and then creating a user in Windows won't help you,
because whatever file permissions were set are defined for the OLD user,
who is now gone.

> The Cygwin directory appears to take up only 8K, so I guess it's not that
> bad anyway.

    If Cygwin is only taking 8K, then likely you simply need to learn how
to take ownership of a file/directory and then set the rights of that
file/directory so you, as your current user, have rights to hose it.
This is a Windows level issue, not Cygwin.

    You do not seem to grasp this concept, though.  If you are truly logged
into Windows NT/2000/XP as a user who is either the built-in
Administrator account or a user that is a member of the 'Administrators'
group (meaning you're just as powerful as the Administrator account),
you are "god on the box" as it were.  All you have to do is take
ownership of the Cygwin files/folders, then set the rights so you have
'Full Control'.  Then delete them.

Re: Uninstalling PostgreSQL

From
"- Barry -"
Date:
> > Already tried all that. I couldn't get lower than usr/share/data. I
>
> Hmmm.  Sounds like you're reading out of date instructions.  The
> default has been /var/postgresql/data for a bit now.  Used to be
> /usr/share/postgresql/data.

Looks like I do have a lower (higher?) level directory. I guess I missed it
the first time. You could see my cygwin directory tree and the related
pop-ups at http://www.polisource.com/PublicMisc/Cygwin_Problem.html


> I'm referring to the 'Security' tab where you
> specify who the owner of a file/directory is, and what rights each user
> has.

I didn't see a security tab, but I've been trying the options in the
"sharing and security" item in the right-click menu.


> "after trying to delete /cygwin from the postgres user's account
> (before I deleted the account)"?  What does this mean?  You do not
> delete a directory from an account.  Windows is a monolithic directory
> structure, where you have permissions set on who can access what
> folder/file.  If you deleted C:\cygwin, it's gone from the system, not
> from an account.  You do understand this, right?

I meant that I logged on as postgres and tried to delete the cygwin
directory. "From" as in where I was, not where I wanted the file to
disappear from.


> Do you see processes with image names like 'cygrunsrv.exe',
> 'cygserver.exe', 'ipc-daemon2.exe' or 'postgres.exe'?

Nope. A snapshot of my task manager window is on the page I linked to above.


> If Cygwin is only taking 8K, then likely you simply need to learn how
> to take ownership of a file/directory and then set the rights of that
> file/directory so you, as your current user, have rights to hose it.
> This is a Windows level issue, not Cygwin.
> You do not seem to grasp this concept, though.

Yes, I figured I should have that right. I found some Windows utilities that
let me use chown and chmod, but I haven't tried them, plus I know chown and
chmod work from Cygwin, and up until today it looked like they worked
natively at the Windows command prompt. From what people say, it sounded
like I would find the proper tool in the right click menu. I tried.

Not long ago, when I was confused by soft links, or some such beast made a
cygwin file seem to not exist when I looked for it with a Windows tool,
someone told me not to treat Cygwin stuff like Windows stuff and to use the
Cygwin console to find it. Since I'm working with Cygwin-related directories
now, I thought maybe I should use Cygwin commands, but I'll take whatever
advice I could get because for the last two weeks it seems that I couldn't
get anything to work.

> If you are truly logged
> into Windows NT/2000/XP as a user who is either the built-in
> Administrator account or a user that is a member of the 'Administrators'
> group (meaning you're just as powerful as the Administrator account),
> you are "god on the box" as it were.  All you have to do is take
> ownership of the Cygwin files/folders, then set the rights so you have
> 'Full Control'.  Then delete them.

Under "User Accounts", there are two entries:  "Owner computer
administrator" and "Guest guest account is off." I'm the Owner. But somehow,
I don't feel very powerful.

Barry


Re: Uninstalling PostgreSQL

From
"- Barry -"
Date:
I found out that on Windows XP Home, you need to log on in safe mode to get
full access to permission controls when you right click a file, or you have
to use CACLS at the command prompt. I was able to delete the cygwin
directory by logging on in safe mode, though the security tab features were
difficult to understand.

First I tried CACLS from the C:\cygwin directory. I entered:

    CACLS *.* /t /e /g Owner:f

and the response was:

    Processed file: C:\cygwin\Thumbs.db
    The data is invalid

Then I tried:

    del Thumbs.db

and the response was:

    Could not find C:\cygwin\Thumbs.db

Maybe that makes sense. I wasn't sure about the commands. At least it's all
over now.