Skip to content

Windows: "Tailscale backend error: failed to look up user from userid: lookupUserPrimaryGroup: should be domain account type, not 5" #2894

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

Closed
oselz opened this issue Sep 21, 2021 · 14 comments
Assignees
Labels
L2 Few Likelihood OS-windows Issues involving Tailscale for Windows P3 Can't get started Priority level T6 Major usability Issue type

Comments

@oselz
Copy link

oselz commented Sep 21, 2021

Report from a user on windows trying 1.14.3 but getting this error message:
image (1)

There is no option to log in, the error is raised immediately upon executing the Tailscale client. Uninstall/reinstall/restart do not fix it.

A forum report from 2018 shows the same issue: https://forum.tailscale.com/t/backend-error-failed-to-look-up-user-from-userid/474

I have checked the domain account of the affected user, and a Primary Group is set correctly for the user at the domain level, but I cannot confirm what it looks like on the actual device.

The actual error message is generated here: https://github.com/golang/go/blob/30faf968b1f348e944db3bde24c13462125007b1/src/os/user/lookup_windows.go#L238

There was a similar bug in #869, with a workaround applied in #871 but as the exact error is different the workaround is not being applied in this case. If the domain information is not important perhaps the workaround could be extended to cover this case as well?

@DentonGentry
Copy link
Contributor

From https://golang.org/src/syscall/security_windows.go, type 5 appears to be SidTypeWellKnownGroup

https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-sid_name_use says that SidTypeWellKnownGroup means, "A SID for a well-known group."
Thanks, Microsoft.

Other searches imply that SidTypeWellKnownGroup is used for groups like "Everyone"

@oselz
Copy link
Author

oselz commented Sep 21, 2021

The Primary Group in this case is 'Domain Users' (the default).

@DentonGentry
Copy link
Contributor

https://github.com/golang/go/blob/30faf968b1f348e944db3bde24c13462125007b1/src/os/user/lookup_windows.go#L238 is just returning a fmt.Errorf() string, not something we can check with Is().

I think it would be fine to handle this as another ("unknown-user-" + uid) workaround, but I think we'd have to look at the text of the error message to trigger that workaround.

@oselz
Copy link
Author

oselz commented Sep 22, 2021

Reading the comment in the go source immediately below the error message point indicates this is possibly an upstream bug?

There is code to cover this exact case, but I'm unsure how it can actually be reached as the comparison to SidTypeDomain will always fail. It should probably be t != syscall.SidTypeDomain || t!= syscall.SidTypeWellKnownGroup instead.

@DentonGentry DentonGentry added L2 Few Likelihood OS-windows Issues involving Tailscale for Windows P3 Can't get started Priority level T6 Major usability Issue type and removed needs-triage labels Sep 23, 2021
@oselz
Copy link
Author

oselz commented Oct 4, 2021

If anyone else is having this issue - the user informed me they found a temporary workaround assuming you have local pc administrator access:

  • create a new local user account on the computer
  • set up Tailscale from that new account
  • return to the domain account and Tailscale will now start (despite the error).

Note I have not confirmed whether this works as described.

@dblohm7
Copy link
Member

dblohm7 commented Nov 22, 2021

Filed upstream: golang/go#49509

@bradfitz
Copy link
Member

@dblohm7, we can also send a fix to upstream and then cherry-pick it into our Go tree. (No need to be bound by the Go release cycle)

@freezscholte
Copy link

Also having the same bug here only the difference is domain user type 1 and not 5. It worked perfectly fine until this morning

@freezscholte
Copy link

Oke created the local admin account and started tailscale.exe with runas as the new local admin then it works in the AzureAD profile

@freezscholte
Copy link

Also when using the tailscale ping command I get the same error
image

@freezscholte
Copy link

Update: I looked back when it broke and this was when I added another local admin for some testing purpose. When I removed this local admin completely and rebooted the laptop my Tailscale started working again in my normal AzureAD profile. Also one detail if you look at the output of "whoami" it says "Contoso\user" and the new local admin name was just "contoso". Maybe when looking up the SID/Account name something in the Go code gets fuzzy and then gives an error since there is a correlation in the names.

@dblohm7 dblohm7 self-assigned this May 19, 2022
@DentonGentry
Copy link
Contributor

https://github.com/MicrosoftDocs/azure-docs/issues/38048 mentions this issue in Tailscale, and says:
"This a known gap, that we're reviewing. Even though you have migrated the user from AD to Azure AD, the onprem SamAccountName is still intact on the user object, among other on-prem AD attributes. As a result, Azure AD picks those details and shows domain/user instead of AzureAD/user. This attribute cannot be modified or cleared through Graph APIs at this point, so there's no way to change the behavior"

@DentonGentry
Copy link
Contributor

Internal discussion: "I have a PR against the standard library for #2894"

I don't immediately have a link to that PR but will edit this comment later if I find it.

dblohm7 added a commit that referenced this issue Nov 24, 2022
…to address os/user.LookupId errors on Windows

I added util/winutil/LookupPseudoUser, which essentially consists of the bits
that I am in the process of adding to Go's standard library.

We check the provided SID for "S-1-5-x" where 17 <= x <= 20 (which are the
known pseudo-users) and then manually populate a os/user.User struct with
the correct information.

Fixes #869
Fixes #2894

Signed-off-by: Aaron Klotz <[email protected]>
dblohm7 added a commit that referenced this issue Nov 25, 2022
…to address os/user.LookupId errors on Windows

I added util/winutil/LookupPseudoUser, which essentially consists of the bits
that I am in the process of adding to Go's standard library.

We check the provided SID for "S-1-5-x" where 17 <= x <= 20 (which are the
known pseudo-users) and then manually populate a os/user.User struct with
the correct information.

Fixes #869
Fixes #2894

Signed-off-by: Aaron Klotz <[email protected]>
@oselz
Copy link
Author

oselz commented Dec 7, 2022

Can confirm that as of the newly released Windows client version 1.34.0 the original error no longer occurs.

Thank you.

coadler pushed a commit to coder/tailscale that referenced this issue Feb 2, 2023
…to address os/user.LookupId errors on Windows

I added util/winutil/LookupPseudoUser, which essentially consists of the bits
that I am in the process of adding to Go's standard library.

We check the provided SID for "S-1-5-x" where 17 <= x <= 20 (which are the
known pseudo-users) and then manually populate a os/user.User struct with
the correct information.

Fixes tailscale#869
Fixes tailscale#2894

Signed-off-by: Aaron Klotz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Few Likelihood OS-windows Issues involving Tailscale for Windows P3 Can't get started Priority level T6 Major usability Issue type
Projects
None yet
Development

No branches or pull requests

5 participants