xibo login error Undefined index: token

Asked by MH

Hi,

I have a problem with login as xibo_admin. I installed xibo-server-1.2.2.1.tar.gz (same problem with xibo-server-1.3.2.tar.gz, too) and after the installation process I come to the login mask. After providing username, xibo_admin, and password, I get instantly redirected to the login mask.

It seems to be a problem with providing a correct token. I also get a session timeout ("Form abgelaufen").
I tried to edit app_functions.php concerning the part with the token (about line 500) just to see if it changes some behavior, but no. I tried to delete the primary_key setting in mysql for the session database to see if this makes a change. Nothing.

Installing it again, delete session cache and cookies, trying different browser, all the same. It is not working with this computer. I installed it on another test machines (ubuntu 11.04), where everything sets up and runs fine. I installed it several times and tried several things, but I can't find the right thing to do.

The machine where I have problems, and where xibo should be installed is a virtual XEN installation of openSUSE 12.1 (x86_64).

What am I doing wrong or where should I look?

Below are the interesting parts from the logs (masked out the IP). Web server log, xibo mysql session and xibo mysql log. I tried to login 2 times (more does not change much). Even when the session token is changed, I'm not able to login.

Thanks for any help or hints,
mh

web server access.log:
xx - - [12/Mar/2012:12:44:25 +0100] "POST /infoscreen/index.php?q=login&referingPage= HTTP/1.1" 302 - "http://xx/infoscreen/index.php" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"
xx - - [12/Mar/2012:12:44:25 +0100] "GET /infoscreen/index.php HTTP/1.1" 200 2804 "http://xx/infoscreen/index.php" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"

xx - - [12/Mar/2012:12:47:35 +0100] "POST /infoscreen/index.php?q=login&referingPage= HTTP/1.1" 302 - "http://xx/infoscreen/index.php" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"
xx - - [12/Mar/2012:12:47:35 +0100] "GET /infoscreen/index.php HTTP/1.1" 200 2804 "http://xx/infoscreen/index.php" "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"

mysql xibo log:
2012-03-12 11:44:25
<errormsg>Undefined index: token</errormsg>
<errornum>8</errornum>
<errortype>Notice</errortype>
<scriptname>/srv/www/infoscreen/lib/app/app_functions.php</scriptname>
<scriptlinenum>500</scriptlinenum>

2012-03-12 11:44:25
Form token incorrect from: xx with token [0bf173fbb418b099f11427be6555a087]

2012-03-12 11:44:25
The query [INSERT INTO session (session_id, session_data, session_expiration, LastAccessed, LastPage, userID, IsExpired, UserAgent, RemoteAddr)
     VALUES ('g77fq7qup6vr7r3btf5c1p71e061o8lbsj799h4govsuf79khkn0', 'pagename|s:5:\"index\";token|s:32:\"1a2164a28265546500a2213a557b68e2\";token_timeout|i:1331552665;', 1331554105, '2012-03-12 11:44:25', 'login', NULL, 0, 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2', 'xx')] failed to execute<br />MySQL error: Duplicate entry 'g77fq7qup6vr7r3btf5c1p71e061o8lb' for key 'PRIMARY'

2012-03-12 11:47:35
<errormsg>Undefined index: token</errormsg>
<errornum>8</errornum>
<errortype>Notice</errortype>
<scriptname>/srv/www/htdocs/infoscreen/lib/app/app_functions.php</scriptname>
<scriptlinenum>500</scriptlinenum>

2012-03-12 11:47:35
Form token incorrect from: xx with token [1a2164a28265546500a2213a557b68e2]

2012-03-12 11:47:35
The query [INSERT INTO session (session_id, session_data, session_expiration, LastAccessed, LastPage, userID, IsExpired, UserAgent, RemoteAddr)
     VALUES ('g77fq7qup6vr7r3btf5c1p71e061o8lbsj799h4govsuf79khkn0', 'pagename|s:5:\"index\";message|s:57:\"Form abgelaufen. Bitte aktualisieren und erneut versuchen\";', 1331554295, '2012-03-12 11:47:35', 'login', NULL, 0, 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2', 'xx')] failed to execute<br />MySQL error: Duplicate entry 'g77fq7qup6vr7r3btf5c1p71e061o8lb' for key 'PRIMARY'

2012-03-12 11:47:35
The query [INSERT INTO session (session_id, session_data, session_expiration, LastAccessed, LastPage, userID, IsExpired, UserAgent, RemoteAddr)
     VALUES ('g77fq7qup6vr7r3btf5c1p71e061o8lbsj799h4govsuf79khkn0', 'pagename|s:5:\"index\";token|s:32:\"db634a1bc4556d734b03053225b42052\";token_timeout|i:1331552855;', 1331554295, '2012-03-12 11:47:35', 'login', NULL, 0, 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2', 'xx')] failed to execute<br />MySQL error: Duplicate entry 'g77fq7qup6vr7r3btf5c1p71e061o8lb' for key 'PRIMARY'

mysql xibo session (no entry for 11:47:35):
2012-03-12 11:44:25
pagename|s:5:"index";message|s:57:"Form abgelaufen. Bitte aktualisieren und erneut versuchen";

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Solved by:
MH
Solved:
Last query:
Last reply:
Revision history for this message
Paul van Dun (venigo) said :
#1

You should clean up your database, then reinstall..

MySQL error: Duplicate entry 'g77fq7qup6vr7r3btf5c1p71e061o8lb' for key 'PRIMARY'

Revision history for this message
MH (mh.uni) said :
#2

Hi Paul,

thanks for your answer. I already cleaned the database, tried again, cleaned database, reinstalled, deleted the full database, reinstalled and so on. Nothing changed (despite some IDs, e.g. session ID). Problems stays the same.

Something is not working together on the server machine with the xibo server. As the xibo server is working perfectly fine on another machine. Could it be, that it is opensuse or the virtual installation (XEN), that makes the difference?

mh

Revision history for this message
Alex Harrington (alexharrington) said :
#3

Hi mh

Check that session_autostart isn't enabled in your PHP configuration.

Alex

Revision history for this message
MH (mh.uni) said :
#4

Hi Alex,

thanks for the fast reply. I just checked it.

from my /etc/php5/apache2/php.ini
; Initialize session on request startup.
; http://php.net/session.auto-start
session.auto_start = 0

From phpinfo() session part:
Directive Local Value Master Value
session.auto_start Off Off

The last resort is to move xibo server to a different machine, but I don't really want to do this. Do you have anything else in mind?

mh

Revision history for this message
MH (mh.uni) said :
#5

I tried it again, with deleted session and log database. I also turned xibo into test mode and activated audit and debug in settings.

The mysql output in log and session seems to be the same as above for me (of course session_id and token changed). See an example below. Token seems to be changed correctly, but not session_id as primary key.

I'm probably away the next days, but I will check for any updates. If I can't solve this problem, I'll probably look for another machine to run xibo server on.

Please keep posting any hints or ideas if you have some.

Thank you for your help.

Greetings,
mh

xibo log:
2012-03-12 15:37:16
Form token incorrect from: xx with token [771220b9d5797e02eb2356073243e09b]

2012-03-12 15:37:16
The query [INSERT INTO session (session_id, session_data, session_expiration, LastAccessed, LastPage, userID, IsExpired, UserAgent, RemoteAddr)
     VALUES ('427rbdhotv4e7gtja7ff2kmj61pt5k2g40d3kfph2s02nh00ote0', 'pagename|s:5:\"index\";token|s:32:\"dba6c92cf9e45095ed982e9c0d11bf5a\";token_timeout|i:1331566636;', 1331568076, '2012-03-12 15:37:16', 'login', NULL, 0, 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2', 'xx')] failed to execute<br />MySQL error: Duplicate entry '427rbdhotv4e7gtja7ff2kmj61pt5k2g' for key 'PRIMARY'

xibo session (only 1 entry for 2 trials):
date: 2012-03-12 15:35:49
session_id: 427rbdhotv4e7gtja7ff2kmj61pt5k2g
session_data: pagename|s:5:"index";message|s:57:"Form abgelaufen. Bitte aktualisieren und erneut versuchen";

Revision history for this message
Paul van Dun (venigo) said :
#6

What if you export the complete database from the other server into the current server? Could be a install problem with mysql.. Try to check installed packages of the server, maybe reinstall or update it.

Revision history for this message
MH (mh.uni) said :
#7

Hi Paul,

I'll try this and also reinstall all needed packages, perhaps something went wrong there (all packages are up to date if I trust the package manager). I'll write an update after I did this (could take a few days, as mentioned above).

Thanks for the hint and have a nice evening.

mh

Revision history for this message
Dan Garner (dangarner) said :
#8

Can you create a phpfile with just

<?php
phpinfo();
?>

Open it in your web rnowser and upload the results somewhere, you can email them to <email address hidden> if you dnt feel comfortable with them on here.

Thanks

Revision history for this message
MH (mh.uni) said :
#9

I just did this, you should have a mail now ;-)

mh

Revision history for this message
MH (mh.uni) said :
#10

Hi there.

I still have this problem. What I did new so far:

I have another machine with OpenSuSe 12.1 (not the virtual one) which I used for a test. I installed the following extra packages:

apache2 apache2-mod_php5 apache2-prefork apache2-utils libmcrypt php5 php5-bz2 php5-ctype php5-dom php5-gd php5-iconv php5-json php5-mbstring php5-mcrypt php5-mysql php5-pdo php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter php5-zip php5-zlib phpMyAdmin pwgen sqlite2

mysql was already installed only this 2 were missing as stated in the installer for xibo: php5-calendar php5-soap

So far so good, xibo-server (1.3.2) was installing. I removed it and did this:

- copied the whole directory from my working version (on another computer running ubuntu).
- changed the permissions accordingly
- made a database in mysql as in the working version
- imported all data from the working one to the new database
- made a new user in mysql with all rights on the database (accordingly to the working version)
- tested --> login mask and connection to the database is ok
- ran in the same login failure as stated above --> same errors in log and session tables

So is it perhaps a problem with opensuse 12.1? I haven't tested it with 11.4. On my other machine with ubuntu it is working. Perhaps I should compare the php settings?

Do you still have any ideas?

Thanks for your input,
mh

PS I'm good in having problems nobody else has. This happens here and there for me ;-)

Revision history for this message
MH (mh.uni) said :
#11

OK another new information:

I just did the same as above with a opensuse 11.4 machine. There everything is working. So it seems something changed by 12.1....

At least now I know that it works principally. Do you have an idea what changed to produce the described behaviour?

Greetings,
mh

Revision history for this message
MH (mh.uni) said :
#12

Ok, I found the difference and it is working now.

The php.ini differs for the 2 installations. Here what I had to change in it:
; Select a hash function for use in generating session ids.
; Possible Values
; 0 (MD5 128 bits)
; 1 (SHA-1 160 bits)
; This option may also be set to the name of any hash function supported by
; the hash extension. A list of available hashes is returned by the hash_algos()
; function.
; http://php.net/session.hash-function
;session.hash_function = sha256
session.hash_function = 3

I commented out the sha256 and added the value 3 as it was in the older versions. That's all. That's the little devil who did all this work to me.

So I will mark this problem as solved.

Thanks for all your tips,
mh

PS perhaps someone can explain me, what kind of hash is used with integer 3?
In the php manual is written: "'0' means MD5 (128 bits) and '1' means SHA-1 (160 bits)."
But if I look for print_r(hash_algos()); in php my array with number 3 would be "[3] => sha1" and "[0] => md2; [1] => md4; [2] => md5" is this correct?

Revision history for this message
Alex Harrington (alexharrington) said :
#13

It sounds like the sha-256 hash being used is probably overflowing Xibo's database field for the hash which is why it never matches.

Dan: What do you think about digging in to that and possibly increasing the length of that field if it does turn out to be the issue.

Logging as a bug for now.

Revision history for this message
Dan Garner (dangarner) said :
#14

Seems like a sensible conclusion - the database field will certainly have a fixed number of characters.

I will look into it as per the bug filed.