winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

installation of a clashing package name requires admin privilege, and machine scoped install won't work

Open yilmazdurmaz opened this issue 3 years ago • 3 comments

Brief description of your issue

winget install nano (for the editor) tell me there are two packages having the word nano in them. then trying to install the correct package, gnu.nano, gives error telling admin privilege is required.

in such a case, installing it as admin does not install it machine scoped.

Steps to reproduce

  • open user terminal and issue the command winget install nano
    • this gives error/warning that multiple packages have "nano" in their names
  • then try with the correct id/name: winget install gnu.nano (or with --id gnu.nano)
    • strike 1 - this tells this operation needs admin priveleges
  • open admin terminal and use winget install gnu.nano to install
  • open a new user terminal and try the command.
    • realize the install was only for the admin since the default scope is "user"
  • open admin terminal again, remove user scoped install and install with --scope machine
  • open another new user terminal and try the command.
    • strike 2 - user still cannot see the installed nano command.

Expected behavior

the installation should work without any admin privilege, or at least it should have worked for the user after privileged install.

Actual behavior

user could not use the package even after installed by admin

Environment

Windows Package Manager v1.3.2691
Windows: Windows.Desktop v10.0.19044.2130
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2691.0

yilmazdurmaz avatar Oct 20 '22 18:10 yilmazdurmaz

Is this possibly related to https://github.com/microsoft/winget-cli/issues/2498 ?

Trenly avatar Oct 21 '22 02:10 Trenly

Is this possibly related to #2498 ?

I am not sure. A bit long to read, so give me time to see if related. But I shall say it will be only half the problem where "privileged machine scoped install still not seen by user"

until I can grasp what that thread talks about, I have this to add: machine scoped install path is added to system's path, c:\Program Files\WinGet\Links\ for some reason environment did not see that change. this might be caused by one of the latest updates (win 10), but I would urge you to check if your path update on "first install" triggers this environment change.

now at least we know half of the problem, you may focus mainly on "requires admin privilege" part because --scope user also does not work (asks for admin privilege).

yilmazdurmaz avatar Oct 21 '22 08:10 yilmazdurmaz

Is this possibly related to #2498 ?

ok now, I can confirm second half of the issue is related to that one with a small difference; it also happens for machine-scoped installation.

for the first half of the issue; I had installed gitui prior to gnu.nano and that did not asked for any privilege. then I assumed there is a problem with the package name.

I saw posts talking about some portable packages required admin privilege to install as they are said they need linking. I am not an expert on that, so please check that too. In such a case, I would expect a better error message than a "privilege required"

yilmazdurmaz avatar Oct 21 '22 09:10 yilmazdurmaz