itchio / itch

🎮 The best way to play your itch.io games
https://itch.io/app
MIT License
2.38k stars 211 forks source link

When MSI package already installed from different source, /i fails with 1603 #1304

Closed kg closed 7 years ago

kg commented 7 years ago

I can't find an accurate list of them anywhere.

EDIT: Another option would be better error handling for this. Right now a nonexistent prereq makes the game fail to start, and it's a pain to trial-and-error debug manifests since you have to wait for a butler deploy every time.

fasterthanlime commented 7 years ago

The official list is here: https://itch.io/docs/itch/integrating/manifest.html

I agree better error handling is needed - and more prereqs, too. Next on the list is sorting out the VC2015/VC2017 snafu.

kg commented 7 years ago

Is that list correct? xna-4.0 appears to be a supported prereq (but it doesn't work).

fasterthanlime commented 7 years ago

(but it doesn't work).

Do you have any more details? What exactly happens when you run a game with xna-4.0 as a prereq?

Also: can you post a screenshot of your "Add & remove programs" control panel window (it's accessible even in Windows 10, under a "Program & features" button) when searching for "XNA" ?

Which version of Windows are you trying this on?

fasterthanlime commented 7 years ago

Giving this a shot today as #1307

Still curious what exactly happens for you with the xna-4.0 prereq!

kg commented 7 years ago

I reported the resulting failure using the itch app's problem reporter, but I don't know where it went. The prereq install just fails with error 1 after downloading it.

fasterthanlime commented 7 years ago

Seeing it now, thanks (at https://github.com/itchio/itch-compatibility-watchlist/issues/1049 )

Can you also post this?

Also: can you post a screenshot of your "Add & remove programs" control panel window (it's accessible even in Windows 10, under a "Program & features" button) when searching for "XNA" ?

kg commented 7 years ago
screenshot 2017-07-13 01 14 04
fasterthanlime commented 7 years ago

If you download http://dl.itch.ovh/itch-redists/xna-4.0/xnafx40_redist.msi and double-click on it, what exactly happens?

kg commented 7 years ago

It gives me the options to Repair and Remove the existing installation.

fasterthanlime commented 7 years ago

I've got one more thing I'd like you to do if that's ok:

(I've tried reproducing locally but I just can't seem to get it to fail - tried with 1) no redist 2) another version of xna4 installed 3) the exact same version installed and it just always succeeds for me).

For the future, I'll start collecting logs by default for MSI installs, see https://github.com/itchio/butler/issues/110

kg commented 7 years ago

log.txt It's not obvious to me why it failed from this log, but it's suspicious that it mentions a nonexistent path in E:\Downloads, probably where the XNA installer was when I first ran it.

fasterthanlime commented 7 years ago

Nice! Renaming my xnafx40_redist.msi to something else and installing quietly again gives me a similar log - these are the important lines:

MSI (s) (28:58) [02:45:58:293]: PROPERTY CHANGE: Adding SourceDir property. Its value is 'E:\Downloads\'.
MSI (s) (28:58) [02:45:58:293]: PROPERTY CHANGE: Adding SOURCEDIR property. Its value is 'E:\Downloads\'.
MSI (s) (28:58) [02:45:58:293]: PROPERTY CHANGE: Adding SourcedirProduct property. Its value is '{D69C8EDE-BBC5-436B-8E0E-C5A6D311CF4F}'.
MSI (s) (28:58) [02:45:58:293]: SOURCEDIR ==> E:\Downloads\
MSI (s) (28:58) [02:45:58:293]: SOURCEDIR product ==> {D69C8EDE-BBC5-436B-8E0E-C5A6D311CF4F}
MSI (s) (28:58) [02:45:58:293]: Determining source type
MSI (s) (28:58) [02:45:58:293]: Note: 1: 2203 2: E:\Downloads\XNA Framework 4.0 Redist.msi 3: -2147287038 
MSI (s) (28:58) [02:45:58:293]: Note: 1: 1316 2: E:\Downloads\XNA Framework 4.0 Redist.msi 
MSI (s) (28:58) [02:45:58:293]: SECREPAIR: Error determining package source type
MSI (s) (28:58) [02:45:58:293]: SECUREREPAIR: SecureRepair Failed. Error code: 524B495E590

I'm going to see if there's anything we can do to prevent that - the bad news is that 1603 just means "A fatal error occurred during installation.", so I don't feel good about just adding it as an accepted exit code (a completely failed installation might return the same code).

kg commented 7 years ago

Perhaps there's some way to just specifically query the installation state? If so, you can just detect that it was already installed and leave it alone. In this case it seems to be trying to do a silent repair, which fails because the source install package is gone.

kg commented 7 years ago

For what it's worth, start /wait msiexec /quiet /norestart /fp xnafx40_redist.msi /l*v log.txt worked for me. fp is 'repair only if file is missing', though I'm not sure that's what you actually want.

I'm guessing that will fail if it's not already installed, in which case you can fall back on /i? The downside is that it does seem to do some of the work of repairing - it took a few seconds.

fasterthanlime commented 7 years ago

Uninstalling /x then re-installing /i seems to do the trick, but I don't feel good about that solution.

Perhaps there's some way to just specifically query the installation state?

The redist format has a bunch of ways to check already:

The registry key approach is not foolproof however, since many versions of redists with slightly different version numbers tend to write to completely different registry keys.

Since that particular issue only happens when you install the exact same version of the MSI (but from a different path), I'll look into retrieving the product ID from the .msi file and then looking at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

fasterthanlime commented 7 years ago

I'm guessing that will fail if it's not already installed, in which case you can fall back on /i? The downside is that it does seem to do some of the work of repairing - it took a few seconds.

Combining that with the HKLM\...\Uninstall approach sounds good :+1:

fasterthanlime commented 7 years ago

Actually, /fp wouldn't completely repair the install, /fpecmsu would though (but then we're back to the 1603 exit code). I wonder which of these flags actually triggers the 1603. Researching..

kg commented 7 years ago

Incidentally, the other prereq I was really looking for was a .NET framework prereq, and I couldn't find one. XNA seems like it would have to imply .NET, since it's a set of .NET libraries. What do you recommend to tackle that?

fasterthanlime commented 7 years ago

Actually, /fp wouldn't completely repair the install, /fpecmsu would though (but then we're back to the 1603 exit code). I wonder which of these flags actually triggers the 1603. Researching..

