1 00:00:06,420 --> 00:00:10,080 - In this video, we are going to explore systemd targets. 2 00:00:10,080 --> 00:00:11,293 So what's a target? 3 00:00:11,293 --> 00:00:13,830 A target is a group of services. 4 00:00:13,830 --> 00:00:15,960 Some targets are isolatable. 5 00:00:15,960 --> 00:00:18,000 And that means that you can use them as a state 6 00:00:18,000 --> 00:00:20,430 that your system should be started in. 7 00:00:20,430 --> 00:00:24,210 There's four of them, emergency.target, and rescue.target, 8 00:00:24,210 --> 00:00:26,700 both of which are for troubleshooting, 9 00:00:26,700 --> 00:00:29,490 multi-user.target is a default state 10 00:00:29,490 --> 00:00:32,460 that a non graphical server will start in, 11 00:00:32,460 --> 00:00:35,280 and graphical.target is what you get 12 00:00:35,280 --> 00:00:38,433 if you start a fully graphical environment. 13 00:00:39,510 --> 00:00:43,260 You can use systemctl list-dependencies on a target to 14 00:00:43,260 --> 00:00:46,170 see the contents and dependencies of a system target. 15 00:00:46,170 --> 00:00:49,890 And you can use systemctl, get-default and set-default 16 00:00:49,890 --> 00:00:52,050 to find out which is your default.target, 17 00:00:52,050 --> 00:00:53,643 and to set your default.target. 18 00:00:54,780 --> 00:00:56,163 Let's go check this out. 19 00:00:58,020 --> 00:01:00,693 Okay, so I'm on my centos system and, 20 00:01:01,860 --> 00:01:04,933 well, I could use systemctl get-default, 21 00:01:07,800 --> 00:01:10,980 but honestly, if you see a graphical user interface 22 00:01:10,980 --> 00:01:12,480 that shouldn't be necessary. 23 00:01:12,480 --> 00:01:14,310 You see the graphical user interface 24 00:01:14,310 --> 00:01:17,130 you are most likely in graphical.target. 25 00:01:17,130 --> 00:01:18,750 You wanna know what is going on. 26 00:01:18,750 --> 00:01:23,476 Well, systemctl list.dependencies is going to help you, 27 00:01:23,476 --> 00:01:26,580 systemctl list.dependencies without any argument 28 00:01:26,580 --> 00:01:29,400 is showing what you currently are in. 29 00:01:29,400 --> 00:01:32,370 So, we can see that I'm in default.target. 30 00:01:32,370 --> 00:01:35,370 In default.target. we have all of these that are started. 31 00:01:35,370 --> 00:01:38,280 Now, default.target includes multi-user.target. 32 00:01:38,280 --> 00:01:39,630 And in multi-user.target, 33 00:01:39,630 --> 00:01:41,940 we have all of this stuff that has been started. 34 00:01:41,940 --> 00:01:45,120 And oh, we seem to have an issue with kdump.service, 35 00:01:45,120 --> 00:01:48,720 nice way of telling us that something is wrong. 36 00:01:48,720 --> 00:01:52,170 And next we can see that the multi-user.target 37 00:01:52,170 --> 00:01:55,260 itself includes the slice.target, the socket.target 38 00:01:55,260 --> 00:01:56,850 the sysinit.target, 39 00:01:56,850 --> 00:02:01,800 and so many more of these targets. 40 00:02:01,800 --> 00:02:03,840 So, these are the targets 41 00:02:03,840 --> 00:02:06,270 that are all in a state of isolatable. 42 00:02:06,270 --> 00:02:07,570 Now I want to show you 43 00:02:08,635 --> 00:02:12,627 systemctl list-units -t target, 44 00:02:16,290 --> 00:02:19,440 which is showing only units that are of the type, target. 45 00:02:19,440 --> 00:02:20,340 Now, what do we see? 46 00:02:20,340 --> 00:02:21,210 We see, for instance 47 00:02:21,210 --> 00:02:24,210 bluetooth.target, now, bluetooth.target 48 00:02:24,210 --> 00:02:26,160 you can imagine these are all the services 49 00:02:26,160 --> 00:02:29,730 that are required to initialize Bluetooth stack. 50 00:02:29,730 --> 00:02:31,333 But Bluetooth is not a state that 51 00:02:31,333 --> 00:02:34,620 you can boot your system into. 52 00:02:34,620 --> 00:02:38,070 So that is kind of confusing. 53 00:02:38,070 --> 00:02:38,970 Well, is it? 54 00:02:38,970 --> 00:02:40,890 Well, I don't think so, 55 00:02:40,890 --> 00:02:44,070 because really, in the end, there are only four 56 00:02:44,070 --> 00:02:46,530 targets that you can put your system into. 57 00:02:46,530 --> 00:02:49,350 And these are emergency, rescue, multi-user, 58 00:02:49,350 --> 00:02:50,880 graphical target. 59 00:02:50,880 --> 00:02:53,220 It's not much more difficult than that. 60 00:02:53,220 --> 00:02:56,820 And the other targets, are just groups. 61 00:02:56,820 --> 00:03:00,030 Groups that allow you to start one thing, 62 00:03:00,030 --> 00:03:01,560 and with this one thing, 63 00:03:01,560 --> 00:03:03,870 to initialize everything that is required, 64 00:03:03,870 --> 00:03:06,993 in this case for Bluetooth support, for instance.