Ok, this is usually a hardware issue but could be drivers. Normally if you see it related it X it's a stale video driver. Try updating your video drivers. Finally you can always
echo 0 > /proc/sys/kernel/hung_task_timeout_secs
This will effectively quite is symptom but the problem will remain. This is certainly related to either failing hardware or bad drivers. The fact that you can actaully reboot via command line leads me to believe that it's a bad video driver. Make sure your running the latest video driver and that when you upgraded to 12.04 you kept using the same driver you were using when it was working (open v.s. propitiatory).
Another thing to look at is making sure you don't have any network shares mounted. When you log out of X network manager terminates a wireless connection. This will cause the system to hang for several minuets per file system read. During shutdown this can be quite a lengthy process. The quick test/fix is make sure all remote shares are unmounted before logging out. If that is the case then you should try adjusting your mount commands to show that they are network mounts and should be unmounted before you turn off the wifi connection. This varies by file system and mount type.