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

Copy netapi32.dll from servercore image in nano-based Windows image #9006

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

L3n41c
Copy link
Member

@L3n41c L3n41c commented Aug 27, 2021

What does this PR do?

Copy netapi32.dll from servercore Windows image into nano-based agent Windows image.

Motivation

Fix the following failure:

panic: Failed to load netapi32.dll: The specified module could not be found.

goroutine 1 [running]:
syscall.(*LazyProc).mustFind(...)
	c:/go/src/syscall/dll_windows.go:320
syscall.(*LazyProc).Addr(...)
	c:/go/src/syscall/dll_windows.go:327
syscall.NetGetJoinInformation(0x0, 0xc00061fa48, 0xc00061fa44, 0x16, 0xc0000c96e0)
	c:/go/src/syscall/zsyscall_windows.go:1804 +0x107
os/user.isDomainJoined(0xc00061faa0, 0xf3624e, 0x0)
	c:/go/src/os/user/lookup_windows.go:18 +0x5a
os/user.lookupFullName(0xc000063b30, 0xc, 0xc000259bc0, 0x16, 0xc0000c96e0, 0x23, 0x16, 0xc0000c96e0, 0x23, 0x1)
	c:/go/src/os/user/lookup_windows.go:51 +0x2d
os/user.newUser(0xc000063ad0, 0xc, 0xc000063b10, 0xc, 0xc0000c9680, 0x1f, 0xc000259bc0, 0x16, 0xc000063b30, 0xc, ...)
	c:/go/src/os/user/lookup_windows.go:181 +0xd4
os/user.current(0x0, 0x0, 0x0)
	c:/go/src/os/user/lookup_windows.go:225 +0x2d8
os/user.Current.func1()
	c:/go/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x593ff00, 0x40b75b0)
	c:/go/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
	c:/go/src/sync/once.go:57
os/user.Current(0xc0002599c0, 0x1b, 0x3f56005)
	c:/go/src/os/user/lookup.go:15 +0x105
github.com/golang/glog.init.1()
	C:/gomodcache/github.com/golang/[email protected]/gomodcache/github.com/golang/[email protected]/glog_file.go:63 +0x4b

Additional Notes

This ugly hack is needed because the bump of github.com/dgraph-io/ristretto from 0.0.3 to 0.1.0 introduced a new dependency to glog which is triggering this issue with the Windows nano docker image.

Once the Windows nano issue is solved, this hack can be reverted.

Describe how to test your changes

Start the non-servercore Windows docker image.
It shouldn’t panic anymore.

Checklist

  • A release note has been added or the changelog/no-changelog label has been applied.
  • The need-change/operator and need-change/helm labels has been applied if applicable.
  • The appropriate team/.. label has been applied, if known.
  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • The config template has been updated if applicable.

Note: Adding GitHub labels is only possible for contributors with write access.

@L3n41c L3n41c added this to the 7.31.0 milestone Aug 27, 2021
@L3n41c L3n41c requested review from a team as code owners August 27, 2021 14:03
@L3n41c L3n41c force-pushed the lenaic/fix_windows_nano_netapi32 branch 2 times, most recently from 8df1756 to ff81bee Compare August 27, 2021 14:24
@L3n41c L3n41c force-pushed the lenaic/fix_windows_nano_netapi32 branch from ff81bee to 1c04784 Compare August 30, 2021 14:06
@@ -10,6 +16,11 @@ USER ContainerAdministrator

SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]