Looks like /fpmsu would work. The missing flags are respectively:

I guess the paranoid way would be to go with /fa (replace All files) but I think /fp (replace missing files) is enough for that.


Incidentally, the other prereq I was really looking for was a .NET framework prereq, and I couldn't find one. XNA seems like it would have to imply .NET, since it's a set of .NET libraries. What do you recommend to tackle that?

I'm pretty sure that's why I didn't list xna-4.0 in the prereqs documentation in the first place.

We have an other open issue for .NET, quite detailed too: https://github.com/itchio/itch/issues/1061 - since I'm already elbows-deep in prereqs today I guess I'll just add them all.


By the way, I think this issue is actually a duplicate of https://github.com/itchio/itch/issues/1096 - but we actually found the real cause this time, so thanks a bunch 🌟

fasterthanlime commented 7 years ago

Quick status update: making good progress on this, I'm moving to the MSI API which allows finer control over the prereq install process, and I found another incantation which works all the time (no need to poke the registry and switch between /i and /fpmsu).

Also adding a butler test-prereqs foo bar baz command so one can run them from the terminal directly, that'll make any future errors easier to debug.

fasterthanlime commented 7 years ago

(Also: exit codes are now (not deployed yet) properly handled, logging actually flows to the app now (the tricky bit is that butler runs as administrator while installing prereqs, so stdout/stderr aren't accessible by itch. I was already using a named pipe to communicate, now logs messages will go through there too)

fasterthanlime commented 7 years ago

Quick teaser of test-prereqs - it lists the known prereqs when none are specified:

test-prereqs

bjorn commented 7 years ago

@fasterthanlime Looks great, but just to be sure that you noticed: the column headers are in the wrong order. :-)

fasterthanlime commented 7 years ago

Alright @kg, butler v6.0.0 is up along with updated itch-redists definitions, that should definitely solve https://github.com/itchio/itch-compatibility-watchlist/issues/1049 - I'm adding the .NET redists right now (feel free to open separate issues if what you want isn't listed already in the prereqs label).

I'll expand the Prerequisites documentation in the itch docs and document the new butler commands in the butler docs.

fasterthanlime commented 7 years ago

(To have your itch app update to the latest butler, you just need to Quit the app (Ctrl+Q or User menu -> Quit or right click on tray icon -> Quit - not just close the window), and start it up again.

fasterthanlime commented 7 years ago

@kg .NET frameworks 4.5.2 and 4.6 are available, see the new prereqs documentation for names & details.