Azure-pipelines-agent: Fresh VM -> config.sh -> Permission denied

Created on 31 Jan 2018  路  7Comments  路  Source: microsoft/azure-pipelines-agent

Agent version and platform

Version of your agent? 2.102.0/2.100.1...
Linux...
https://vstsagentpackage.azureedge.net/agent/2.127.0/vsts-agent-linux-x64-2.127.0.tar.gz

VSTS type and version

visualstudio.com

What's not working?

Fresh linux vm in Azure
Ubuntu 16.04

Ubuntu System Prerequisites [Check] OK
./bin/installdependencies.sh [Check] OK

$ ~/vsoagents/imn/1$ ./config.sh
touch: cannot touch '.env': Permission denied
./env.sh: line 37: .path: Permission denied
./env.sh: line 32: .env: Permission denied

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '/home/[hide]/vsoagents/imn/1/_diag' is denied. ---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.UnixFileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.VisualStudio.Services.Agent.HostTraceListener.CreatePageLogWriter()
at Microsoft.VisualStudio.Services.Agent.HostTraceListener..ctor(String logFilePrefix, Int32 pageSizeLimit, Int32 retentionDays)
at Microsoft.VisualStudio.Services.Agent.HostContext..ctor(String hostType, String logFile)
at Microsoft.VisualStudio.Services.Agent.Listener.Program.Main(String[] args)
config.sh: line 86: 5028 Aborted (core dumped) ./bin/Agent.Listener configure "$@"

$ ~/vsoagents/imn/1$ sudo ./config.sh
Must not run with sudo

i don't think it can get any more out of the box then this.
It's like there is a missing step from the documentation

Agent and Worker's diag log

NA

Most helpful comment

I resolved it doing sudo chmod o+w ~/myagent

All 7 comments

@ccanuel can you check your folder permission on that folder? seems like during config, the agent can't write to disk. can you echo foo >.log on that folder?

OK I found it.

I though i was being smart by organizing these agent services under the /usr/bin.
When that failed (same result) i just re-ran the same commands under the /home/[UserName] folder like the example but forgot to remove the sudo from trying to set these up under the /usr/bin.

@ccanuel cool, i think you are unblocked, so i am going to close the issue.

I am getting a similar error

./config.sh
touch: cannot touch '.env': Permission denied
./env.sh: line 37: .path: Permission denied
./env.sh: line 32: .env: Permission denied

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '/home/xxx/_diag' is denied. ---> System.IO.IOException: Permission denied
--- End of inner exception stack trace ---
at System.IO.UnixFileSystem.CreateDirectory(String fullPath)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.VisualStudio.Services.Agent.HostTraceListener..ctor(String logFileDirectory, String logFilePrefix, Int32 pageSizeLimit, Int32 retentionDays)
at Microsoft.VisualStudio.Services.Agent.HostContext..ctor(String hostType, String logFile)
at Microsoft.VisualStudio.Services.Agent.Listener.Program.Main(String[] args)
./config.sh: line 86: 7641 Aborted (core dumped) ./bin/Agent.Listener configure "$@"
xxx@trnbuildagentlinux01:~$

why ? but forgot to remove the sudo from trying to set these up under the /usr/bin.

I resolved it doing sudo chmod o+w ~/myagent

Even after running sudo chmod o+w ~/myagent. I am getting the same permission error

I had to run sudo chown

Was this page helpful?
0 / 5 - 0 ratings