1 00:00:06,639 --> 00:00:12,009 Now that you know a little bit about these targets, let's explore how to work with them. 2 00:00:12,990 --> 00:00:14,740 Here on the slide. You see the commands. 3 00:00:15,480 --> 00:00:16,309 Let me demonstrate. 4 00:00:17,969 --> 00:00:22,390 So, systemctl get default showing the default target. 5 00:00:22,899 --> 00:00:28,774 I want to change that and I'm going to 6 00:00:28,774 --> 00:00:34,649 use sudo systemctl set default on multi user target. 7 00:00:36,909 --> 00:00:43,130 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. 8 00:00:43,850 --> 00:00:47,469 Let me reboot here. I'm in multi user target, 9 00:00:47,469 --> 00:00:51,090 no graphical user interface and I can log in. 10 00:00:52,170 --> 00:00:53,149 Let me do that. 11 00:00:54,049 --> 00:01:00,283 And now systemctl list dependencies is showing what? Well, it's showing everything that is happening in the multi user 12 00:01:00,283 --> 00:01:06,516 target. And there you can see that the multi user target is taking care of all these service units. 13 00:01:06,516 --> 00:01:12,750 And then by itself it includes a basic target and even more if you scroll down further. 14 00:01:13,689 --> 00:01:19,854 Now I would like to show you how to switch to a different 15 00:01:19,854 --> 00:01:26,019 target and I'm using sudo systemctl isolate on emergency target to do so. 16 00:01:26,659 --> 00:01:30,784 Systemctl isolate is what you will use if you want to get 17 00:01:30,784 --> 00:01:34,909 from a target that has more to a target that has less. 18 00:01:35,790 --> 00:01:41,165 And oh boy, what do we get? Now it's telling us I'm in emergency mode. And 19 00:01:41,165 --> 00:01:46,540 what is it telling? It's saying cannot open access to console, root account is locked. 20 00:01:47,040 --> 00:01:54,030 And what happens if I press enter? Well, if I press enter then sadly I can't get into the emergency mode. 21 00:01:54,730 --> 00:01:59,109 Emergency target requires access to the root account. 22 00:02:00,390 --> 00:02:05,310 I better get back to my normal target and enter in there. 23 00:02:05,849 --> 00:02:12,349 Then I can use sudo passwd on root because if I don't have a root password, I don't get in. 24 00:02:13,180 --> 00:02:19,719 I'll later show you how you can hack the root password if that is required, but for 25 00:02:19,719 --> 00:02:26,259 now I'm just setting it manually and let me use this systemctl isolate on emergency target again. 26 00:02:27,300 --> 00:02:33,010 So this is what you get in the emergency target. And the problem in the emergency target is you 27 00:02:33,010 --> 00:02:38,720 need to enter the root password. Well, now we have a root password, so let me enter it and 28 00:02:38,719 --> 00:02:44,430 let me use systemctl list units for an overview of all the units that are currently loaded. 29 00:02:44,969 --> 00:02:48,759 Now this is emergency target. It's a special rescue environment 30 00:02:48,759 --> 00:02:52,550 and that only loads a minimal amount of units. 31 00:02:53,569 --> 00:03:00,099 Now I'm okay with the emergency target and that means that I want to get 32 00:03:00,099 --> 00:03:06,629 back to my normal operational state and I'm going to use systemctl start default target. 33 00:03:07,949 --> 00:03:14,294 The default target. Well, that was multi user target, right? I don't want to go to multi user target. 34 00:03:14,294 --> 00:03:20,639 I'm going to use systemctl start graphical target and that is bringing me back to the full graphical environment.