RUN if (-not (Test-Path /Windows/System32/netapi32.dll)) { \
Copy-Item /netapi32.dll -Destination /Windows/System32/netapi32.dll \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Move-Item

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

Note that this doesn’t remove the need for the if as both are failing to overwrite an existing file:

Step 7/7 : RUN Move-Item /netapi32.dll -Destination /Windows/System32/netapi32.dll -Force
 ---> Running in 62d4374fc7ec
Move-Item: Cannot create a file when that file already exists.

To fix the following failure:
```
panic: Failed to load netapi32.dll: The specified module could not be found.

goroutine 1 [running]:
syscall.(*LazyProc).mustFind(...)
	c:/go/src/syscall/dll_windows.go:320
syscall.(*LazyProc).Addr(...)
	c:/go/src/syscall/dll_windows.go:327
syscall.NetGetJoinInformation(0x0, 0xc00061fa48, 0xc00061fa44, 0x16, 0xc0000c96e0)
	c:/go/src/syscall/zsyscall_windows.go:1804 +0x107
os/user.isDomainJoined(0xc00061faa0, 0xf3624e, 0x0)
	c:/go/src/os/user/lookup_windows.go:18 +0x5a
os/user.lookupFullName(0xc000063b30, 0xc, 0xc000259bc0, 0x16, 0xc0000c96e0, 0x23, 0x16, 0xc0000c96e0, 0x23, 0x1)
	c:/go/src/os/user/lookup_windows.go:51 +0x2d
os/user.newUser(0xc000063ad0, 0xc, 0xc000063b10, 0xc, 0xc0000c9680, 0x1f, 0xc000259bc0, 0x16, 0xc000063b30, 0xc, ...)
	c:/go/src/os/user/lookup_windows.go:181 +0xd4
os/user.current(0x0, 0x0, 0x0)
	c:/go/src/os/user/lookup_windows.go:225 +0x2d8
os/user.Current.func1()
	c:/go/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x593ff00, 0x40b75b0)
	c:/go/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
	c:/go/src/sync/once.go:57
os/user.Current(0xc0002599c0, 0x1b, 0x3f56005)
	c:/go/src/os/user/lookup.go:15 +0x105
github.com/golang/glog.init.1()
	C:/gomodcache/github.com/golang/[email protected]/gomodcache/github.com/golang/[email protected]/glog_file.go:63 +0x4b
```

This ugly hack is needed because the [bump of github.com/dgraph-io/ristretto from 0.0.3 to 0.1.0][1]
[introduced a new dependency to `glog`][2] which is triggering the following issue with
the Windows nano docker image: [3]

Once [3] is solved, this hack can be reverted.

[1] #8500
[2] dgraph-io/ristretto#263
[3] microsoft/Windows-Containers#72
@L3n41c L3n41c force-pushed the lenaic/fix_windows_nano_netapi32 branch from 1c04784 to eeed24b Compare August 30, 2021 16:31
@L3n41c L3n41c merged commit 89b2770 into main Aug 31, 2021
@L3n41c L3n41c deleted the lenaic/fix_windows_nano_netapi32 branch August 31, 2021 10:07
L3n41c added a commit that referenced this pull request Sep 2, 2021
…#9006)

To fix the following failure:
```
panic: Failed to load netapi32.dll: The specified module could not be found.

goroutine 1 [running]:
syscall.(*LazyProc).mustFind(...)
	c:/go/src/syscall/dll_windows.go:320
syscall.(*LazyProc).Addr(...)
	c:/go/src/syscall/dll_windows.go:327
syscall.NetGetJoinInformation(0x0, 0xc00061fa48, 0xc00061fa44, 0x16, 0xc0000c96e0)
	c:/go/src/syscall/zsyscall_windows.go:1804 +0x107
os/user.isDomainJoined(0xc00061faa0, 0xf3624e, 0x0)
	c:/go/src/os/user/lookup_windows.go:18 +0x5a
os/user.lookupFullName(0xc000063b30, 0xc, 0xc000259bc0, 0x16, 0xc0000c96e0, 0x23, 0x16, 0xc0000c96e0, 0x23, 0x1)
	c:/go/src/os/user/lookup_windows.go:51 +0x2d
os/user.newUser(0xc000063ad0, 0xc, 0xc000063b10, 0xc, 0xc0000c9680, 0x1f, 0xc000259bc0, 0x16, 0xc000063b30, 0xc, ...)
	c:/go/src/os/user/lookup_windows.go:181 +0xd4
os/user.current(0x0, 0x0, 0x0)
	c:/go/src/os/user/lookup_windows.go:225 +0x2d8
os/user.Current.func1()
	c:/go/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x593ff00, 0x40b75b0)
	c:/go/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
	c:/go/src/sync/once.go:57
os/user.Current(0xc0002599c0, 0x1b, 0x3f56005)
	c:/go/src/os/user/lookup.go:15 +0x105
github.com/golang/glog.init.1()
	C:/gomodcache/github.com/golang/[email protected]/gomodcache/github.com/golang/[email protected]/glog_file.go:63 +0x4b
```

This ugly hack is needed because the [bump of github.com/dgraph-io/ristretto from 0.0.3 to 0.1.0][1]
[introduced a new dependency to `glog`][2] which is triggering the following issue with
the Windows nano docker image: [3]

Once [3] is solved, this hack can be reverted.

[1] #8500
[2] dgraph-io/ristretto#263
[3] microsoft/Windows-Containers#72
clamoriniere added a commit that referenced this pull request Sep 2, 2021
clamoriniere added a commit that referenced this pull request Sep 2, 2021
zandrewitte pushed a commit to StackVista/stackstate-agent that referenced this pull request Nov 17, 2022
…DataDog#9006)

To fix the following failure:
```
panic: Failed to load netapi32.dll: The specified module could not be found.

goroutine 1 [running]:
syscall.(*LazyProc).mustFind(...)
	c:/go/src/syscall/dll_windows.go:320
syscall.(*LazyProc).Addr(...)
	c:/go/src/syscall/dll_windows.go:327
syscall.NetGetJoinInformation(0x0, 0xc00061fa48, 0xc00061fa44, 0x16, 0xc0000c96e0)
	c:/go/src/syscall/zsyscall_windows.go:1804 +0x107
os/user.isDomainJoined(0xc00061faa0, 0xf3624e, 0x0)
	c:/go/src/os/user/lookup_windows.go:18 +0x5a
os/user.lookupFullName(0xc000063b30, 0xc, 0xc000259bc0, 0x16, 0xc0000c96e0, 0x23, 0x16, 0xc0000c96e0, 0x23, 0x1)
	c:/go/src/os/user/lookup_windows.go:51 +0x2d
os/user.newUser(0xc000063ad0, 0xc, 0xc000063b10, 0xc, 0xc0000c9680, 0x1f, 0xc000259bc0, 0x16, 0xc000063b30, 0xc, ...)
	c:/go/src/os/user/lookup_windows.go:181 +0xd4
os/user.current(0x0, 0x0, 0x0)
	c:/go/src/os/user/lookup_windows.go:225 +0x2d8
os/user.Current.func1()
	c:/go/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x593ff00, 0x40b75b0)
	c:/go/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
	c:/go/src/sync/once.go:57
os/user.Current(0xc0002599c0, 0x1b, 0x3f56005)
	c:/go/src/os/user/lookup.go:15 +0x105
github.com/golang/glog.init.1()
	C:/gomodcache/github.com/golang/[email protected]/gomodcache/github.com/golang/[email protected]/glog_file.go:63 +0x4b
```

This ugly hack is needed because the [bump of github.com/dgraph-io/ristretto from 0.0.3 to 0.1.0][1]
[introduced a new dependency to `glog`][2] which is triggering the following issue with
the Windows nano docker image: [3]

Once [3] is solved, this hack can be reverted.

[1] DataDog#8500
[2] dgraph-io/ristretto#263
[3] microsoft/Windows-Containers#72
zandrewitte pushed a commit to StackVista/stackstate-agent that referenced this pull request Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants