influxdata / influxdata/influxdb

Using GO LANG APIs no longer supported in Nano Server

Open
#22,324 0 comments 0 reactions 0 assignees View on GitHub
os/windows
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

The windows amd 64 build fails to launch. Errors with panic: **Failed to load netapi32.dll: The specified module could not
be found.**

This issue is reported as an open GOLang issue [21867](https://github.com/golang/go/issues/21867) The InfluxDB is using APIs not supported on Windows Nano Server. There are work arounds proposed in the report.

### Reproduce

Copy the binaries into a Nano Server image. Example of a dockerfile to create an image

####DOCKERFILE
``` DOCKERFILE
# escape=`
ARG WindowsServerCoreVersion=ltsc2022
ARG INFLUXDB_VERSION=2.0.8
ARG INFLUXDB_SHA256=68584fcb22ff63d35215eff055a5e6d64e9f5da939fe11adae85b661436c1e4b

FROM mcr.microsoft.com/windows/servercore:$WindowsServerCoreVersion AS installer
ARG INFLUXDB_VERSION=$INFLUXDB_VERSION
ARG INFLUXDB_SHA256=$INFLUXDB_SHA256
ARG WindowsServerCoreVersion=$WindowsServerCoreVersion
ENV INFLUXDB_VERSION $INFLUXDB_VERSION
ENV INFLUXDB_SHA256 $INFLUXDB_SHA256

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
New-Item -ItemType Directory -Force -Path C:\webdownload | Out-Null; `
Invoke-WebRequest $('https://dl.influxdata.com/influxdb/releases/influxdb2-{0}-windows-amd64.zip' -f $env:INFLUXDB_VERSION) -OutFile 'C:\webdownload\influxdb.zip' -UseBasicParsing; `
if ((Get-FileHash C:\webdownload\influxdb.zip -Algorithm sha256).Hash -ne $env:INFLUXDB_SHA256) { Write-Error 'INFLUXDB_SHA256 mismatch';exit 1 } `

FROM mcr.microsoft.com/windows/nanoserver:$WindowsServerCoreVersion AS base
ARG INFLUXDB_VERSION=$INFLUXDB_VERSION
ARG WindowsServerCoreVersion=$WindowsServerCoreVersion
COPY --from=installer ["C:/influxdb/influxdb2-${INFLUXDB_VERSION}-windows-amd64/", "C:/Program Files/InfluxDB"]
# In order to set system PATH, ContainerAdministrator must be used
USER ContainerAdministrator
EXPOSE 8086
WORKDIR "Program Files/InfluxDB"
ENTRYPOINT [ "influxd.exe" ]
```

Run docker image.

GOLang Console output
````
panic: Failed to load netapi32.dll: The specified module could not be found.
goroutine 1 [running]:
syscall.(*LazyProc).mustFind(...)
/home/circleci/.tools/go/src/syscall/dll_windows.go:322 syscall.(*LazyProc).Addr(...)
/home/circleci/.tools/go/src/syscall/dll_windows.go:329 syscall.NetGetJoinInformation(0x0, 0xc00091f9b0, 0xc00091f9ac, 0x2,0xc0001ba390)
/home/circleci/.tools/go/src/syscall/zsyscall_windows.go:1177+0x105
os/user.isDomainJoined(0xc00091fa08, 0x457c8e, 0x0)
/home/circleci/.tools/go/src/os/user/lookup_windows.go:18 +0x5a
os/user.lookupFullName(0xc0001bd2f0, 0xc, 0xc0001c67a0, 0x16,0xc0001ba390, 0x23, 0x16, 0xc0001ba390, 0x23, 0x1)
/home/circleci/.tools/go/src/os/user/lookup_windows.go:51 +0x2d
os/user.newUser(0xc0001bd2d0, 0xc, 0xc0001bd2e0, 0xc, 0xc0001ba330,0x1f, 0xc0001c67a0, 0x16, 0xc0001bd2f0, 0xc, ...)
/home/circleci/.tools/go/src/os/user/lookup_windows.go:181 +0xd4
os/user.current(0x0, 0x0, 0x0)
/home/circleci/.tools/go/src/os/user/lookup_windows.go:225 +0x2de
os/user.Current.func1()
/home/circleci/.tools/go/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x9cce0c0, 0x88f72e8)
/home/circleci/.tools/go/src/sync/once.go:68 +0xf7
sync.(*Once).Do(...)
/home/circleci/.tools/go/src/sync/once.go:59
os/user.Current(0x1, 0xc000925050, 0xc00091fc60)
/home/circleci/.tools/go/src/os/user/lookup.go:15 +0x105
github.com/influxdata/influxdb/v2/cmd/influxd/upgrade.influxDirV1(0x72b25c0, 0xc00018c400, 0x0, 0x19)
/home/circleci/go/src/github.com/influxdata/influxdb/cmd/influxd/upgrade/upgrade.go:693 +0x2d
github.com/influxdata/influxdb/v2/cmd/influxd/upgrade.init.1()
/home/circleci/go/src/github.com/influxdata/influxdb/cmd/influxd/upgrade/v1_dump_meta.go:99 +0x47
````

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the provided Dockerfile in a Windows Nano Server image. Trace the startup path through cmd/influxd/upgrade/upgrade.go and cmd/influxd/upgrade/v1_dump_meta.go, where the stack trace reaches os/user.Current; done means influxd launches in Nano Server without the netapi32.dll panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
databases, devops, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.