Check cygwin not in use before updating

September 7th, 2020

Periodically I like to update cygwin, add a new package or update an existing package. One annoying thing about updating cygwin is that if any cygwin files are in use (such as one of its dll files) when you perform the update the setup will complain it can’t overwrite the dll and tell you that you will need to reboot after the installation is over. This often happens to me because I have an ssh server and X server running. Before updating cygwin I need to stop those. It may also be possible that I’m still running an ssh-agent or some other process.

I have found that it is possible to figure out ahead of time if any of the cygwin dll files are in use.

The trick is to use the excellent “unlocker” (or similar) utility. The primary purpose of unlocker is to let you know why you can’t delete a file, which process is locking it. You can use this information to see which processes and still using cygwin, and then you can decide how to terminate them.

For example, if your ssh server is still running you can do “net stop cygsshd” in an admin prompt. To stop the syslogger do: “net stop syslog-ng”

After you have unlocker installed, when it is time to update cygwin first use Windows Explorer to navigate to directory

c:\cygwin64\bin

Look for:

cygwin1.dll

Right click on “cygwin1.dll” and choose “unlocker”. Windows may prompt you for admin roots so approve that.

Then you will get a window showing all the processes that are using cygwin. I recommend trying to shut them all down the “normal” way, exit bash shells, stop your ssh server, stop your “X server” by right clicking in the system tray and exiting. If you can’t figure out a graceful way to exit then you can use unlocker to kill those processes.

Once unlocker shows that no more processes are using cygwin then you can proceed with an install knowing that nothing will be locked and you won’t need to reboot after the installation.

After the install/update is done you’ll want to restart things like:

net start syslog-ng
net start cygsshd

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.