Skip to content

Instantly share code, notes, and snippets.

@HallexCosta
Created February 22, 2025 17:53
Show Gist options
  • Save HallexCosta/9a6e20efdf53cf4a498ef63f818d89ed to your computer and use it in GitHub Desktop.
Save HallexCosta/9a6e20efdf53cf4a498ef63f818d89ed to your computer and use it in GitHub Desktop.
Loop Login in Ubuntu

Overview

Recently (22/fev/2025) I experienced a problem where I was unable to Login to my main Ubuntu user, as the login process went into a loop

My System

Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

Note

Use this commando to view lsb_release -a

Check the problem

  1. Use the shortcut ctrl + shift + f3 to open the terminal in login screen
  2. Create a new user with command
sudo adduser <yournewusername>
sudo usermod -aG sudo <yournewusername>
  1. Try restart the graphic server with command sudo systemctl restart gdm or sudo systemctl restart lightdm
  2. Restart your system with command reboot
  3. Look the login screen choose the your new user created and try access this account

Have success to access this new account? Probably your main account have problem to handle with xorg server This can happen due to several factors such as,

  • problems with package updates, generating corrupted files
  • incompatibility when changing versions between 20.04 to 22.04 or later

Before follow the solution try make logout from the newuser and try login with new account
if the problem still persists follow the topic below

Solution

My solution to solve this, was reinstall XOrg server in this user

  1. Use the shortcut ctrl + shift + f3 to open the terminal in login screen
  2. Try execute the commando startx Probably that you receive an error similar to this
/etc/X11/xinit/xserverrc: 3: exec: /usr/bin/X: not found
xinit: giving up
xinit: unable to connect to X server: Comection refused
xinit: server error
  1. Try install xorg
sudo apt update
sudo apt install xorg
  1. Check if the X command really exists with command ls -l /usr/bin/X

Important

Caution with case, the X must be in uppercase

  1. If the error persist, try reinstall with command sudo apt install --reinstall xserver-xorg
  2. Check if the command startx work fine, should be show a message similar to this
X.Org X Server 1.21.1.4
& Protocol Version 11, Revision 0
Current Operating System: Linux hallex-costa 6.8.0-52-generic 153*22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0-52-generic root=UUID=a5ecafBe-0ef7-43eb-a3a2-22f2110b9a9f ro
tsc=reliable clocksource=tsc quiet splash ut.handoff=?
xorg-server 2:21.1.4-2ubuntu1.7*22.04.12 (For technical support please see http://ww.ubuntu.com/support)
Current version of pixman: 0.40.0
Before reporting problems, check http://wiki.x.org to make sure that you have the latest version.
Markers: (--) probed, (**) fron config file, (==) default setting, (+*) from command line, (11) notice, (II) informational, (WW) warning,
(EE) error, (NI) not implemented, (??) unknown.
" home/hallexcosta. local/share/xorg/Xorg.2. log"
(==) Using systen config directory
• lousshare/Xy Xog-conlog- Time: Sat Reb 22, 13-51:30 2025
waiting for X server to shut down
(Il) Server terminated successfully (0). Closing log file.n to X server lost
  1. If you have success, restart the system with command reboot and try make login again in the main user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment