Unable to find the maintenance token for TeamCity in the server log
Asked Answered
C

10

10

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.

Carrell answered 17/7, 2015 at 16:3 Comment(3)
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?Kermie
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.Carrell
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.Orangewood
V
10

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

Voronezh answered 19/7, 2015 at 12:42 Comment(4)
Unfortunately I don't see any maintenance token in there, only the superuser token. I also checked other log files such as teamcity-auth.log.Carrell
@RezaAhmadi I would love to, except I don't see the token in that file. I am wondering if it is something with my specific setup preventing it from appearing.Carrell
After upgrading TeamCity (and seeing the page where I needed to enter the auth token), this was the last line in the teamcity-winservice.log file: Administrator can login from web UI using authentication token: NNNNReparation
Worked for me with 2017.1.4. To get at the end of the log a new line with expected token, just validate a wrong one on form. A new line like "WARN - jetbrains.buildServer.STARTUP - Failed maintenance authentication from IP address /0:0:0:0:0:0:0:1 with token: "x". Current authentication token: "4115402144571543048" will be added.Marchetti
C
6

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,.

Catenary answered 22/12, 2015 at 7:59 Comment(0)
V
4

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.

Venettavenezia answered 18/7, 2015 at 19:13 Comment(1)
I only see "Superuser token" in there, not the text you are quoting.Carrell
P
3

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,

Paramour answered 18/12, 2015 at 11:7 Comment(1)
thanks for edit, now even silly me can understand it :-)Boger
S
2

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

Shoa answered 13/4, 2016 at 18:2 Comment(0)
G
0

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.

Guilbert answered 1/2, 2017 at 7:48 Comment(0)
H
0

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"

Heffner answered 27/3, 2018 at 21:58 Comment(0)
R
0
  • 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

Rayfordrayle answered 14/6, 2019 at 23:4 Comment(0)
M
0

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)

Mistook answered 25/12, 2019 at 17:21 Comment(0)
R
0

you can exec this command in docker or search "Super user authentication token" in log file

cat /opt/teamcity/logs/teamcity-server.log|grep "Super user authentication token"
Rider answered 6/3 at 16:8 Comment(1)
Note - you suggest a solution which will work for another Operative System. The question was how to locate superuser maintenance token for TeamCity Windows Server 2012. Although it is possible to install for example a Cygwin environment, your commands concerns using docker and also references folder found in *nix environments such as Linux. So you should add a comment that you can use Windows-based text editor and search for the search term you provided here, preferable searching from the bottom of the team city log file to find the token quickest (such as using Notepad).Phratry

© 2022 - 2024 — McMap. All rights reserved.