Now that you know a little bit about these targets, let's explore how to work with them.
Here on the slide. You see the commands.
Let me demonstrate.
So, systemctl get default showing the default target.
I want to change that and I'm going to
use sudo systemctl set default on multi user target.
For now, nothing is changing. But this is the default target and it means that if I'm going to reboot, we should see the change.
Let me reboot here. I'm in multi user target,
no graphical user interface and I can log in.
Let me do that.
And now systemctl list dependencies is showing what? Well, it's showing everything that is happening in the multi user
target. And there you can see that the multi user target is taking care of all these service units.
And then by itself it includes a basic target and even more if you scroll down further.
Now I would like to show you how to switch to a different
target and I'm using sudo systemctl isolate on emergency target to do so.
Systemctl isolate is what you will use if you want to get
from a target that has more to a target that has less.
And oh boy, what do we get? Now it's telling us I'm in emergency mode. And
what is it telling? It's saying cannot open access to console, root account is locked.
And what happens if I press enter? Well, if I press enter then sadly I can't get into the emergency mode.
Emergency target requires access to the root account.
I better get back to my normal target and enter in there.
Then I can use sudo passwd on root because if I don't have a root password, I don't get in.
I'll later show you how you can hack the root password if that is required, but for
now I'm just setting it manually and let me use this systemctl isolate on emergency target again.
So this is what you get in the emergency target. And the problem in the emergency target is you
need to enter the root password. Well, now we have a root password, so let me enter it and
let me use systemctl list units for an overview of all the units that are currently loaded.
Now this is emergency target. It's a special rescue environment
and that only loads a minimal amount of units.
Now I'm okay with the emergency target and that means that I want to get
back to my normal operational state and I'm going to use systemctl start default target.
The default target. Well, that was multi user target, right? I don't want to go to multi user target.
I'm going to use systemctl start graphical target and that is bringing me back to the full graphical environment.