So once your kernel has started, system D is starting.
And system D is going to initiate the default target.
So what is a target?
Well, a system D target is a group of unit files.
Some targets are isolatable.
And that means that they define the final state
that the system is starting in.
And some targets are not.
You may have printer.target, for instance,
for all units that relate to printing.
And then the target is just a convenient way
to make sure that all the relevant units are loaded.
The isolatable targets are important here.
And the default isolatable targets
are emergency target, which is a minimal system,
as minimal as it can be.
There is rescue.target, which is offering a little bit more.
Multi-user target is a fully functional system
without a graphical user interface.
And graphical.target is a fully functional system
with a graphical user interface.
Now, whenever you enable a unit using system CTL enable,
the unit knows that it is wanted by a specific target.
And it is added to the specific target.
Now, let me show you what is behind these targets.
So let me use system CTL list unit files minus T target.
Now we can see all the targets.
And as you can see, there's quite a bit.
Now, the target that I want to show you as an example
is the multi-user target.
So system CTL cat multi-user.target
should show its configuration.
Now, the funny thing is that it doesn't
have a lot of configuration.
It's telling us it requires this basic.target.
That makes sure that when starting the multi-user target,
basic.target is always included.
It will never come before basic.target or rescue.service
or rescue.target.
And allow isolatable is yes.
That means that you can use it to start your system
in a specific state.
Now, if you take a random service, system CTL
cat on vsftpd.service, for instance,
you can see that in the service, there is the install section.
And in the install section, you have a wanted by.
So wanted by is multi-user.target.
Now, what is going on?
The service knows what target it belongs to.
And the target doesn't know which services are included?
Well, not exactly.
Because if you use system CTL disable of vsftpd.service,
I'm doing that just to make sure because I wasn't
sure if it was enabled.
And now I can use enable.
Then look at what it is doing.
It's creating a symbolic link, etc.systemd.system,
multi-user.target.once.
And in the multi-user.target.once,
the target learns what it should be starting.
So the interesting thing is to have a look at etc.systemd.system,
multi-user.target.once.
And here we can see the ones.
These are the units that belong to the multi-user target.
So whenever you start your multi-user target,
all of this is going to be started.
And that's how the target is getting everything together.
Let me also show you system CTL list dependencies
on multi-user.target.
There we can see multi-user.target
and all of its dependencies.
Now, what you see here in the list
is the files that are included in the target.
And then we can see that this target is also
including some additional targets.
Basic.target.
That was listed in the dependencies, right?
It requires basic.target.
So whenever you start multi-user.target,
you will always get basic.target.
And basic.target by itself has a couple of other targets
that organize the way how your system is booting.
And that is how these targets are used in the boot procedure.
Now, whenever you boot your system,
you can specify the target as a boot argument.
Let me show you.
So I'm pressing E on the default option.
And there I'm using systemd.unit is multi-user.target.
And then I'm pressing Control-X.
And then I'm booting in the multi-user target.
Now, as I mentioned before, this is also
how you can enter troubleshooting targets,
like emergency target and rescue target.
But in order to do so, you need to have a root password.
Because in the emergency target and rescue target,
it will prompt for the root password.
And if you don't have a root password,
that is not going to work.
So here I'm in my multi-user target.
And I can enter my login credentials.
Let me do that.
And now I'm in.
And this is my text-only mode.
And if I want to get back to the full graphical target,
well, sudo systemctl start graphical.target
will get me in there.