# Free LPIC-2 practice questions

> 10 free LPIC-2 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/lpic-2-linux-engineer/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/lpic-2-linux-engineer/

### Question 1 of 10

A server with eight CPU cores shows 'load average: 7.92, 8.05, 7.98' in the output of uptime. Which interpretation is MOST accurate?

- A. The CPUs are about 8% utilized, because load average is the percentage of CPU time used over each of the three intervals
- B. The host is badly overloaded, since on Linux any load average above 1.00 means that processes are waiting in the run queue for a free CPU core
- C. On average about eight tasks were runnable or in uninterruptible I/O, which roughly matches the core count, so the host is busy but not badly oversubscribed
- D. Load is rising sharply, because the 15-minute value is lower than the 5-minute value and the three figures are read from right to left, newest last

**Answer:** C

**Explanation:** On Linux the load average counts tasks that are runnable or in uninterruptible sleep, averaged over 1, 5 and 15 minutes, and has to be compared with the number of CPUs. A steady value of about 8 on eight cores means they are fully used without a long queue. The 'above 1.00 is overloaded' rule only applies to a single CPU. Load average is not a CPU percentage, and the three values are stable here, not a sharp trend.

### Question 2 of 10

A security baseline requires that once the system has booted, no further kernel modules can be loaded until the next reboot. Which setting does this?

- A. Set kernel.tainted = 1 in a file under /etc/sysctl.d/, which tells the kernel to reject new module insertions
- B. Delete /lib/modules/$(uname -r)/modules.dep, so that the kernel refuses every later insmod request
- C. Add 'blacklist *' to /etc/modprobe.d/lockdown.conf, which blocks every module that is not yet loaded
- D. Set kernel.modules_disabled = 1 late in boot, after all required modules are loaded

**Answer:** D

**Explanation:** kernel.modules_disabled is a one-way switch: once it is set to 1, the kernel refuses all module loading and unloading, and the value cannot go back to 0 until reboot, so it must be set after needed modules are loaded. kernel.tainted reports taint flags and does not control loading. blacklist takes module names, not wildcards, and only affects alias-based autoloading. Without modules.dep modprobe fails, but insmod with a file path still works.

### Question 3 of 10

A server drops to a 'grub rescue>' prompt after a disk reorganization. /boot/grub is on the second GPT partition of the first disk. Which commands boot it to the normal GRUB menu?

- A. root (hd0,1), kernel /boot/grub/normal.mod, boot, then rerun grub-install from the prompt
- B. set prefix=(hd0,gpt2)/boot/grub, set root=(hd0,gpt2), insmod normal, normal
- C. set root=/dev/sda2, configfile /boot/grub/grub.cfg, insmod normal, boot
- D. set prefix=(hd0,1)/boot/grub, set root=(hd0,1), insmod linux, boot

**Answer:** B

**Explanation:** At the rescue prompt GRUB has to be told where its modules are (prefix) and which partition to use (root). Loading the normal module and running 'normal' then reads grub.cfg and shows the menu. GRUB 2 numbers partitions from 1, so (hd0,1) is the first partition, and linux/boot without a loaded kernel does nothing. root (hd0,1) and kernel are GRUB Legacy syntax. GRUB device names are not Linux paths such as /dev/sda2, and the minimal rescue shell lacks configfile until normal is loaded.

### Question 4 of 10

A server without a free partition needs 4 GiB of extra swap on its ext4 root filesystem. Which sequence creates and activates a swap file?

- A. dd if=/dev/zero of=/swapfile bs=1M count=4096; chmod 600 /swapfile; mkswap /swapfile; swapon /swapfile
- B. dd if=/dev/zero of=/swapfile bs=1M count=4096; mkfs.ext4 /swapfile; swapon -a /swapfile
- C. mkswap -s 4G /swapfile; chmod 755 /swapfile; mount -t swap /swapfile /swap; then add the mount to /etc/fstab
- D. touch /swapfile; truncate -s 4G /swapfile; swapon /swapfile; mkswap /swapfile; chmod 644 /swapfile

**Answer:** A

**Explanation:** The file is fully allocated with dd (fallocate also works on ext4), restricted to root, given a swap signature with mkswap and enabled with swapon. An fstab entry makes it permanent. A sparse file made with truncate has holes and is rejected, and swapon cannot come before mkswap, while mode 644 leaks memory contents. mkswap has no -s size option, and swap is never mounted. An ext4 filesystem inside the file is not a swap area.

### Question 5 of 10

Multipath SAN LUNs show up twice, as /dev/sdc and /dev/sdg, and LVM warns about duplicate physical volumes. Which lvm.conf change makes LVM scan only the multipath devices and the local system disk?

- A. In the devices section, set a filter such as [ "r|^/dev/mapper/.*|", "a|.*|" ] so raw paths are preferred
- B. In the global section, set use_lvmetad = 0 so that the duplicate PVs found on both paths are merged into a single device
- C. In the activation section, set volume_list = [ "/dev/sdc", "/dev/sdg" ] so both paths are activated
- D. In the devices section, set a filter such as [ "a|^/dev/mapper/mpath.*|", "a|^/dev/sda[0-9]*$|", "r|.*|" ]

**Answer:** D

**Explanation:** An LVM filter accepts (a) or rejects (r) device paths by regular expression, and the first match wins. Accepting the multipath maps and the local disk and rejecting everything else stops LVM from seeing the individual SCSI paths. Newer releases also support a devices file. lvmetad was removed from recent LVM versions and never merged duplicates. Rejecting /dev/mapper while accepting all raw paths does the opposite of the requirement. volume_list names VGs or LVs to activate, not devices.

