Permission denied on all non-admin nodes for user 1

glass.dimly - April 29, 2009 - 15:51

Hey all,

I'm working to upgrade several inherited Drupal 4.6 sites to Drupal 6. I know that all Drupal 4.6 sites ought be thrust into a deep basement on Alpha Centauri behind a "Beware of Leopard" sign, yet my task remains.

I've followed the upgrade path 4.6->4.7 and I'm now getting an "Access Denied" error on nodes, likely nodes created with Flexinode.

I've got a fresh 4.7 install that I'm comparing it to, but what tables might be messed up in my upgraded site? Should I forge ahead, upgrading all the modules, and ignore the problem, then straighten it out in 5 or 6?

I'm pasting my upgrade errors below, in case it's helpful.

Drupal database update

    * user warning: Table 'search_total' already exists query: CREATE TABLE search_total ( word varchar(50) NOT NULL default '', count int(10) unsigned default NULL, PRIMARY KEY word (word) ) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Can't DROP 'path'; check that column/key exists query: ALTER TABLE blocks DROP path in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate column name 'visibility' query: ALTER TABLE blocks ADD visibility tinyint(1) NOT NULL in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate column name 'pages' query: ALTER TABLE blocks ADD pages text NOT NULL in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Multiple primary key defined query: ALTER TABLE sessions ADD PRIMARY KEY sid (sid) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Table 'flood' already exists query: CREATE TABLE flood ( event varchar(64) NOT NULL default '', hostname varchar(128) NOT NULL default '', timestamp int(11) NOT NULL default '0' ); in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate column name 'aid' query: ALTER TABLE accesslog ADD aid int(10) NOT NULL auto_increment, ADD PRIMARY KEY (aid) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Table 'queue' already exists query: CREATE TABLE queue ( nid int(10) unsigned NOT NULL, uid int(10) unsigned NOT NULL, vote int(3) NOT NULL default '0', PRIMARY KEY (nid, uid) ) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Unknown column 'votes' in 'field list' query: SELECT nid, votes, score, users FROM node in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Can't DROP 'votes'; check that column/key exists query: ALTER TABLE node DROP votes in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Can't DROP 'score'; check that column/key exists query: ALTER TABLE node DROP score in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Can't DROP 'users'; check that column/key exists query: ALTER TABLE node DROP users in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Table 'vocabulary_node_types' already exists query: CREATE TABLE vocabulary_node_types ( vid int(10) NOT NULL default '0', type varchar(16) NOT NULL default '', PRIMARY KEY (vid, type)) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Unknown column 'nodes' in 'field list' query: SELECT vid, nodes FROM vocabulary in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Can't DROP 'nodes'; check that column/key exists query: ALTER TABLE vocabulary DROP nodes in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Unknown table 'page' query: DROP TABLE page in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate column name 'types' query: ALTER TABLE blocks ADD types text in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate column name 'module' query: ALTER TABLE vocabulary ADD module varchar(255) NOT NULL default '' in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Unknown column 'voters' in 'poll' query: ALTER TABLE poll CHANGE voters polled longtext in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Multiple primary key defined query: ALTER TABLE term_node ADD PRIMARY KEY (tid,nid) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '503' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (503, 0, '', 'Primary links', '', 0, 115) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '504' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (504, 503, '/', 'Home', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '505' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (505, 503, 'node/126', 'What we do', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '506' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (506, 503, 'node/60', 'Get Involved', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '507' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (507, 503, 'node/114', 'News & Issues', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '508' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (508, 503, 'node/64', 'Donate', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '509' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (509, 503, 'node/119', 'Blog', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '510' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (510, 503, 'admin/themes/settings\" class=\"active', 'edit primary links', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '511' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (511, 0, '', 'Secondary links', '', 0, 115) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '512' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (512, 511, 'admin/themes/settings\" class=\"active', 'edit secondary links', '', 0, 118) in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '153' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (450, 153, 2, 'HURRICANE FELIX BLASTS NICARAGUA AND HONDURAS!', ' <p>Hurricane Felix blasted Nicaragua at dawn on Tuesday morning September 4, hitting shore between Sandy Bay and Puerto Cabezas, as a category 5 storm with 160 mph winds.&nbsp; Early reports spoke of roofs blowing off and houses destroyed in Puerto Cabezas as well as many unanswered distress calls.&nbsp; Approximately 10,000 residents of Bilwi were evacuated as well as the local hospital.&nbsp; A preliminary report from the Ministry of Education reports that 80% of schools in the north have lost roofs. </p> <p>After touching down, Felix weakened to a category 2 storm, with winds dropping to 100mph. The drop in intensity is expected to cause the hurricane to release moisture, which will likely lead to torrential rains, flooding and potential mudslides. The in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '154' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (448, 154, 2, 'Make a donation to help Nicaraguan victims of Hurricane Felix', '<h3>Your donation now will purchase needed food, seed, and other emergency supplies to help Nicaraguans affected by hurricane Felix.</h3>\r\n\r\n<div class=\"answer\">\r\n<h5 style=\"color: red;\">Q: Why should I make my relief donation through ... for Peace? What is your track record in Nicaragua?</h5>\r\n\r\n<p>A: The ... for Peace has been engaged in community development and emergency \r\nresponse in the most needy regions of Nicaragua for 21 years.</p>\r\n\r\n<p>After Hurricane Mitch devastated Nicaragua in November 1998, we delivered 20 cargo containers of emergency supplies in the following months. During the next four years, we built 2,500 homes and latrines for those most affected by the hurric in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '155' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (395, 155, 2, 'Report Back from the Nicaraguan Election Interference Monitoring Delegation', ' <strong>by Tom Loudon, ... for Peace staff</strong> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Our delegation recently returned from Nicaragua after a very successful visit.&nbsp; The purpose of our trip was to investigate and monitor the level of illegal U.S. intervention in the Election process underway.&nbsp; Nicaraguans will elect a new president and assembly delegates this coming November 5<sup>th</sup>, and the U.S. Embassy and other members of the U.S. government have been intervening in the Nicaraguan process in a number of troublesome ways.&nbsp; </p> <p>The U.S. Ambassador and other State Department officials seem to be com in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '157' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (382, 157, 2, 'Handsoff signers', '<?php\r\n\r\n// date_default_timezone_set(\'EDT\');\r\n// PHP 5.1+\r\n\r\n$result = db_query(\"SELECT COUNT(*) as count, SUM(amount) as total from ad_signers\");\r\n while ($row = db_fetch_object($result)) {\r\n print \'<h2>\'.$row->count.\' signers, $\'.$row->total.\' total contributed.</h2>\';\r\n }\r\n\r\n $header = array(\r\n array(\'data\' => t(\'Date\'), \'field\' => \'datetime\', \'sort\' => \'desc\'),\r\n array(\'data\' => t(\'First\'), \'field\' => \'first_name\'),\r\n array(\'data\' => t(\'Last\'), \'field\' => \'last_name\'),\r\n array(\'data\' = in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '166' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (381, 166, 2, 'EZIC CGI postback', '<?php\r\n\r\n$debug = ($_RE...[\"debug\"] == \"\" ) ? false : true;\r\n$addSigner = 0;\r\n\r\n while(list($key, $value) = each($_RE...))\r\n{\r\n\r\n // DEBUG - dump $_RE...\r\n if ( $debug ) echo \"$key = $value<br>\";\r\n if (( $key == \"Ecom_Ezic_TransactionStatus\") && ($value == \"1\") ) // successful EZIC transaction\r\n $addSigner = 1;\r\n} \r\n\r\n if ( $debug ) echo(\"addSigner = $addSigner<BR><BR>\");\r\n\r\n// only add/update them in DIA if we just got back data from EZIC transaction\r\nif ($addSigner == 1) {\r\n\r\n/*********************************************************************\r\n* Add the user to DIA *\r\n************************************************** in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '168' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (377, 168, 2, 'Thank you for taking action!', '<p>We\'ve received your signature and your contribution - Your name will appear in the list of signers as you specified!</p>\r\n<h2>Now spread the word!</h2>\r\n<p>Will you take a moment to spread the word about our campaign? Send a quick message to your friends and family:</p>\r\n\r\n<form action=\"http://www.democracyinaction.org/dia/processSpread.jsp\" method=\"post\">\r\n<input type=\"hidden\" name=\"redirect\" value=\"http://........org/handsoff/thanks\" />\r\n<table class=\"spreadform\" cellspacing=\"0\">\r\n<tr><td class=\"spreadhead\"><label for=\"fromName\">Your Name:</label></td><td><input name=\"from in /var/www/..../includes/database.mysql.inc on line 121.
    * user warning: Duplicate entry '169' for key 1 query: INSERT INTO node_revisions (nid, vid, uid, title, body, teaser, log, timestamp, format) VALUES (373, 169, 2, 'Say No to U.S. interference in Nicaraguan elections!', '<span class=\"floatquote\">Shouldn\'t the people of Nicaragua have the right to decide who will lead their nation, free from U.S. intimidation and interference? Show them you stand up for their rights:<br><br><a class=\"button\" target=\"_blank\" href=\"https://www.....org/handsoff/\">SIGN THE LETTER!</a><br><br><b>[handsoff_numsigners|0]</b> signers so far <br><br>Deadline: <strong>October 8</strong>\r\n</span> \r\n<h4>Join [handsoff_numsigners|0] other people: sign the letter and stand up for Nicaraguan democracy.</h4>\r\n<img width=\"224\" height=\"133\" border=\"0\" src=\"system/files?file=images/ba in /var/www/..../includes/database.mysql.inc on line 121.

Updates were attempted. If you see no failures below, you may proceed happily to the administration pages. Otherwise, you may need to update your database manually. All errors have been logged.

Reminder: don't forget to set the $access_check value at the top of update.php back to TRUE.

    * main page
    * administration pages

The following queries were executed
system module
Update #110

    * DROP TABLE {search_index}
    * CREATE TABLE {search_index} ( word varchar(50) NOT NULL default '', sid int(10) unsigned NOT NULL default '0', type varchar(16) default NULL, fromsid int(10) unsigned NOT NULL default '0', fromtype varchar(16) default NULL, score int(10) unsigned default NULL, KEY sid (sid), KEY fromsid (fromsid), KEY word (word) )
    * Failed: CREATE TABLE {search_total} ( word varchar(50) NOT NULL default '', count int(10) unsigned default NULL, PRIMARY KEY word (word) )
    * Failed: ALTER TABLE {blocks} DROP path
    * Failed: ALTER TABLE {blocks} ADD visibility tinyint(1) NOT NULL
    * Failed: ALTER TABLE {blocks} ADD pages text NOT NULL
    * DELETE FROM {variable} WHERE name = 'node_cron_last'
    * UPDATE {blocks} SET status = 1, custom = 2 WHERE status = 0 AND custom = 1

Update #111

    * DELETE FROM {variable} WHERE name LIKE 'throttle_%'
    * Failed: ALTER TABLE {sessions} ADD PRIMARY KEY sid (sid)

Update #112

    * Failed: CREATE TABLE {flood} ( event varchar(64) NOT NULL default '', hostname varchar(128) NOT NULL default '', timestamp int(11) NOT NULL default '0' );

Update #113

    * Failed: ALTER TABLE {accesslog} ADD aid int(10) NOT NULL auto_increment, ADD PRIMARY KEY (aid)

Update #114

    * Failed: CREATE TABLE {queue} ( nid int(10) unsigned NOT NULL, uid int(10) unsigned NOT NULL, vote int(3) NOT NULL default '0', PRIMARY KEY (nid, uid) )
    * Failed: ALTER TABLE {node} DROP votes
    * Failed: ALTER TABLE {node} DROP score
    * Failed: ALTER TABLE {node} DROP users

Update #115

    * No queries

Update #116

    * DELETE FROM {system} WHERE name = 'admin'

Update #117

    * Failed: CREATE TABLE {vocabulary_node_types} ( vid int(10) NOT NULL default '0', type varchar(16) NOT NULL default '', PRIMARY KEY (vid, type))

Update #118

    * Failed: ALTER TABLE {vocabulary} DROP nodes

Update #119

    * No queries

Update #120

    * No queries

Update #121

    * Failed: DROP TABLE {page}

Update #122

    * Failed: ALTER TABLE {blocks} ADD types text

Update #123

    * Failed: ALTER TABLE {vocabulary} ADD module varchar(255) NOT NULL default ''
    * UPDATE {vocabulary} SET module = 'taxonomy'

Update #124

    * DROP TABLE IF EXISTS {node_comment_statistics}
    * CREATE TABLE {node_comment_statistics} ( nid int(10) unsigned NOT NULL auto_increment, last_comment_timestamp int(11) NOT NULL default '0', last_comment_name varchar(60) default NULL, last_comment_uid int(10) NOT NULL default '0', comment_count int(10) unsigned NOT NULL default '0', PRIMARY KEY (nid), KEY node_comment_timestamp (last_comment_timestamp) )
    * INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) SELECT n.nid, n.changed, NULL, 0, 0 FROM {node} n

