10
votes

I installed TeamCity on Windows Server 2012. It has been working fine setting up a few builds. I then attempted to install some plugins by putting .zip files in the ~/.BuildServer/plugins folder. I restarted the server by cd'ing to c:\TeamCity\bin and running "runAll stop" followed by "runAll start".

Then when I go to the teamcity page for several minutes I get a "Enter the maintenance authentication token" page. It says on the page to find the maintenance token in the teamcity-server.log file (see screenshot below). I look in c:\TeamCity\logs\teamcity-server.log and it has several "super user token" and "agent authorizationtoken". I tried using these token but get an invalid maintenance token error.

TeamCity Enter the Maintenance Authentication Token

So my question is where do I find the maintenance token?

Edit: This has resolved itself for me since upgrading to the latest TeamCity version. None of the suggested answers worked at the time I had this problem so that's why I am not marking anything as the accepted answer.

9
On Windows, TeamCity is usually installed as a Windows Service. I wonder if by running runAll start manually it is running differently (i.e. in a different directory) to how it usually does under the Windows Service and can't access the previous config. Have you tried starting it via the Windows Service?Jonathon Rossi
Good suggestion- I am now starting it as a service instead of using runAll, however same result. The log files all get update with info when I restart the server and agent, but no maintenance token.fredw
In my logfile ("C:\TeamCity\logs\teamcity-server.log") it only says "Current stage: Confirming TeamCity first start (administrator login is required to proceed)" and no token is available.habakuk

9 Answers

10
votes

Please check out file teamcity-winservice.log in logs subfolder of your Teamcity. Auth token should be here.

6
votes

open cmd goto TeamCity instalation folder

C:\TeamCity\bin

type

runAll.bat stop

wait until services stoped then type

runAll.bat start

u will see current authentication token in console,.

4
votes

It should be in the file teamcity-server.log which is in the logs subfolder of your TeamCity installation - look for the text "Administrator login is required from web UI using authentication token" and a long number afterwards which is your token.

Also see the docs for TeamCity Maintenance Mode.

3
votes

Had the same issue it is the Superuser token you want (it will be the last line in the log unless you have tried to login - which will show in here as failures)

Along the lines of

Administrator can login from web UI using authentication token: 1234567890

/Edited so line in log file is more obviously a quote and added an example token thanks @Kleopatra,

2
votes

Took me a while to find it, but it's in the file as indicated, but it's the very last line.

0
votes

if you are hitting on this issue https://youtrack.jetbrains.com/issue/TW-43100 in TeamCity (v10.0.4) for IE, you may need to enable javascript and also add the url to IE trusted site list.

0
votes

If you cannot find in the log, just type a random value. The web ui will inform you that entered an invalid token.

Afterwards go to the log (TeamCity/logs/teamcity-server.log) and check the last line:

[2018-03-27 17:55:20,258] WARN - jetbrains.buildServer.STARTUP - Failed maintenance authentication from IP address /86.234.23.62 with token: "6056431478480274143". Current authentication token: "6418830881320521552"

0
votes
  • I tried restarting the Teamcity service.
  • I tried the runAll stop start thing.

Didn't work for me.

I rebooted then found the superuser token in TeamCity/logs/teamcity-server.log

0
votes

You will find multiple super user authentication token in the file specified (TeamCity\logs\teamcity-server). You can always use the last one in the file. (if there is not one in the last line, try logon with random number, you can get an authorization failed message with the token number included and it will be added to the file)