Ubuntu14 Redirected back to login screen after entering correct credentials

I wanted to discuss one issue I ran into today and how I fixed it, in case someone runs across the same issue.

The Problem
I was prompted to do an update after logging in. In the middle of the update I was prompted whether to update various configuration files for fglrx, I accidently pressed ‘no’ for the first option and ‘yes’ for all subsequent options. That ruined my configuration. After starting the computer later, I tried to login with the correct credentials and it would just return to the login page (playing the same sound you would hear once you land on the login page).

The Solution

  • Reinstall your graphics driver
  • Return to default setup when you install ubuntu desktop

To reinstall your graphics driver:
You can access terminal as if you are running the server addition by pressing ctrl+alt+f4.

If you ever need to go back (though you shouldn’t for these instructions) you would press ctrl+alt+f7.

My video card is from AMD so that is what I will talk about for this article. First you had to remove everything pertaining to fglrx with the following command:
sudo apt-get purge "fglrx.*"

Then install it again as you would have the first time
sudo apt-get install fglrx

Then what I did (which I’m not sure if its necessary or not) is remove the .XAuthority file found in /home/username using the following command
rm .XAuthority

Then reboot Ubuntu, which I’m pretty sure is the following command
sudo reboot

Ubuntu14: Install PyCharm Pro

First we need to install some dependencies.

Install JRE
Pycharm requires Java Runtime Environment (JRE) to work. You may want to consider getting Java Development Kit (JDK) as it contains the JRE and development tools in case you need to install it in the future. To install Oracle JDK I have written a guide here.

Install Python tools
The instructions for this depend on which version of python you intend to support in your application. Installing the following packages should ensure you have the necessary python tools.
sudo apt-get install python-setuptools

Optionally if you are using pip requirements in your project, or planning to deploy it you will most likely want to consider using PIP. It is a package installation tool.
sudo easy_install pip

Install Virtual Env
I’m pretty sure that virtual env is required to run pycharm. If not, it is a good option to help manage different environments for each project and I would recommend it regardless.
sudo pip install --upgrade pip virtualenv virtualenvwrapper

Install PyCharm (finally)
Download PyCharm Professional from this link. Students, there is an option to get a 1 year student license for the professional edition. You should read the details of the license (as I don’t know its details).

PyCharm should download as a tar.gz file. Once downloaded, open the terminal and move the the directory containing the tar.gz file.

To unpackage the tar.gz file:
tar -xzf pycharm*.gz

Optionally, you may want to extract the tar.gz file at a different location where you intend to use it.

To run pycharm you need to run pycharm.sh in the bin folder of the installation. Make sure to fill in the correct version number by replacing the Xs.
cd /pathtoinstallation/pycharm-5.X.X/bin

When you want to run, run the pycharm.sh file. But ensure you run with sudo privileges.
sudo ./pycharm.sh

Ubuntu 14 : Setup Oracle JDK

Get the latest tar.gz version for Linux from:

Open the terminal and move to the directory containing the tar.gz file

The filename will look something like jdk1.8.0_XX where XX will change because of updates. From 1.8 we know this is Java 8.

Once downloaded, decompress the tar.gz using the following command
tar -xzf jdk1.8.0_*
You will see the folder in the directory where you ran this command if it is successful.

Move it to a suitable location.. I used /usr/java as the folder for this. You probably wont have this folder on a fresh installation so
sudo mkdir /usr/java

Next if you are currently in the folder containing the decompressed jdk, we will move both the tar.gz and the folder you decompressed into the /usr/java directory.
mv jdk* /usr/java

Next in order for applications to know where the jdk is you need to have the value available to JAVA_HOME. I will tell you the steps to permanently set this variable.

We want the system to know where our java javac and javaws executables are
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_XX/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_XX/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/jdk1.8.0_XX/bin/javaws" 1
Again, don’t forget to replace the XXs with the update number.

We want to make sure the jdk is accessible to all user and application for execution so for each executable you find in the bin folder that you plan to use the following command as an example of what you need to execute. Again don’t forget to replace the XXs with the update number.
sudo chmod a+x /usr/java/jdk1.8.0_XX/bin/java
sudo chmod a+x /usr/java/jdk1.8.0_XX/bin/javac
sudo chmod a+x /usr/java/jdk1.8.0_XX/bin/javaws