Update #125

    * No queries

Update #126

    * No queries

Update #127

    * Failed: ALTER TABLE {poll} CHANGE voters polled longtext

Update #128

    * Failed: ALTER TABLE {term_node} ADD PRIMARY KEY (tid,nid)

Update #129

    * ALTER TABLE {vocabulary} ADD tags tinyint(3) unsigned default '0' NOT NULL

Update #130

    * No queries

Update #131

    * ALTER TABLE {boxes} DROP INDEX title

Update #132

    * No queries

varchar(50) NOT NULL default '', count float default NULL, PRIMARY KEY word (word) )

Update #151

    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (503, 0, '', 'Primary links', '', 0, 115)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (504, 503, '/', 'Home', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (505, 503, 'node/126', 'What we do', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (506, 503, 'node/60', 'Get Involved', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (507, 503, 'node/114', 'News & Issues', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (508, 503, 'node/64', 'Donate', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (509, 503, 'node/119', 'Blog', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (510, 503, 'admin/themes/settings\" class=\"active', 'edit primary links', '', 0, 118)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (511, 0, '', 'Secondary links', '', 0, 115)
    * Failed: INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (512, 511, 'admin/themes/settings\" class=\"active', 'edit secondary links', '', 0, 118)
    * UPDATE {system} SET status = 1 WHERE name = 'menu'

Drupal 4.6 and 4.7? If you

cog.rusty - April 29, 2009 - 16:42

Drupal 4.6 and 4.7? If you are on PHP 5.2 try this in your settings.php file:

http://drupal.org/node/102114

Thanks, cog.rusty.

glass.dimly - April 29, 2009 - 21:50

Funny thing, the body of the node that I posted disappeared. I went back and trimmed some of content (it was obscenely long) and it re-appeared.

Thanks for that link. I've actually had the problem before and ended up upgrading out of the problem because I didn't know of the handy-dandy documentation page.

But this problem is different. Rather than not retaining my login, I can actually log in and access all admin/* pages, but all my nodes return access denied even though I'm user 1.

Heh, that is why I was seeing

cog.rusty - April 29, 2009 - 23:28

Heh, that is why I was seeing only the title when I replied.

From the error messages it looks like these updates were already done, so most queries failed (of course the "thorough" ones, for example deleting and then re-created a table, didn't).

Were there successful queries further down? If you force-selected manually all updates to be done, maybe that was the problem.

Or else try the "official" way of upgrading, "disable all contributed modules - upload new core and new modules - run update.php for core - enable all contibuted modules - run update.php again".

Normally flexinode shouldn't be the problem if it has been upgraded successfully. Are you going to use flexiconvert for conversion to CCK? Googling around I found several stories about how that won't be easy.

Yeah,

glass.dimly - April 30, 2009 - 03:55

I did upgrade in the "official" way, but I truncated the good queries because of the posting limit. By the book, 100%.

I plan to eventually convert flexinode to CCK. After all, flexinode doesn't seem to be supported anymore, last release 4.7. If I want my content, I believe I have to convert.

So only nodes are getting this error. What is Drupal doing when it checks permission on a node? How could that check be so screwed up that user 1 is getting access errors? Is there a way to rebuild access permissions or drop a table in from a fresh Drupal 4.7 install? I've got one handy.

Sigh. Many questions. There are many things to try, but what path to take? Too bad I left my copy of "Pro Drupal Development" at home in another city.

I don't think there is any

cog.rusty - April 30, 2009 - 04:09

I don't think there is any chance that user 1 can get an "access denied" because of node permissions. At least in Drupal 5 and 6 the only way I have found to get an "access denied" for user 1 is to go to user/login while I am already logged in. That is, something out of the ordinary is happening, not just a permissions issue. So, it is possible that it has to do with invalid input formats, or with invalid or poorly supported flexinodes, as you suspected.

 
 

Drupal is a registered trademark of Dries Buytaert.