Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(keepass) - Upgrade Failed And Registered New Version #138

Closed
mattcargile opened this issue May 6, 2022 · 17 comments
Closed

(keepass) - Upgrade Failed And Registered New Version #138

mattcargile opened this issue May 6, 2022 · 17 comments
Labels
waiting on user Waiting on a response from the original poster.

Comments

@mattcargile
Copy link

mattcargile commented May 6, 2022

Chocolatey Version

1.1.0

Chocolatey License

No response

Package Version

2.50 -> 2.51

Current Behaviour

I had Keepass open at the time and I get the below errors inside my shell session.

You have keepass v2.50 installed. Version 2.51 is available based on your source(s).
Progress: Downloading keepass.install 2.51... 100%
Progress: Downloading keepass 2.51... 100%

keepass.install v2.51 [Approved]
keepass.install package files upgrade completed. Performing other installation steps.
Installing keepass.install...
ERROR: Running ["C:\ProgramData\chocolatey\lib\keepass.install\tools\KeePass-Setup.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- ] was not successful. Exit code was '1'. See log for possible error messages.
The upgrade of keepass.install was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\keepass.install\tools\chocolateyInstall.ps1'.
 See log for details.

keepass v2.51 [Approved]
keepass package files upgrade completed. Performing other installation steps.
 The upgrade of keepass was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\keepass'
keepass.install is not installed. Installing...

keepass.install v2.51 [Approved]
keepass.install package files upgrade completed. Performing other installation steps.
Installing keepass.install...
ERROR: Running ["C:\ProgramData\chocolatey\lib\keepass.install\tools\KeePass-Setup.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- ] was not successful. Exit code was '1'. See log for possible error messages.
The upgrade of keepass.install was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\keepass.install\tools\chocolateyInstall.ps1'.
 See log for details.

I had to download the exe manually and run the below.

.\KeePass-2.51-Setup.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-

Expected Behaviour

I would expect the upgrade to succeed.

Steps To Reproduce

  1. choco upgrade all -y
  2. choco upgrade keepass --force -y

Then I had to manually run the exe downloading from the web.

Environment

- Operating System (run `[System.Environment]::OSVersion.ToString()` in a PowerShell session): Microsoft Windows NT 10.0.19043.0
- PowerShell Version (run `$PSVersionTable` in a PowerShell session):
�[32;1mName                           Value�[0m
�[32;1m----                           -----�[0m
PSVersion                      7.2.3
PSEdition                      Core
GitCommitId                    7.2.3
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
- Shell: pwsh.exe

Chocolatey Log

Link to Gist

Anything else?

Previous relevant issue is #73

@pauby
Copy link
Owner

pauby commented May 7, 2022

Just to be clear here, what 'failed to upgrade and registered a new version'?- keepass or keepass.install?

It looks to me that keepass upgraded successfully and keepass.install didn't?

@pauby pauby added the waiting on user Waiting on a response from the original poster. label May 7, 2022
@d-Rickyy-b
Copy link

I got the same issue. This happened to me when keepass was still running in the background while upgrading.

keepass upgraded sucessfully and keepass.install ran into an error.

@pauby
Copy link
Owner

pauby commented May 8, 2022

As I mentioned over at #73, this is expected Chocolatey behaviour.

@d-Rickyy-b
Copy link

Thank you for your reply. Do you have any idea on how to actually upgrade keepass now via chocolatey? The only way I can think of is actually upgrading it manually? If that's default Chocolatey behaviour, that sucks.

@pauby
Copy link
Owner

pauby commented May 9, 2022

If the keepass.install package is broken, then that's an issue I can tackle. But this issue, is expected behaviour.

I've just noticed that v2.51.1 has been pushed to the Community Repository. The release notes (scroll to the bottom) don't make any indication that there was an installer issue. Can you try upgrading to that new version and if you still get the same problem, can you raise an issue indicating that the install / upgrade of that package is broken? Ordinarily I'd test it myself, but I'm not in a position to do that just now.

@mattcargile
Copy link
Author

mattcargile commented May 9, 2022

So I don't understand. Is this package not meant to be upgraded in some way or does the application need to be closed before the upgrade? I thought keepass and keepass.install were essentially the same thing and worked together? How is this the expected behavior? Is it simply that the application can't be upgraded while it is open?

@mattcargile
Copy link
Author

Ok I just went from 2.51.0 to 2.51.1 successfully. I didn't have KeePass open. I thought I had read that the installer was suppose to handle an open process for the application. I guess that isn't the case and you can't upgrade while the application is open. I guess this can be closed.

@pauby
Copy link
Owner

pauby commented May 9, 2022

So I don't understand. Is this package not meant to be upgraded in some way or does the application need to be closed before the upgrade?

The keepass.install package should be able to be upgraded while Keepass is open. This code here allows that.

I thought keepass and keepass.install were essentially the same thing and worked together?

keepass is a virtual package that takes a dependency on keepass.install. The keepass package allows discoverability of the package. keepass.install does the actuall installation of Keepass.

How is this the expected behavior?

Because keepass and keepass.install are two separate packages. One can be upgraded while the other can fail. In this case keepass package was upgraded and the keepass.install package did not.

Is it simply that the application can't be upgraded while it is open?

See the code above that should allow it to close Keepass before updating it. Note that it was added here.

@mattcargile
Copy link
Author

mattcargile commented May 9, 2022

Hmm. Thanks for the explanation! I see. I thought I had read the install was supposed to work while open.

Would it matter the different states KeePass can be in.

  1. Waiting for the Password to the default .kdbx.
  2. Database is Open
  3. Window Open without waiting for Password Entry

I think typically my KeePass stays in a state waiting for the password because I have a timeout on the database staying open.

@pauby
Copy link
Owner

pauby commented May 10, 2022

I've tested:

  1. Waiting for the Password to the default .kdbx.
  2. Database is Open

With the command & 'C:\Program Files\KeePass Password Safe 2\KeePass.exe' --exit-all and they all closed Keepass down.

This one:

  1. Window Open without waiting for Password Entry

I don't know what you mean. Perhaps you can try that.

So perhaps the issue that you were seeing wasn't that Keepass was open, but that the installer was broken (or something else)?

@mattcargile
Copy link
Author

I see. Yeah that is fair. For my number 3, I mean the below state. You essentially just close the password prompt and are left with only this window.

image

I don't know now and it is unclear what happened.

I just ran choco outdated -r and had to update the keepass ( not keepass.install ) package separately which didn't close KeePass.exe as expected like you described earlier.

I'm doing a full uninstall and reinstall. I'm doing choco install keepass.install instead of choco install keepass. This did work correctly. I did a choco.exe install --version=2.50 -y keepass.install and then upgraded. It worked and I received the KeePass is running. Try to close KeePass automatically. If you have unsaved entries, you will be prompted to save them. message.

I wasn't able to test it doing choco.exe install --version=2.50 -y keepass because keepass.install defaults to the most recent version. Maybe another issue or this is the intended behavior?

@pauby
Copy link
Owner

pauby commented May 10, 2022

I just ran choco outdated -r and had to update the keepass ( not keepass.install ) package separately which didn't close KeePass.exe as expected like you described earlier.

The only thing the keepass package does is install keepass.install package. So it won't close Keepass. The keepass.install package does the heavy work.

I wasn't able to test it doing choco.exe install --version=2.50 -y keepass because keepass.install defaults to the most recent version. Maybe another issue or this is the intended behavior?

If you run choco.exe install --version=2.50 -y keepass then Chocolatey CLI will try and install version 2.50 of the keepass package if that version, or greater, is not already installed. That version of the keepass package will try to install, at a minimum, version 2.50 of keepass.install. So the steps will be:

  1. Download the keepass package version 2.50.
  2. Look at the keepass package and see that it has a dependency on keepass.install, minimum version 2.50.
  3. Check to see if you have keepass.install installed. If you do, checks the version. If it's 2.50 or later, it does nothing and moves onto step 4. If you don't have keepass.install installed or the version you have installed is less than 2.50, it will install the latest version of keepass.install that is at least 2.50 (so in your case 2.51.1).
  4. Install the keepass package.

So, if you have these version of keepass.install, this will happen:

  • Version 2.49: install the latest available version that is at a minimum version 2.51.1.
  • Version 2.50: do nothing as the dependency says 2.50 as a minimum, which you have.
  • Version 2.51: do nothing as the dependency says 2.50 as a minimum, which you have.
  • Version 2.51.1: do nothing as the dependency says 2.50 as a minimum, which you have.

Just to be clear, this is how all package managers work, not just Chocolatey.

Does this help?

@mattcargile
Copy link
Author

mattcargile commented May 10, 2022

I get that. Thanks for the robust explanation! 👍

I would expect choco.exe install --version=2.50 -y keepass to install v2.5.0 for keepass and keepass.install. So what we are saying is that the --version parameter has an implied "minimum" attached to it. Or is this only the case on virtual packages like keepass? In the current state, I end up with keepass v2.5.0 and keepass.install v2.5.1. So I end up with two "packages" on different versions. This is in opposition to choco install --version=2.50 -y keepass.install which actually installs 2.5.0.

This is a separate issue to the reason I opened this case. I can't repro the issue I had.

@pauby
Copy link
Owner

pauby commented May 11, 2022

I would expect choco.exe install --version=2.50 -y keepass to install v2.5.0 for keepass and keepass.install.

That's not what happens. If you look at the dependencies on the page for the keepass package you can see that it says >= 2.50. So if a version 2.50 of keepass.install is installed that matches this (ie. 2.50 or later) then the dependency is met and it moves on.

Note that on the command line choco.exe install --version=2.50 -y keepass you are saying 'install keepass version 2.50'. You're NOT saying 'install keepass.install version 2.50'.

So what we are saying is that the --version parameter has an implied "minimum" attached to it.

No. The --version parameter is absolute for the packages you specify on the command line.

Or is this only the case on virtual packages like keepass?

If you look at the dependency in the nuspec file inside the package, you'll see this line:

<dependency id="keepass.install" version="2.50" />

There are different formats for that line which you can see in the Microsoft docs (the Chocolatey .nuspec format is a modified one from Microsoft's Nuget format). Because I just have 2.50 in quotes it means 'Minimum version, inclusive'.

So the implied minimum for keepass.install comes from that dependency line in the keepass package. The absolute version comes from the --version parameter on the choco command line.

In the current state, I end up with keepass v2.5.0 and keepass.install v2.5.1. So I end up with two "packages" on different versions. This is in opposition to choco install --version=2.50 -y keepass.install which actually installs 2.5.0.

That's correct.

This is a separate issue to the reason I opened this case. I can't repro the issue I had.

I agree. But you had good, genuine, questions and I wanted to try and help even though we're way off-topic 😄

Does that additional explanation, above, help?

@mattcargile
Copy link
Author

Yes, very helpful! Thanks, Paul! I'll close for now. We'll see if I have this issue in the future. For some reason, the Choco Before Modify didn't fire or maybe it did and couldn't "find" keepass.exe running for whatever reason.

@pauby
Copy link
Owner

pauby commented May 11, 2022

See the docs for when the individual scripts are run. The chocollateyBeforeModify.ps1 doesn't run on install, only upgrade and uninstall.

@mattcargile
Copy link
Author

Right. This issue was related to the choco upgrade. Originally, I didn't notice the KeePass is running. Try to close KeePass automatically. If you have unsaved entries, you will be prompted to save them. message. within the terminal output. When I attempted to repro the issue I did see this message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on user Waiting on a response from the original poster.
Projects
None yet
Development

No branches or pull requests

3 participants