python / cpython

The Python programming language
https://www.python.org
Other
63.35k stars 30.34k forks source link

Windows Python installer rolls back when run under SYSTEM account (SCCM) #73219

Open e6cad84e-fa58-4dbd-9a23-9a5afbf3fb3d opened 7 years ago

e6cad84e-fa58-4dbd-9a23-9a5afbf3fb3d commented 7 years ago
BPO 29033
Nosy @pfmoore, @tjguk, @zware, @zooba
Files
  • python352logs.zip: logs and install scripts/unattend.xml
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/zooba' closed_at = None created_at = labels = ['type-bug', 'expert-installation', 'OS-windows'] title = 'Windows Python installer rolls back when run under SYSTEM account (SCCM)' updated_at = user = 'https://bugs.python.org/MrBJones' ``` bugs.python.org fields: ```python activity = actor = 'Jurko.Gospodneti\xc4\x87' assignee = 'steve.dower' closed = False closed_date = None closer = None components = ['Installation', 'Windows'] creation = creator = 'Mr B Jones' dependencies = [] files = ['45980'] hgrepos = [] issue_num = 29033 keywords = [] message_count = 6.0 messages = ['283726', '284190', '284236', '284237', '284285', '377041'] nosy_count = 6.0 nosy_names = ['paul.moore', 'tim.golden', 'Jurko.Gospodneti\xc4\x87', 'zach.ware', 'steve.dower', 'Mr B Jones'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue29033' versions = ['Python 3.5'] ```

    e6cad84e-fa58-4dbd-9a23-9a5afbf3fb3d commented 7 years ago

    Hi, When I try to use the Python 3.5 and later installer for windows to make an automated unattended install via SCCM, it seems to work, but some time later it rolls back leaving only a few files installed (seems to be pip.exe and friends).

    I have attached all the Python installer logs from a test machine from the temp folder used by the SYSTEM account (%SystemRoot%\Temp).

    Manually installing from an account which is a member of the Administrators group works fine (not for 800+ machines though). Thanks, Bryn

    zooba commented 7 years ago

    Thanks. I finally got a chance to look at these logs - apologies for taking some time.

    It looks like some of the installs succeeded and others were then trying to modify the existing installation (I *think* this is why the unattend.xml file had no effect).

    This has hit a particular known problem where a quiet per-machine install when one already exists will uninstall packages, rather than quickly exiting because it's already up to date. I haven't been able to figure out the cause before, but your logs have given me some more information to work with, so thank you :)

    I don't see any problem here with the first installation, so provided you do not try to run it a second time, I think it should be fine. Perhaps you can add your own pre-check to the batch file or SCCM to skip it? Meanwhile, I'll try and figure out a good solution to the underlying issue.

    e6cad84e-fa58-4dbd-9a23-9a5afbf3fb3d commented 7 years ago

    All those logs came from one machine. SCCM is usually really good at detecting the existence of an install by checking the package GUID in the windows installed database, but getting the right GUID when dealing with a non-msi install is sometimes hit and miss (with a pure MSI install, it just pulls everything out of the MSI automagically). It can also check for the existence of files/folders, and files with particular version numbers embedded in them (though windows seems to display these version number differently than SCCM sees them sometimes).

    In this case I guess I got the wrong GUID, so it went on re-trying the install, and all bets were then off. Usually the easiest way to get this right if it isn't automatic from the MSI is install the package then look in the registry for an uninstall or modify string which looks like "msiexec /x {GUID HERE}", but if I remember correctly (and it has been a couple of weeks so I could be thinking of the wrong package), the python installer doesn't do that.

    When I'm back in work (from 9th), I can try it again SCCM.

    Thanks for all your assistance. Bryn

    e6cad84e-fa58-4dbd-9a23-9a5afbf3fb3d commented 7 years ago

    Windows Installer database even (autocorrect got me on the work iPhone). Thanks again, Bryn

    zooba commented 7 years ago

    Does SCCM support dependency provider keys? If so, Python 3.6.0 and 3.5.3 and later will set one of these (see bpo-28846), which should make it easier to detect the whole bundle. Previous versions of 3.5 used a random GUID here.

    I managed to reproduce the issue on a test machine by running a per-user install as admin, then the per-machine install. I tried a few ideas to treat the per-user and per-machine installs more distinctly, but nothing seems to work well. Most likely, I'll just have to add a more serious block when there's an existing install and prevent the second bad installation, though I haven't yet figured out how to do that.

    335075a5-9147-4ab8-9a54-c8e4934a7d22 commented 4 years ago

    This seems related to https://bugs.python.org/issue41800.