How to setup a persistent Ubuntu Trusty on USB Drive

Both of these articles are clearly outdated but I found them successful after I did minor adjustments

Part 1:
From PenDriveLinux.Com

Follow the instructions here except one modification.
When it says “Navigate to System > Administration > Startup Disk Creator: ” you instead press the start (I think its called super on linux) button and search Startup Disk Creator instead.

This is not sufficient because you won’t have a ‘persistent’ installation. Pretty much nothing you do when you start-up on the USB drive will be saved for the next session. Don’t try installing from this USB!

Part 2:
From: UsbUbuntu.wordpress.com

No need to read the guide. The only takeaway needed was the addition of the following bolded code in the specified file.


if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

menuentry "Ubuntu persistent" {
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper persistent quiet splash --
initrd /casper/initrd.lz

menuentry "Try Ubuntu without installing" {
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash --
initrd /casper/initrd.lz
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash --
initrd /casper/initrd.lz
menuentry "Check disc for defects" {
set gfxpayload=keep
linux /casper/vmlinuz.efi boot=casper integrity-check quiet splash --
initrd /casper/initrd.lz

You will notice if you reboot from your USB that you will see a new menu entry called “Ubuntu persistent” at the top and that’s the one you click.

The remaining problem for me is the speed. It may be just because we are using a USB stick I don’t know! It seems that USB 3.0 ports should transfer much faster than what I’m getting. One measure I took which may just be a coincidence is I setup an administrative user system settings> user accounts, you will need to set a password to use sudo. If the strong password thing was bothersome for you as it was for me try passwd in terminal once you restart and are logged in as that user.

Django 1.9 How to Setup ORM Models (Pycharm)

In this tutorial I will assume that you are using the Django module you created when you started the project (though it can be modified slightly if its a different module)

– models.py
– settings.py

I will assume that myapp is that original module you created and model.py is where your ORM models are.

Step 1:
Ensure that you list myapp under INSTALLED_APPS list in settings.py. It is not there by default!

Step 2:
Ensure that on top of models.py you have the following import
from django.db import models

Also as part of step 2 you may need other imports to use some of the default tables that come with Django. For example, I always use the auth_user table which requires:
from django.contrib.auth.models import User

Table Generation (Made Easy?)
Step 1:
In settings.py ensure you have the following code snippet present since it is defaulted as false
migrated = True

Step 2:
Run the following in command line from the project’s directory. You may need sudo privileges. Remember to change myapp to your app’s name.
./manage.py makemigrations
You may be required to specify myapp after makemigrations

Step 3:
You will have noticed that the above command would have made a directory migrations with file(s) in it.

The directory should have changed to look like this

– models.py
– settings.py
– migrations
– – 0001_initial.py

A file similar to the above will be generated, there is an option to name the file which can be found in the references.

Finally, run the following to have your tables generated in the database
./manage.py migrate

Model Meta Options – Discusses managed option
Django Models – Contains instructions for using models
Using migration to generate your tables

MySQL List all Databases, List all Tables in a Database, List all columns in a Table (Ubuntu 14.04)

Running MySQL with super user privileges
mysql -u root -p

List all databases

List Tables in a Specified Database
SHOW TABLES FROM databasename;

List Columns in a Specified Table from a Specified Database
SHOW COLUMNS FROM dbname.tablename;

Setup MySQL for development (Ubuntu 14.04)

Since I have repeatedly had to do this I figured it’s time to make a guide for it. In case the other ones disappear on the INTERNET. Some of the parts require some testing.

Italicized fields means you have to fill in whatever string you want in that field.

    Ubuntu 14.04

Installation (From what I recall)
sudo apt-get update
sudo apt-get install mysql-server

You will be prompted during the installation to set a password for the super user.

Running MySQL with super user privileges
mysql -u root -p
You will be prompted for a username and password

Create a New Database
CREATE DATABASE databasename;

Create a New User
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Enlist user to a specific database
GRANT ALL PRIVILEGES ON databasename.* TO 'newuser'@'localhost';
You can further specify the tables you want to give the user but I assume that most developers would be looking for that.

The privilege changes you made won’t be applied until you do the following