### Question 6 of 10

A host shows 'From 192.168.4.17 icmp_seq=1 Destination Host Unreachable' when it pings 192.168.4.30, a neighbor on the same subnet. 192.168.4.17 is the host's own address. What does this most likely mean?

- A. The target's firewall dropped the echo request and sent back a host-unreachable reply
- B. ARP for 192.168.4.30 got no reply, so the target is down, disconnected or on another VLAN
- C. The local DNS server could not resolve the name, so ping failed before it sent any packet at all
- D. A router on the path rejected the packet, because no route to 192.168.4.0/24 exists

**Answer:** B

**Explanation:** When the target is on the local subnet and does not answer ARP, the sending host's own kernel reports Destination Host Unreachable from its own address. A remote router would report from its own address, and the subnet is directly connected. A firewall that drops packets causes silent timeouts, and a reject comes from the target's address with a different code. The ping was to an IP address, so no DNS lookup happened.

### Question 7 of 10

An administrator is enabling DNSSEC for example.org by hand with BIND tools. Which sequence is correct?

- A. Generate one TSIG key with tsig-keygen, sign the zone with it using dnssec-signzone, and publish the TSIG secret as a TXT record in the parent zone
- B. Sign the zone with dnssec-signzone, then create the keys with dnssec-keygen, since the keys are derived from the RRSIG records that signing produces
- C. Generate a KSK with dnssec-keygen and copy its private key to the parent registrar, which uses it to sign the zone's records for resolvers
- D. Generate a ZSK and a KSK with dnssec-keygen, add their DNSKEY records to the zone, sign it with dnssec-signzone, and give the DS record for the KSK to the parent zone

**Answer:** D

**Explanation:** DNSSEC uses key pairs, usually a zone-signing key and a key-signing key. The DNSKEY records are published, dnssec-signzone creates the RRSIG and NSEC/NSEC3 records, and the DS digest of the KSK in the parent completes the chain of trust. Modern BIND can automate this with dnssec-policy. TSIG secrets protect transfers and are never published. Keys must exist before signing. Private keys never leave the zone operator, and only the DS record goes to the parent.

### Question 8 of 10

A Squid proxy must require users to log in with names and passwords from an htpasswd-style file before it allows any web access from the LAN. Which squid.conf fragment does this?

- A. auth_param digest program /usr/lib64/squid/basic_ncsa_auth, http_access allow all, acl authed proxy_auth REQUIRED
- B. acl authed src /etc/squid/passwd, then http_access allow authed, http_access deny all, and auth_param basic realm Squid proxy server
- C. acl authed proxy_auth REQUIRED, http_access deny authed, http_access allow all, auth_param basic program basic_ncsa_auth /etc/squid/passwd
- D. auth_param basic program <path>/basic_ncsa_auth /etc/squid/passwd, acl authed proxy_auth REQUIRED, http_access allow authed, http_access deny all

**Answer:** D

**Explanation:** auth_param defines the Basic authentication helper (basic_ncsa_auth reads htpasswd files), the proxy_auth REQUIRED ACL matches any authenticated user, and the http_access rules allow those users and deny everyone else. The helper path depends on the distribution. A src ACL needs addresses, not a password file. Putting 'allow all' before the ACL lets everyone through, and a Basic helper does not suit the digest scheme. Denying authenticated users and allowing all reverses the intent.

### Question 9 of 10

In an OpenLDAP 2.4+ server using the dynamic slapd-config (cn=config) backend, how should configuration changes normally be made?

- A. With slapadd while slapd is running, since slapadd writes straight into the live cn=config database
- B. By editing the LDIF files under /etc/openldap/slapd.d/ directly with a text editor while slapd runs
- C. With ldapmodify, using LDIF against the cn=config tree, usually as root via '-Y EXTERNAL -H ldapi:///'
- D. By editing slapd.conf and running slaptest, which converts the file into cn=config automatically

**Answer:** C

**Explanation:** With slapd-config the configuration is stored as LDAP entries (olc* attributes), so it is changed online through LDAP operations such as ldapmodify, often over the ldapi socket with SASL EXTERNAL as root. The files in slapd.d/ have checksums and must not be edited by hand. slapd.conf is the legacy static format, and slaptest -F can convert it, but that is a migration step, not the normal method. slapadd must not run against a database while slapd is using it.

### Question 10 of 10

An administrator wants to create a modern Ed25519 key pair for SSH logins and install the public key in the authorized_keys file of the account deploy on web01. Which commands do this?

- A. ssh-agent -t ed25519, then ssh-copy-id -i /etc/ssh/ssh_host_ed25519_key deploy@web01
- B. ssh-keyscan -t ed25519 web01, then ssh-add deploy@web01
- C. ssh-keygen -t dsa -b 512, then scp ~/.ssh/id_dsa deploy@web01:
- D. ssh-keygen -t ed25519, then ssh-copy-id deploy@web01

**Answer:** D

**Explanation:** ssh-keygen -t ed25519 creates ~/.ssh/id_ed25519 and its .pub file, and ssh-copy-id appends the public key to the remote ~/.ssh/authorized_keys with suitable permissions. DSA keys are obsolete and disabled in current OpenSSH, and copying a private key to the server is wrong. ssh-keyscan collects remote host keys, and ssh-add loads keys into an agent. ssh-agent -t sets a key lifetime, and the host's private key must never be used as a user key.

Ready for a timed run? Take the free 15-question LPIC-2 mini exam: https://devopscodelab.com/app/exams/lpic-2-linux-engineer/mini/

DevOpsCode Lab is not affiliated with LPI. LPIC-2 and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
