sudo startx would open the X GUI as the root user, but this shouldn't affect how you login as the pi user. Root and pi user are separate, and you shouldn't ever need to use the root GUI Are you sure the cause isn't something else? You may have to re-install Raspbian :(. I had something similar to this happen where it took a while to load the login screen, and crashed most of the time. I had to re-install Raspbian. Mine was probably caused because of some corrupted data, and that is probably what yours is too.