Old 16th August 2014, 23:06   #1
QX100
Junior Member
 
Join Date: Aug 2014
Posts: 4
NSIS:Uninstall does not work on a remote system

Hi all,

I have a question regarding NSIS Uninstall script.

I run install&uninstall command on a remote windows system from linux by using ssh with cygwin (expect) command. I need to install&uninstall an application many times on the same system. Install always works. But uninstall worked once and never worked since then on the same system. If I change to a different windows system, the result is the same. Uninstall works one time only although install is always successful.

When uninstall command is sent, C:\Users\Administrator\~nsu.tmp\Au_.exe, which is a copy of my Uninstall.exe, is created, but Au_.exe seems to be aborted immediately since I don't see it in task manager. It does not reach to the uninstaller code I wrote. At the beginning of my uninstaller code (inside un.onInit), I put debugging code that creates a file, but it is not created.

If I manually run Uninstall.exe from cygwin or from GUI on a windows system, it always runs successfully. It contains multiple NSIS uninstallers, and I see Au_.exe, Bu_.exe, Cu_.exe and Du_.exe under C:\Users\Administrator\~nsu.tmp on successful execution.
Is there any checking at the beginning of Au_.exe? I suspect that it checks something and aborts uninstall. I checked files and registry but didn't find anything suspicious. Do you know what causes this issue?

This is reproducible on NSIS2.46.
Windows: windows7


Could someone please help?
QX100 is offline   Reply With Quote
Old 17th August 2014, 19:59   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,195
What is the exit code of the uninstaller process? (Process Monitor can tell you)

Can you try just putting a MessageBox at the start of un.onInit?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th August 2014, 03:27   #3
QX100
Junior Member
 
Join Date: Aug 2014
Posts: 4
Exit status of Au_.exe is -1073741502

Thank you for the reply.

Here are the exit status from Process Monitor.

[command sent from remote host - uninstall didn't occur]
Uninstall.exe: Exit Status: 0
Au_.exe: Exit Status: -1073741502

[ manual run on a local windows system with cygwin - uninstall succeeded]
Uninstall.exe: Exit Status: 0
Au_.exe: Exit Status: 4

Uninstall.exe that is my uninstaller exits with 0 for both cases. However, Au_.exe returns 4 for successful uninstall and -1073741502 for failure. Is 4 successful status?

I put a Message Box, but it didn't appear for remote case. So Au_.exe exits before un.onInit.
QX100 is offline   Reply With Quote
Old 18th August 2014, 16:04   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,195
I think a simple installer/uninstaller should exit with 0 for all processes:

Quote:
InstallDir "$temp\Test"
Page InstFiles
UninstPage UninstConfirm
UninstPage InstFiles
Section
SetOutPath "$InstDir"
WriteUninstaller "$InstDir\Uninst.exe"
SectionEnd
Section -Uninstall
Delete "$InstDir\Uninst.exe"
RMDir "$InstDir"
SectionEnd

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th August 2014, 21:16   #5
QX100
Junior Member
 
Join Date: Aug 2014
Posts: 4
What does exit code 4 mean? I have un.onUninstSuccess that creates a file to indicate that uninstall is correctly done. With exit status 4, un.onUninstSuccess is called, and a file is created. So I thought that the first uninstall was successful. Does the exit status of previous uninstall affect the execution of next uninstall?

I'm comparing the output of Process Monitor of successful uninstall, which might not be successful, with the one that uninstall didn't occur.
QX100 is offline   Reply With Quote
Old 18th August 2014, 22:28   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,195
0 is success, 1 is user abort and 2 is script abort if I remember correctly.

Are you or some of your code using SetErrorLevel?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st August 2014, 07:18   #7
QX100
Junior Member
 
Join Date: Aug 2014
Posts: 4
Thanks, Anders. Our code uses SetErrorLevel. Some commands failed, and ErrorLevel was set to 4. I fixed all these failure, and successful uninstall finally exits with 0. But the failure of uninstall through ssh still persists.

One thing I found is that removing some files and folders created during installation make it work.

They are under c:\Users\Administrator. I saw around 10 folders and 8 files when uninstall failed. One folder and one file are created per one installation.

folders are like
{6DC145AF-C0D6-4C2B-96BA-7B661DB13837}
{12F6EE97-88F2-4673-ADD0-2FB26245F32C} ...
files are like
DMI4D0F.tmp
DMI54A0.tmp ...

If I remove all of them, uninstall starts to work. When I run install/uninstall many times, and those folders and files are accumulated, uninstall starts to fail. I'm not sure there is a limitation to create those under this folder. But this way works on VMware only. Real machine still has the issue. I will dig into more.
QX100 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
nsis, remote, uninstall

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump