« May 2012 | Main | July 2012 »

June 29, 2012

Reset lost mySQL root password without authenticating

First, confirm that there is a password set for Root by changing the phpMyAdmin configuation to allow login without password.

$ cd /usr/share/phpmyadmin/
$ grep -r AllowNoPassword .

$ sudo nano libraries/config.default.php &
- Find the allownopassword setting and change to true

Try to login at localhost/phpmyadmin. If fails, then password is set and you need to login without authenticating so you can reset it.

$ sudo /etc/init.d/mysql stop
$ sudo mysqld --skip-grant-tables --skip-networking &

$ mysql mysql -u root

Type in the following command and reset your password:

> UPDATE user SET password=PASSWORD('newpassword') WHERE user="root";

If you didn't go through the first step, to validate the changes simply type:


If you started MySQL manually (bypassing the authentication process), the server must be restarted:

$ /etc/init.d/mysql restart

Then visit localhost/phpmyadmin and test the password.

Posted by kkwaiser at 12:52 PM | Comments (0)

Update D7 Core and Contrib Modules

Notes follow -

Step 1. Update these modules and test functionality:

$ ls -alh *.tar.gz
-rw-r--r--. 1 root root 161K Apr 10 13:55 colorbox-7.x-1.3.tar.gz
-rw-r--r--. 1 root root 393K Mar 28 15:20 ctools-7.x-1.0.tar.gz
-rw-r--r--. 1 root root 187K Jun 5 19:51 devel-7.x-1.3.tar.gz
-rw-r--r--. 1 root root 389K May 15 20:31 nodequeue-7.x-3.x-dev.tar.gz
-rw-r--r--. 1 root root 38K May 13 19:06 pathauto-7.x-1.1.tar.gz
-rw-r--r--. 1 root root 42K May 15 16:56 token-7.x-1.1.tar.gz

Step 2. Update two more sensitive modules and test:

Lightweight Directory Access Protocol (http://drupal.org/project/ldap)
7.x-1.x will only have bug fixes on it from here on out. The current dev will become 7.x-1.0-beta11. It is recommended to stick with whatever version of it you have working currently until 7.x-2.0 betas come out. If you are starting out, use 7.x-1.0-dev. Special thanks to Oxfordshire County Council for funding the final work on this branch as well as a good deal of the 2.x branch.
Version and Releases Status Updates - http://drupal.org/node/1115704 - notes on different releases
- I'm going to assumer "whatever version" is actually referring to "whatever branch".
Entity API
This issue outlines potential upgrade issues with D7.14 and Entity API rc3: http://drupal.org/node/1559516. Looks minor (error message) but is unresolved.

LDAP DB Update Messages:

ldap_servers module
Update #7102
No database changes made.

Update #7103
"group_object_category" field added to ldap_servers table

Update #7104
"search_pagination" field added to ldap_servers table
"search_page_size" field added to ldap_servers table

Update #7105
"account_name_attr" field added to ldap_servers table

ldap_query module
Update #7101
ldap_query table field "filter" changed to type "text"

Step 3. Upgrade Drupal Core

$ cd /var/www/dct-dev.lsa.umich.edu

#copy the whole damn website to the Desktop just in case
$ sudo cp -rf ~/Desktop/sites/ html

$ sudo wget http://ftp.drupal.org/files/projects/drupal-7.14.tar.gz
$ sudo tar -xzf drupal-7.14.tar.gz
$ sudo cp drupal-7.14/* html
$ sudo rm -rf html/sites/
$ sudo cp -rf ~/Desktop/sites/ html

#this diff showed a few comment differences between the 7.12 and 7.14 versions but I'm ignoring those and copying settings.php over from the 7.12 site because Kevin has a bunch of git modifications made.
$ diff drupal-7.14/sites/default/default.settings.php html/sites/default/default.settings.php
$ sudo cp ~/Desktop/.htaccess html
$ sudo cp ~/Desktop/.gitignore html
$ sudo cp ~/Desktop/cron.php html
$ sudo cp ~/Desktop/favicon.ico html

#Created a tar of the 7.12 site in my Home folder. Cleaned up Desktop.
$ sudo tar -czf dpt_june27.tar.gz Desktop/*

After visiting ~/update.php the following updates were run:

system module
7073 - Add binary to {file_managed}, in case system_update_7034() was run without it.

field module
7002 - Split the all-inclusive field_bundle_settings variable per bundle.

node module
7013 - Change {node}.vid default value from 0 to NULL to avoid deadlock issues on MySQL.

trigger module
7001 - Increase the length of the "hook" field to 78 characters. This is a separate

function for those who ran an older version of trigger_update_7000() that did not do this.
7002 - Renames nodeapi to node.

user module
7018 - Ensure there is an index on {users}.picture.

Initial testing didn't reveal any broken components.

Step 4. Fix Permissions

Permissions for CTools CSS and sites/default/files . I've asked Mark M. to advise me on this with the hope of getting the permissions set correctly. There is no www-data user and folders are all owned by Root. I could chmod the folders to 777 but that is not the correct setting.

Solution was to limit user apache (i.e. www-data) to the most restricted permissions possible via these commands to allow default/files/ctools/css to be created:
$ sudo chown -R apache sites/default/files/ctools
$ sudo chmod -R u+rwX,go-rwx sites/default/files/ctools
$ sudo chcon -R -t httpd_sys_rw_content_t sites/default/files/ctools

Documentation from Mark Montague:

For example, from what I know, the most common reason for Drupal to need to write to sites/default/files is if you are going to allow end-users to upload files via/into Drupal. If you need to let users upload files, you would grant Drupal write access to sites/default/files but otherwise you would keep sites/default/files so that Drupal can only read from it, not write to it. (Unless, of course, you have another reason that you want Drupal to be able to write files there).

If you *do* need to allow Drupal to modify its own files, then the best way to do this is to change the owner of sites/default/files and everything underneath that to "apache" and set the permissions of all directories from that point down to 700 and all files from that point down to 600. Also tell SELinux that it's OK if the web server tries to write things there. The commands to do this are:

sudo chown -R apache sites/default/files
sudo chmod -R u+rwX,go-rwx sites/default/files
sudo chcon -R -t httpd_sys_rw_content_t sites/default/files

If you determine that you really do need Drupal to be able to write there for some reason -- again, it's best to avoid this unless you actually do need it -- and would like me to set things up for you, just let me know and I'll be happy to do so.

Note that "www-data" is an example username that is used in Drupal documentation such as https://drupal.org/node/244924 This user does not exist on our systems, the corresponding user on our systems is "apache"

I don't know why Drupal is complaining about /var/tmp. You may have better luck with /tmp. If this doesn't work either, and you need it, let me know and I'll look into whether the problem is caused by SELinux or not.

Posted by kkwaiser at 09:30 AM | Comments (0)

Trigger Rules Action based on URL

In Drupal 6, I used the Path Rules module but it appears this is not going to be ported because the functionality exists in the base Rules module.

How to do this in D7 Rules?

Events to use:

1) If the page to be viewed is a Node then you can use "Content is Viewed".

2) If the page to be viewed is not a node but is a view or panels page then use "Drupal is initializing". Note that this fires every time someone looks at a page and probably engenders a performance hit. In Rules Bonus Pack, there is also a possibility to use Page manager's custom pages as Rules triggers.


Using the Text Comparison is the way to go. For example I used
site:current-page:path under Data Selector and data/\d+/summary under the Matching Text with the Comparison Operation set to Regular Expression. This allows for use of a wildcard. That regex is equivalent to data/*/summary where * is an NID argument.
If your URL is dynamically constructed with an argument, you

Posted by kkwaiser at 09:09 AM | Comments (0)

June 14, 2012

Digital Curation Bibliography

Digital Curation Bibliography

In a rapidly changing technological environment, the difficult task of ensuring long-term access to digital information is increasingly important. The Digital Curation Bibliography: Preservation and Stewardship of Scholarly Works presents over 650 English-language articles, books, and technical reports that are useful in understanding digital curation and preservation. This selective bibliography covers digital curation and preservation copyright issues, digital formats (e.g., data, media, and e-journals), metadata, models and policies, national and international efforts, projects and institutional implementations, research studies, services, strategies, and digital repository concerns. Most sources have been published from 2000 through 2011; however, a limited number of key sources published prior to 2000 are also included. The bibliography includes links to freely available versions of included works, such as e-prints and open access articles.

Posted by kkwaiser at 08:57 AM | Comments (0)

June 01, 2012

Upgrading to D7

A link from a SNRED who works with Drupal.

Posted by kkwaiser at 03:20 PM | Comments (0)