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

Failed to initialize CoreCLR, HRESULT: 0x80004005 #45

Open
bdaniel7 opened this issue Oct 15, 2018 · 7 comments
Open

Failed to initialize CoreCLR, HRESULT: 0x80004005 #45

bdaniel7 opened this issue Oct 15, 2018 · 7 comments

Comments

@bdaniel7
Copy link

bdaniel7 commented Oct 15, 2018

Hi,

I'm trying to run a TeamCity agent in a container.
This is environment:

The TeamCity and the agent are the latest from the container (2018.1.3 (build 58658))
The container is run in Docker for Windows, using Linux containers (because the production will run on Ubuntu).

root@teamcity-agent3:/opt/buildagent/work/70bf5e8b1cc61bbe/src# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.401/

Host (useful for support):
Version: 2.1.3
Commit: 124038c13e

.NET Core SDKs installed:
2.1.401 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

When I run the build using

/opt/buildagent/work/70bf5e8b1cc61bbe/src# /usr/bin/dotnet build trains.sln --framework netcoreapp2.1 --configuration Release --runtime ubuntu-x64

in the container, the build is successful.

However when I run the same command as part of a build step, I get this error:

Failed to initialize CoreCLR, HRESULT: 0x80004005

Any ideas on why this error occurs?

@bdaniel7
Copy link
Author

bdaniel7 commented Oct 18, 2018

I think this occurs because the teamcity agent runs under buildagent user and the folders and files created during agent instalation (/opt, /tmp) are rw only for root:root.

I tried to add root to group docker and set chown those directories to root:docker but to no avail. New folders generated when the any "dotnet" command starts are owned and rw by root.

@1scrooge
Copy link

1scrooge commented Nov 8, 2018

I have the same issue. Any ideas?

@bdaniel7
Copy link
Author

bdaniel7 commented Nov 8, 2018

One workaround is to set the environment variable COMPlus_EnableDiagnostics=0 in all the containers where dotnet runs.
The variable is used to determine whether the clr will write some debug information in /tmp.
You can search for more details about that variable in the .NET Core GitHub issues log.

@1scrooge
Copy link

1scrooge commented Nov 8, 2018

@bdaniel7 Thank you. It`s helped

@NikolayPianikov
Copy link
Contributor

@bdaniel7 could you share commands which are used to run TeamCity server and agent in docker?

@bdaniel7
Copy link
Author

bdaniel7 commented Dec 4, 2018

They are run using docker-compose:
teamcity-server:
restart: always
image: jetbrains/teamcity-server:latest
container_name: teamcity
hostname: 'teamcity'
depends_on:
- "db"
environment:
- COMPlus_EnableDiagnostics=0
ports:
- 8111:8111
volumes:
- /docker/teamcity/data:/data/teamcity_server/datadir
- /docker/teamcity/logs:/opt/teamcity/logs
labels:
- 'traefik.frontend.rule=Host:teamcity.my.domain'
- 'traefik.backend=teamcity-backend'
- 'traefik.domain=my.domain'
- 'traefik.port=8111'
networks:
- trains-backend

teamcity-agent1:
restart: always
image: bdaniel7/teamcity-docker-agent-with-node:latest
container_name: teamcity-agent1
hostname: 'teamcity-agent1'
environment:
- 'SERVER_URL=http://teamcity:8111'
- 'AGENT_NAME=zozo'
- 'TMPDIR=/tmp'
- COMPlus_EnableDiagnostics=0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- '/docker/teamcity_agent1/conf:/data/teamcity_agent/conf'
- '/docker/teamcity_agent1/work:/opt/buildagent/work'
- '/docker/teamcity_agent1/temp:/opt/buildagent/temp'
- '/docker/teamcity_agent1/tools:/opt/buildagent/tools'
- '/docker/teamcity_agent1/plugins:/opt/buildagent/plugins'
- '/docker/teamcity_agent1/system:/opt/buildagent/system'
- '/docker/teamcity_agent1/logs:/opt/buildagent/logs'
networks:
- trains-backend

@NikolayPianikov
Copy link
Contributor

@bdaniel7 by default TeamCity agent uses this TEMP directory TMPDIR=/opt/buildagent/temp/buildTmp. Try using the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants