ch 4 linux + questions
how to cancel a pending shutdown
shutdown -c Ctrl + c
4.5 System Shutdown Previous Resource4.5.5 Shut Down ImmediatelyNext Resource The power has gone out in your facility. You have an Uninterruptible Power Supply (UPS) that protects your system and provides enough power to allow you to shut down safely. In this lab, your task is to immediately shut down the system using the command line.
shutdown -h now
You need to shut down the system immediately and send a message to logged-in users to allow running processes to close gracefully. Which of the following is the BEST to use?
shutdown -h now
how do you shutdown the linux system immediately
shutdown -h now halt init 0 systemctl isolate poweroff.target systemctl isolate runlevel0.target
how to shut down linux system in the designated amount of time and sends a message
shutdown -h time message shutdown -r time message
What command sends a warning message to log out of the system but does not actually shut down the system?
shutdown -k message ex: shutdown -k Please log out of the system
You want to reboot the Linux server at midnight to perform an automatic upgrade to the system. You also want to warn employees that the server will be rebooting at midnight for upgrading. Which of the following commands should you enter?
shutdown -r 24:00 System going down at Midnight for upgrade
how to shut down the system immediately and then reboot in linux?
shutdown -r now reboot init 6 systemctl isolate reboot.target systemctl isolate runlevel6.target
Which directory contains the configuration file for GRUB 2?
/boot/grub2/
Which directory contains the configuration file for GRUB 2?
/boot/grub2/ Explanation /boot/grub2/ holds grub.cfg, which is the configuration file for the GRUB 2 bootloader. The /etc/default directory holds the grub file, which can be edited to modify the default behavior of the GRUB 2 bootloader menu.
Drag the GRUB 2 file or directory on the left to the correct description on the right. The GRUB2 configuration file (non-editable)
/boot/grub2/grub.cfg
The GRUB2 directory for script files.
/etc/grub.d/
the GRUB2 directory for script files
/etc/grub.d/
If a systemd system is configured to use multi-user.target as the default boot target, which file has a symbolic link (symlink) to the multi-user.target file?
/etc/systemd/system/default.target
Which of the following common GRUB script files sets initial appears items, such as graphics mode, default selection, and timeout?
00_header
The GRUB2 configuration file (non-editable).
/boot/grub2/grub.cfg
What is the full path and filename of the GRUB 2 file that is used for editing the default behavior of the bootloader menu?
/etc/default/grub
the GRUB2 configuration file (editable)
/etc/default/grub
The boot process for a Linux computer includes the following general stages:
1.BIOS (in the BIOS stage, BIOS is loaded, and the system hardware is identified). 2.Bootloader (during the bootloader stage, BIOS gives control to the bootloader program to load the kernel into RAM). 3.OS Kernel (during the OS kernel stage, the Linux kernel takes over). 4.systemd (during the initial stage, the systemd process determines what other programs to run, such as a login shell).
The script that identifies kernels on the root device and creates menu entries.
10_linux
The script file that allows menu entries to be modified.
40_custom
During the bootloader phase of the UEFI boot process, an optional initial RAM disk image called initramfs is loaded into memory. Which of the following BEST describes the initramfs image? (Select two.)
A custom version of the init program containing all the drivers and tools needed at boot Used to mount the file system and load the kernel into RAM.
Specifies units to be enabled or disabled as a set.
Also=
systemctl enable service.service
Automatically starts a daemon when the system starts.
What is another term used when referring to Linux services running under systemd?
Daemon
systemctl status service.service
Displays a daemon's status.
change GRUB timeout config lab
EXPLANATION Complete this lab as follows: Change the GRUB_TIMEOUT parameter. From the prompt, type nano /etc/default/grub and press Enter to open the GRUB2 configuration file for editing. nanoUse GRUB_TIMEOUT=10 as the new first line of the file. Press Ctrl + X to exit the editor.Type Y to save the modified buffer. Press Enter to save the file with the default name. Write the new GRUB settings to the grub.cfg file. From the Terminal prompt, type update-grub and press Enter to write the boot loader changes to the grub.cfg file. Reboot the operating system.Type reboot and press Enter to see the changes made to the wait time from the GRUB menu.Notice that the system waits 10 seconds before the OS loads.(Optional) Log in as root using 1worm4b8 as the password.
4.2.5 lab In this lab, your task is to: Change the default menu option for the GRUB2 boot loader to Windows 10. Write the new GRUB settings to the grub.cfg file. Reboot the machine and confirm that it boots to the Windows 10 operating system by default.
EXPLANATION Complete this lab as follows: Change the default menu option for the GRUB2 boot loader to Windows 10. At the prompt, type nano /etc/default/grub and press Enter to open the GRUB2 configuration file. Make GRUB_DEFAULT=Windows 10 the new third line of the file. Press Ctrl + x to exit the editor.Type y to save the modified buffer. Press Enter to write the file using the default name. Write the new GRUB settings to the grub.cfg file. At the terminal prompt, type grub2-mkconfig -o /boot/grub2/grub.cfg and press Enter to write the boot loader changes to the grub.cfg file. Reboot the operating system to Windows 10.Type reboot and press Enter.Wait for 5 seconds to let the system boot to Windows 10 by default.The system will only boot to the Windows splash screen.
4.5.7 Shut Down and Reboot Next Resource You have encountered system problems that require you to reboot the Linux server. You want to inform users that the system will shut down and reboot. In this lab, your task is to send a command to reboot the system in 5 minutes.
EXPLANATION Complete this lab as follows: Reboot the server in 5 minutes using the default warning message. From the Favorites bar, select Terminal. At the prompt, type shutdown -r +5. Press Enter to send the default message to logged-in users, give them 5 minutes to disconnect, and reboot the system.
Previous Resource4.5.6 Shut Down with Notification Next Resource You have informed your users that you need to bring the Linux server down at the end of the day to perform routine maintenance. However, prior to shutting the system down, you want to give users fifteen minutes to save data and exit the system. In this lab, your task is to: Shut down the system using a 15-minute delay before shutting down. Use The server is shutting down in 15 minutes as a message to all logged-in users.
EXPLANATION Complete this lab as follows: Shut down the server in 15 minutes and display a warning message. From the Favorites bar, select Terminal. At the prompt, type shutdown -h +15 The server is shutting down in 15 minutes to send a message to logged-in users, wait 15 minutes, and shut down the system. Press Enter.
You have a dual-boot system with a Linux and a Windows operating system. You need to configure the GRUB 2 bootloader to display the menu for 12 seconds before it automatically boots the default operating system. Which of the following is the BEST first step to configure the bootloader?
Edit the timeout parameter in the /etc/default/grub file to say GRUB_TIMEOUT=12
You have a dual-boot system with a Linux and a Windows operating system. You need to configure the GRUB 2 bootloader to display the menu for 12 seconds before it automatically boots the default operating system. Which of the following is the BEST first step to configure the bootloader?
Edit the timeout parameter in the /etc/default/grub file to say GRUB_TIMEOUT=12.
You are editing the /etc/default/grub file. Which option should you use to set the default operating system?
GRUB_DEFAULT=
Which of the following boot methods provides higher performance (larger files and greater distances than TFTP) and is often used to replace the PXE boot method of network deployment?
HTTP
Which of the following is the last step the OS kernel performs during a UEFI boot on a Linux machine?
Loads and executes either the init (Initial) process (for older distributions) or the systemd process (for newer distributions). he last step that the OS kernel performs during a UEFI boot is to load and execute either the init (Initial) process (for older distributions) or the systemd process (for newer distributions). The other listed steps occur during the OS kernel phase of the boot process before the last step. These include (in order): Initializes the hardware on the system. Locates and loads the initrd script to access the linuxrc program, which configures the operating system. Mounts the root partition.
systemctl is-enabled service.service
Looks to see if a daemon is configured to automatically start on system boot.
You have a Linux server where the bootloader is malfunctioning and can no longer boot. You want to re-install a new copy of Linux over the network using the firmware on the server's network card, and should be as simple to use as possible. Which of the following boot methods will BEST meet your re-installation needs?
PXE is the process whereby a computer initially boots from firmware installed on the computer's network card
systemctl disable service.service
Prevents a daemon from automatically starting when the system starts.
systemctl mask service.service
Prevents a daemon from starting at all, either automatically or manually, from the shell prompt.
systemctl reload service.service
Reloads a daemon's configuration without actually stopping the daemon itself.
Specifies that another unit requires this unit to be enabled.
RequiredBy=
Lists the units that must be activated for a unit to function.
Requires=
systemctl restart service.service
Restarts a daemon.
Which of the following will prevent a user from booting a computer, booting from removable devices, and changing UEFI/BIOS settings?
Set a UEFI/BIOS password.
Which of the following will prevent a user from booting a computer, booting from removable devices, and changing UEFI/BIOS settings?
Set a UEFI/BIOS password. Explanation Setting a UEFI/BIOS password will prevent a user from booting a computer, booting from removable devices, and changing UEFI/BIOS settings. The other options will not prevent a user from completing all of the listed tasks.
If an attacker boots into single-user mode, they will be logged in automatically as the root user without being required to enter the root password. Which of the following is the BEST measure you should take to prevent this event from happening?
Set a bootloader password.
You have a systemd Linux system configured to boot into the graphical.target by default. The system seems to be running much slower than normal. You need to reboot the system, but you want it to boot into a single-user target unit with no network access so you can perform troubleshooting tasks and get the system running normally again. What should you do before you reboot?
Set the default boot target to rescue.target.
systemctl start service.service
Starts a daemon.
systemctl stop service.service
Stops a daemon.
You are editing the /etc/default/grub file. Which option should you use to set the default operating system?
The GRUB_DEFAULT= option sets the default menu entry (operating system) in the /etc/default/grub file. Typical GRUB_DEFAULT entries include: Numeric (0, 1, 2, etc.) Complete menu entry quotation ("Ubuntu, Linux 2.6.31-9-generic")
Which of the following are requirements for a PXE boot to work on your Linux client computer?
The NIC in the client computer must support PXE boot. The client BIOS/UEFI must be configured to use PXE.
What component is responsible for loading and executing the initial process?
The OS kernel stage loads and executes the initial (init) process. During this stage, the Linux kernel: -Resides in the /boot directory. -Initializes the hardware on the system. -Locates and loads the initrd script to access the linuxrc program, which configures the operating system. -Dismounts and erases the RAM disk image (initrd image).
The current default boot target is a multi-user.target, but you want to use this system as a desktop workstation. You need a boot target that supports multiple users, supports networking, and has a graphical display. This is a systemd system. What command should you enter to change the default boot target to one that meets these needs?
The command systemctl set-default graphical.target changes the target unit to one that supports multiple users, networking, and a graphical interface.
Which of the following has a process ID (PID) of 1?
The initial process has the process ID (PID) of 1 because it is the first process to run on the system. On a SysV init Linux system, the name of the initial process is init. On a systemd Linux system, the initial process is named systemd. The BIOS, bootloader, and OS kernel do not receive PIDs.
You have a system with more than one Linux operating system installed. During the system's bootup process, which component loads a splash screen, allowing you to choose which operating system you want to run?
The secondary bootloader provides a splash screen that allows you to choose which operating system you want to load. This occurs in the bootloader stage of the boot process. Specifically, during the bootloader stage, the following steps take place: BIOS searches the boot sector, which contains a Master Boot Record (MBR). BIOS loads the primary bootloader code from the MBR. The primary bootloader takes one of two actions: Examines the partition table marked as bootable and then loads the boot sector from that partition. This boot sector contains a secondary bootloader, which locates an OS kernel. Locates an OS kernel directly, without using a secondary bootloader.
Which of the following is responsible for bringing up other units and services when boot targets are changed?
The systemd daemon is the first daemon to start during boot-up and the last to terminate during a system shutdown. systemd manages all daemons, processes, targets, and services (including itself) as units. Each target is defined by specific units, and systemd monitors the start and stop of each unit for each target. The init daemon serves a similar purpose on SysV init systems, but init manages services for runlevels. The terms unit and target are used with systemd systems. The systemctl command is used on systemd systems to manage processes and change target units. The service command is used to manage processes on SysV init systems.
The vmlinux and Linux Linux kernel executables contain information that can be used for what purpose? (Select the correct answer from the drop-down list.)
The vmlinux and vmlinuz Linux kernel executables contain information that can be used for debugging.
systemctl unmask service.service
Unmasks a previously masked daemon. This allows the daemon to be started either manually or automatically.
what does the -f parameter stand for when using shutdown command in linux?
fast and skips the fsck utility on reboot (shutdown -rf)
Which of the following commands will help you to determine which version of GRUB is installed on your Linux system? (Select two.)
grub2-install --version grub-install -v
Entering shutdown -h now or init 0 at the command prompt immediately shuts down your Linux system. What other command can you use to perform the same task?
halt system isolate poweroff.target runlevel0.target
You are experiencing a problem with a SysV init network server. You want to bring the system down and try reseating the cards within it before restarting it. Which command completely shuts down the system in an orderly manner?
init 0
You are experiencing a problem with a SysV init network server. You want to shut down the system immediately and reboot it. Which command completely shuts down the system immediately and reboots it?
init 6
What does the -r parameter issue during shutdown command in linux/
issues a reboot after shutdown
You have just finished installing an updated kernel on your email server that has been patched to solve a security vulnerability and wish to reboot as soon as possible. This is a busy time of day, and you do not want the server down any longer than necessary. Which option prevents fsck from running after the reboot and allows the system to boot faster?
shutdown -f
You have informed users that you need to bring the machine down at the end of the day to perform routine maintenance. However, prior to shutting the system down, you want to send a message to users to give them fifteen minutes to save data and exit the system. Which of the following is the BEST command to use?
shutdown -h +15 It is time for a shutdown!
You are working on a systemd-based Linux distribution. Which command can you use to manage the services and targets?
systemctl
Displays the current boot target.
systemctl get-default
You are experiencing a problem with one particular server. Each time it boots, it goes into single-user mode even though no warnings or errors are reported. You want to verify that it is configured to boot to the multi-user.target unit, just as all your other servers are. This system is running systemd. Which command would you use to see which boot target is set as the default?
systemctl get-default
Your system is currently running the multi-user.target. What would you enter at the command prompt to find out whether the atd.service is configured to start every time the multi-user.target is loaded?
systemctl is-enabled atd.service
Changes the system state to the specified boot target. Changing boot targets with the systemctl command changes only the current system state. If the system is restarted, it will revert back to the default boot target.
systemctl isolate boot_target
You are on a systemd system. Without rebooting the system, you want to change from the currently running target unit to a target that supports networking, supports multiple users, and displays a graphical interface. What command should you enter to accomplish this task?
systemctl isolate graphical.target
Your system is currently running the multi-user.target. You want to enable bluetooth.service to run when graphical.target is loaded. There are two commands you must enter from a command prompt to accomplish this task.
systemctl isolate graphical.target systemctl enable bluetooth.service
You are experiencing a problem with a network server. You want to bring the system down and try reseating the cards within it before restarting it. Which command runs poweroff.target to shut down the system in an orderly manner?
systemctl isolate poweroff.target
You need to perform some system maintenance on a systemd system, and you want to prevent users from logging on while you do so. Which command should you run?
systemctl isolate rescue.target
You want to prevent the nfs.service daemon from starting at all on your Linux server. What command would you enter to perform this task?
systemctl mask nfs.service
You are working on a Linux server that uses systemd. You have made changes to the firewall settings. What systemctl command can you enter to implement the changes on the server without stopping the firewall?
systemctl reload firewalld.service
After making changes to the configuration of anaconda.service, you must make those changes take effect. Which single command can you enter to force the service to use the new configuration?(Note that there is no reload option with this service.)
systemctl restart anaconda.service
Sets the default boot target, which is identified by the /etc/systemd/system/default.target file. This file is a symbolic link that points to a target file in /usr/lib/systemd/system that should be used by default when the system starts. This command modifies the target file that the default.target symbolic link points to.
systemctl set-default boot_target
While working on your Linux server, you want to practice starting, stopping, and restarting a service using the systemctl command. In this lab, your task is to: Use the systemctl command to start bluetooth.service. Use the systemctl command to stop bluetooth.service. Use the systemctl command to restart bluetooth.service.
systemctl start bluetooth.service systemctl status bluetooth.service systemctl stop bluetooth.service systemctl status bluetooth.service system restart bluetooth.service systemctl status bluetooth.service
After getting calls about users not being able to print, you check the status of cups.service and find that it is not running. What would you enter at the command prompt to run cups.service?
systemctl start cups.service
What would you enter at the command prompt to determine whether cups.service is running?
systemctl status cups.service or systemctl status cups
You notice that the ntpd service is no longer running on your Linux server. You try using the systemctl start and systemctl restart commands to start the service running again. However, the service refuses to start. Which of the following systemctl commands could you try using to make the ntpd service available for starting or restarting?
systemctl unmask ntpd.service
command to print a list of running units, listed in the order of time to initialize. Consider that initialization time includes the time a unit must wait for another unit to complete.
systemd-analyze blame
After updating the settings in the /etc/default/grub file, you know the changes must be written to the grub.cfg file before they will be used. What would you enter at the command prompt to write the changes to the grub.cfg file?
update-grub Explanation The grub2-mkconfig -o /boot/grub2/grub.cfg command generates and writes changes to the /boot/grub2/grub.cfg file. Specifically, this command uses the /etc/default/grub file and the scripts in the /etc/grub.d/ directory to generate the /boot/grub2/grub.cfg configuration file.
After updating the settings in the /etc/default/grub file, you know the changes must be written to the grub.cfg file before they will be used. What would you enter at the command prompt to write the changes to the grub.cfg file?
update-grub explanation: the grub2-mkconfig -o /boot/grub2/grub.cfg command generates and writes changes to the /boot/grub2/grub.cfg file. Specifically, this command uses the /etc/default/grub file and the scripts in the /etc/grub.d/ directory to generate the /boot/grub2/grub.cfg configuration file. Changes made in the configuration files will not take effect until the grub2-mkconfig command is executed.
You're working on your Linux server and need to change to single user mode. You can change to single user mode with the systemctl command and rescue.target, which is a special target unit that runs a base system in single user mode and a rescue shell. In this lab, your task is to: Use the systemctl command to make rescue.target the current target. After changing to rescue.target, log back in as root using 1worm4b8 as the password.
use systemctl isolate runlevel1.target or: Complete this lab as follows: Change the system to single user mode. At the prompt, type systemctl isolate rescue.target and press Enter to change the runlevel to rescue.target. Enter the password 1worm4b8 and press Enter to log in to the root account after changing the current target.
Lists the units to start before this unit is started.
After=
4.4 System Services Previous Resource4.4.5 Enable System Services at BootNext Resource While working on your Linux server, you want to enable anaconda.service and disable vmtoolsd.service using the systemctl command. In this lab, your task is to complete the following: Use the systemctl command to enable anaconda.service. Use the systemctl command to disable vmtoolsd.service. After each command, verify that the service has been enabled or disabled appropriately with the systemctl command.
Complete this lab as follows: Enable anaconda.service. From the Favorites bar, select Terminal. At the prompt, type systemctl enable anaconda.service and press Enter. Type systemctl is-enabled anaconda.service and press Enter to verify that the service is enabled. Disable vmtoolsd.service. Type systemctl disable vmtoolsd.service and press Enter. Type systemctl is-enabled vmtoolsd.service and press Enter to verify that the service is disabled. systemctl is-enabled service.service
You have just scheduled a reboot of your Linux system by using the shutdown -r 20:000 command. Now, you want to cancel that pending shutdown. Which of the following commands or keystrokes can you use to cancel the shutdown? (Select two.)
Ctrl +c shutdown -c
You are the system administrator, and your Linux server is not functioning properly. To begin your troubleshooting process, you have decided to boot your server into rescue mode. In this lab, your task is to: Set the default target to rescue.target. Verify that the current default target is rescue.target.
Complete this lab as follows: Set the default target to rescue.target. From the Favorites bar, select Terminal. At the prompt, type systemctl set-default rescue.target and press Enter to change the default boot target to rescue.target. Verify that the current default target is rescue.target. Type systemctl get-default and press Enter to verify that the current default target is rescue.target.
Lists negative requirement dependencies.
Conflicts=
When using the shutdown command to shut down a Linux computer, which of the following tasks does the system perform second?
Notifies logged-on users that the shutdown process has been initiated and the length of time before shutdown
When using the shutdown command to shut down a Linux computer, which of the following tasks does the system perform first?
Sends a SIGTERM message to open programs to allow them to close.
Specifies the unit requesting this unit to be enabled.
Wantedby=
Lists the units recommended to be in effect or started for the unit to function.
Wants=
what is a daemon?
a background process that runs without the need for user interaction