If you were too used to Backtrack Linux and want to revert your Kali Linux Login to classic Backtrack command line login, then you’re not alone. The whole idea of command line login was to get a fast and quick access to a system where you can perform some task as quickly as possible and waste time and resources on Window or Desktop Manager. If you’re using an old laptop or an old Desktop that doesn’t have a powerful graphics card, running Kali Linux with GNOME (gdm3) Desktop is wasting valuable CPU and Memory and making your already dying hardware slower. You type in something, and get an output few seconds later. You hate it, I’d hate it too. Nothing to worry… in this guide I will demonstrate 2 different ways of reverting your Kali Linux Login to classic BackTrack command line login. The first one is possibly the safest if you’re not too sure what you’re expecting, the second way if slightly more advanced (well, not much but you need some Linux command understanding to run Kali Linux anyway).
In both method, I’ve shown how to disable gdm3 which is default in Kali Linux GNOME Desktop. If you’re using KDE, I am assuming you don’t want it disabled cause you’re enjoying your shiny Desktop too much.. But in case you want to disable KDM at startup, use the first method (aka Quickest Method) to achieve that. It’s just more safer and quicker in every sense.
Once you’ve done making the changes, your Kali Linux login will be similar to the screenshot above (el classico BackTrack command line login)
Quickest Method
You can achieve the same with the following
Install chkconfig package and link gdm3 with startx
Issue the following commands to install chkconfig package and soft-link gdm3 with startx.
apt-get install chkconfig -y ln -s /usr/sbin/gdm3 /usr/bin/start
Check current status of gdm3
Once you’ve installed chkconfig, use the following command to check run-level status of all running services. In here, we are particularly interested in gdm3 service. If you’re running KDE Desktop, you might have to look for KDM service.
chkconfig -l
Now we know what we should be expecting. So let’s move on and disable gdm3 from loading.
Disable gdm3 from run-level
Issue the following command to delete gdm3 from run-level. Nothing to worry, we can revert it back easily. Once you’ve deleted gdm3 from run-level, then reboot.
chkconfig --del gdm3 reboot
Once reboot is done, login via console and issue the following command if you need GUI once again.
startx
All we are doing here is removing gdm3 from Check Config (startup) and linking gdm3 with startx. Once reboot, we can use startx if you want GUI again.
If you want to exit out of GUI, press CTRL+ALT+F1
and press CTRL+C
That will take you back to same old command line window. Pretty savvy!!
Rollback Changes:
To rollback this change, all you need to do is issue one command and reboot. How easy is that!.. Beats typing is few more commands and making another unnecessary mistake …
chkconfig --add gdm3 reboot
As you can see from the screenshot above, we’ve retained the runlevel as shown in the previous screenshot… That was the whole reason I wanted to use chkconfig instead of mulling over command line and making another typo…
Old school method
Here’s another copy paste method. It’s really upto the user on how he want’s to achieve the outcome. I particularly like the one above as it got a better way of managing things and less cool stuffs. In my mind, the less you need to do to achieve results, the better the outcome is. But hey, you might be interested in the followings for learning purposes, I’m not here to judge… So here goes…
cp -n /etc/X11/default-display-manager{,.bkup} echo > /etc/X11/default-display-manager cp -n /etc/gdm3/daemon.conf{,.bkup} sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = True/' /etc/gdm3/daemon.conf sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' /etc/gdm3/daemon.conf ln -s /usr/sbin/gdm3 /usr/bin/startx # Old school ;)
Step by step walk-through with explanations
STEP 1: Remove our Default Display Manager
Since we don’t want any graphical default display, we’re going to simply clear the file out completely.
First, open a terminal. From here, we will backup our default display manager before we clear it out:
cp /etc/X11/default-display-manager /etc/X11/default-display-manager.backup echo "" > /etc/X11/default-display-manager
STEP 2: Set GDM3 to autologin.
Because we want to save time we might be better off enabling autologin for our desktop session. I’ve only shown how to autologin in GNOME Desktop here (gdm3), but if you’re using KDE, then the step’s are slightly different. There’s a separate post about how you can enable autologin in Kali Linux for both GNOME and KDE which might be worth checking out.
Since we’re forced to login to even use the command line, there is really no reason to have GDM3 prompt us to login — in a situation where we boot up wanting the desktop environment. So, we can tell gdm3 to autologin (to an account of your choosing) when, and if, you decide to load it.
cp /etc/gdm3/daemon.conf /etc/gdm3/daemon.conf.backup leafpad /etc/gdm3/daemon.conf
Now, under section “[daemon]
” we want to change both AutomaticLoginEnable
and AutomaticLogin
lines
[daemon] # Enabling automatic login # AutomaticLoginEnable = true # AutomaticLogin = user1
Should now look like:
[daemon] # Enabling automatic login AutomaticLoginEnable = true AutomaticLogin = root
Here’s a screenshot from it from one of previous post that shows how to enable login in Kali Linux for KDE and GNOME.
NOTES
Now, whenever you boot into Kali, you’ll be prompted to login at the command line, rather than the gdm3 GUI. Once logged in, you can always startup your desktop environment by simply typing in
gdm3
(optional) STEP 3: Use the the classic ‘startx’ command to run GNOME
Simply open a terminal and type the following:
ln -s /usr/sbin/gdm3 /usr/sbin/startx
Now, rather than using gdm3 to start gnome, you’d use ‘startx
‘.
All in all, I still think the first method was better, quicker and cleaner. You might have a different view as you might want to control things at every level.
Thanks for reading. Let me know how it went and if you found this article useful, share this page and don’t forget to Like our Facebook page
Sir
I have to enter user name and password 2 times (at cli and gui) , perhaps that was what you called auto login but nothing happens even when i change the /etc/gdm3/daemon.conf file .
Thank You
Hi. i followed the steps and it works. But i have a problem. It’s waiting approximately 30 seconds after startx command. I think there is a problem on my xconfig settings. Because i get some error messages about xconfig after startx command.
hello dude..
I am Sagar, I am having already that type of situation on Kali linux machine. On my machine there is above like command line login and I want to go back again, I want permanently again that previous GUI type of graphical display on my kali linux.
Please help me out in this scenario. … I have also clicked on one of the google ads on your websit -:)
Great…!!
Nice, but seems dirty, leaves failure messages during boot(not really bad, but makes me want to fix it), and the startx command needs sudo.
By the way, at the beginning of this post you say to link gdm3 to startx, but in the example you just type start.
Hi, Thanks for the article, but in kali 2.0 this method doesn’t work and Kali team didn’t use gdm3 and chkconfig didn’t work for revert to console mode.
Do you have any solution?
Try to use this command:
systemctl set-default multi-user.target
The default is graphical.target. You can get the current default via
systemctl get-default
After login, you can launch gnome using startx
Ethical.falc0n
Thank You, But It doesn’t load completely.
after load the gdm3, It doesn’t load and show the box where I can enter Username and Password for Loging on), so I can’t Login.
Thank’s anyway
By the way, the console mode loads successfully but after I run gdm3 command, the event that I explained above, occurs.
You want to come back? It didn’t sound clear, what problems do you have? For disabling the lightdm autostart (boot to CLI) type: ‘systemctl set-default multi-user.target’ to enable lighdm again type: ‘systemctl set-default graphical.target’.
No, sorry I’m so bad at explaining.
I mean the ‘systemctl set-default multi-user.target’ command works successfully and loads console mode, but when I’m in console mode and I want to load and go to Desktop temporary, I don’t want to use ‘systemctl set-default graphical.target’, I use ‘sudo gdm3’ command for loading the login page but it doesn’t load completely, It loads only page and not the Logon boxes and I can’t enter my username and password to enter to the Desktop.
Installing chkconfig is not the right way. Systemctl is definitely the “correct” way to do this nowadays.
cp -n /etc/X11/default-display-manager{,.bkup}
echo > /etc/X11/default-display-manager
cp -n /etc/gdm3/daemon.conf{,.bkup}
sed -i ‘s/^.AutomaticLoginEnable = ./AutomaticLoginEnable = True/’ /etc/gdm3/daemon.conf
sed -i ‘s/^.AutomaticLogin = ./AutomaticLogin = root/’ /etc/gdm3/daemon.conf
ln -s /usr/sbin/gdm3 /usr/bin/startx
How can I revert these changes?
Kali 2 won’t boot in gui anymore. When I type gdm3 or start x nothing happens anymore and I have to reboot..
Can someone please help. Otherwise I have to reinstall :(
On newer kali linux with systemd this does not work … you will need to do this to actually stop gdm3 on reboot:
systemctl set-default multi-user.target