CORRECT TEXT With IPv6, how many bits have been used for the interface identifier of an unicast address? (Specify the number using digits only.)
Correct Answer:
64
Question 2
Which of the following options for the kernel's command line changes the systemd boot target to rescue.target instead of the default target?
Correct Answer: B
Question 3
Which of the following are init systems used within Linux systems? (Choose THREE correct answers.)
Correct Answer: B,D,E
Question 4
Task The system service apache2 is failing to start. First, troubleshoot the failure and fix it. Finally, start the systemd service and ensure it is running.
Correct Answer:
See the complete solution in Explanation. Explanation: Step 1: Connect to the correct Linux server. The video specifies that this task must be performed on host lfcs00101a. From the candidate terminal, execute: ssh lfcs00101a This establishes an SSH session with the server where the Apache service is failing. All subsequent troubleshooting, configuration changes, and service operations must be performed on this host. Step 2: Check the current status of the Apache service. Execute: sudo systemctl status apache2 This is the primary systemd command for checking the status of Apache. It displays information such as: * Whether the apache2 service is loaded. * Whether the service is running, inactive or failed. * The process ID and execution status. * Recent service log messages. * Errors reported during startup. An illustrative failure might appear as follows: × apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled) Active: failed (Result: exit-code) Process: 1234 ExecStart=/usr/sbin/apachectl start Main PID: 1234 (code=exited, status=1/FAILURE) This is an example, not an output confirmed from the supplied video. The Active: failed status means the service was unable to complete startup successfully. Use the actual error messages to determine the cause. Step 3: Examine the Apache service logs. Execute: sudo journalctl -u apache2 -b --no-pager * journalctl displays logs collected by systemd. * -u apache2 filters messages associated with the Apache service. * -b restricts results to the current boot. * --no-pager prints output directly without opening an interactive pager. To display only the latest 50 messages: sudo journalctl -u apache2 -n 50 --no-pager These logs help identify why Apache failed. Possible causes include: * Incorrect permissions on the Apache executable. * Invalid configuration directives. * Missing configuration files. * Another process using the required network port. * Inaccessible log directories. * Missing modules or other dependencies. The official systemd documentation supports using journalctl -u to investigate the logs associated with a particular service. Freedesktop Step 4: Check the Apache executable. On Ubuntu, the Apache server executable is normally located at: /usr/sbin/apache2 Verify its existence: ls -l /usr/sbin/apache2 For a more detailed permissions check: stat -c '%A %a %U:%G %n' /usr/sbin/apache2 A correctly installed executable would typically have permissions similar to: -rwxr-xr-x 755 root:root /usr/sbin/apache2 The x characters represent execute permission. For example, if the permissions were incorrectly changed to: -rw-r--r-- the executable would lack execution permission. This can prevent Apache from starting successfully. Step 5: Inspect the complete path permissions. Execute: namei -l /usr/sbin/apache2 This examines the permission bits and ownership of each directory component leading to the executable. It helps distinguish between: * A non-executable Apache binary. * A directory that lacks search permission. * Incorrect ownership or permissions elsewhere in the path. Also verify which package owns the executable: dpkg -S /usr/sbin/apache2 On Ubuntu, it normally belongs to the apache2-bin package. If required, check package-file integrity: sudo dpkg -V apache2-bin Package verification can help identify unexpectedly modified permissions or file contents. Step 6: Correct the executable permission if it is the source of the failure. In the supplied video, the candidate executes: sudo chmod +x /usr/sbin/apache2 This is an important observation. The command adds execute permission to the Apache executable according to the applicable chmod rules. However, the candidate does not visibly demonstrate the earlier diagnostic output proving that missing execute permission caused the failure. If the executable genuinely lacks its required execute permission, restore its expected mode: sudo chmod 755 /usr/sbin/apache2 * chmod changes file permissions. * 755 grants read, write and execute permissions to the owner. * 755 grants read and execute permissions to the group. * 755 grants read and execute permissions to other users. This is appropriate for a standard root-owned Apache executable when its mode has been incorrectly changed. Do not execute this as a universal fix if the actual failure is a configuration error or port conflict. Step 7: Verify the corrected permissions. Execute: ls -l /usr/sbin/apache2 Expected permissions, assuming the standard installation: -rwxr-xr-x For numerical verification: stat -c '%a %n' /usr/sbin/apache2 Expected: 755 /usr/sbin/apache2 If the file's ownership is also incorrect, compare it with the package's expected ownership before making additional changes. Step 8: Check the Apache configuration syntax. Execute: sudo apache2ctl configtest This checks the Apache configuration for syntax errors. For a valid configuration, the expected output is: Syntax OK The Apache control utility supports the configtest operation specifically for validating configuration syntax. Apache HTTP Server Version 2.4 If it reports an error, inspect the identified file and line. For example, an illustrative error might be: Syntax error on line 42 of /etc/apache2/apache2.conf Invalid command 'InvalidDirective' In that case, correct the configuration directive instead of modifying executable permissions. A successful syntax check does not guarantee that Apache can start, but it eliminates many configuration- related problems. Step 9: Check whether Apache's required network ports are available. Apache commonly listens on TCP port 80 for HTTP and port 443 for HTTPS. Execute: sudo ss -ltnp To examine those ports specifically: sudo ss -ltnp | grep -E ':(80|443)\b' If another service already occupies a port configured for Apache, startup may fail with an address-binding error. The official Apache documentation identifies port-binding conflicts as a common startup failure. Apache HTTP Server Version 2.4 Do not stop another service unless the diagnostic evidence establishes that it is the source of the problem and the change is appropriate. Step 10: Check Apache's own error log if necessary. Execute: sudo tail -n 50 /var/log/apache2/error.log This displays recent entries from the standard Ubuntu Apache error log. The file may contain additional details not included in the systemd journal. Look for permission errors, configuration failures, missing resources or binding errors. If the executable-permission repair was the only required correction, there may be no additional configuration changes to make. Step 11: Start the Apache service. After correcting the identified problem, execute: sudo systemctl start apache2 * sudo provides administrative privileges. * systemctl manages systemd services. * start requests that the specified service begin running. * apache2 identifies the Apache service unit. This command directly satisfies the task's instruction to start the systemd service. In the video, the candidate uses: sudo systemctl restart apache2 The restart operation stops and starts an active service or starts it when appropriate. Either operation can result in Apache running, but systemctl start apache2 is the more direct choice when the service is currently stopped or failed. Step 12: Verify that Apache is running. Execute: sudo systemctl status apache2 Expected successful status: # apache2.service - The Apache HTTP Server Loaded: loaded Active: active (running) The critical field is: Active: active (running) This indicates that systemd considers the service active. The official systemctl documentation defines the status command as the way to inspect the current runtime state of a service unit. Linux manual page Step 13: Verify the active service state directly. Execute: systemctl is-active apache2 Expected output: active Check the exit status immediately afterward: echo $? Expected: 0 The service is considered active when systemctl is-active returns active with a successful exit status. Step 14: Verify that Apache is listening for connections. Execute: sudo ss -ltnp | grep apache2 This should display Apache processes listening on the ports specified in its configuration, provided those sockets can be associated with the process in the command output. Alternatively, check the configured HTTP port: sudo ss -ltnp | grep ':80' An illustrative successful result might include: LISTEN 0 511 0.0.0.0:80 0.0.0.0:* The actual listening address and ports depend on Apache's configuration. Step 15: Test the Apache HTTP service. Execute: curl -I http://localhost This sends an HTTP HEAD request to the local web server. An example of a successful HTTP response is: HTTP/1.1 200 OK Server: Apache/2.4.x (Ubuntu) Content-Type: text/html The exact response code depends on the website's configuration. For example, a redirect or authentication response can still show that Apache is accepting connections. If the service is active but HTTP requests fail, inspect its listener configuration and logs. Step 16: Confirm that the service remains running. Execute: sleep 5 systemctl is-active apache2 Expected: active This additional check helps detect a service that starts briefly and then fails. You can also inspect recent logs: sudo journalctl -u apache2 -n 20 --no-pager Confirm that no further startup or runtime failures have occurred. Step 17: Perform final verification. Execute: sudo apache2ctl configtest systemctl is-active apache2 sudo systemctl status apache2 --no-pager curl -I http://localhost The final requirements are: Verification Expected result Apache configuration test Syntax OK Apache executable permission Valid executable permissions systemd service status active (running) HTTP connectivity A valid response from the configured service Original startup failure Resolved Final Solution The video suggests the failure may be related to execute permission on /usr/sbin/apache2. The following is the concise command sequence for that specific confirmed failure. 1. Connect to the server. ssh lfcs00101a 2. Check the service failure. sudo systemctl status apache2 sudo journalctl -u apache2 -n 50 --no-pager 3. Inspect the Apache executable permissions. ls -l /usr/sbin/apache2 4. Restore executable permissions if they are incorrect. sudo chmod 755 /usr/sbin/apache2 5. Validate the Apache configuration. sudo apache2ctl configtest 6. Start the Apache service. sudo systemctl start apache2 7. Verify the running service. sudo systemctl status apache2 systemctl is-active apache2 Expected: active 8. Verify HTTP connectivity. curl -I http://localhost Technical Verification and References The procedures are consistent with official Apache and systemd documentation: * Apache HTTP Server - apachectl and configtest * Apache HTTP Server - Startup and Troubleshooting * Linux systemctl - Managing Service Units * systemd journalctl - Service Log Inspection Expected result: The cause preventing apache2 from starting is corrected, and the service is successfully started with systemd and remains in the active (running) state. Video verification finding: The candidate visibly runs sudo chmod +x /usr/sbin/apache2 and then attempts to restart Apache. That is a valid repair if missing executable permission was the actual fault, but the visible commands do not independently prove the diagnosis or final service state. The diagnostic and verification steps above are necessary for a reliable solution.
Question 5
Which of the following shell redirections will write standard output and standard error output to a file named filename?