305-300 practice question 1 of 15

Which of the following devices exist by default in an LXC container? (Choose three.)

Full set: 121 questions
Answer options
A: /dev/log Correct answer
B: /dev/console Correct answer
C: /dev/urandom Correct answer
D: /dev/kmem
E: /dev/root
Correct Answer:
A. /dev/log; B. /dev/console; C. /dev/urandom
Explanation

By default, an LXC container is provisioned with a minimal set of device nodes required for basic functionality and security. This includes /dev/log for application logging via a Unix socket, /dev/console for system console interaction, and /dev/urandom for accessing the kernel's entropy pool, which is crucial for cryptographic operations. These devices are considered safe to expose and are essential for a standard Linux environment to operate correctly. Devices that could compromise the host system or break container isolation, such as those providing direct hardware or kernel memory access, are not included in the default configuration. Why Incorrect Options are Wrong
D. /dev/kmem: This device provides direct access to kernel memory. Exposing it to a container would be a critical security vulnerability, completely violating the principle of container isolation.
E. /dev/root: This is not a standard device node. On some traditional systems, it's a symbolic link to the root block device, an abstraction not directly applicable within a container's filesystem. References
1. Graber, S. (2014). LXC 1.0: Security features. In this official blog post by a former LXC project leader, the default security profile for containers is detailed. It explicitly lists the minimal set of character devices allowed by default, which includes /dev/console (c 5:1) and /dev/urandom (c 1:9). It also confirms that access to dangerous devices like /dev/kmem is denied. (Available at: Stéphane Graber's blog, Section: "Cgroup devices controller")
2. Linux man-pages project. (2021). lxc.container.conf(5). The official man page for LXC configuration describes the lxc.cgroup.devices.allow option. The default configuration files (e.g., /usr/share/lxc/config/common.conf) that ship with LXC use this option to create a whitelist of safe devices, which includes /dev/console and /dev/urandom.
3. The Linux Foundation. (n.d.). Filesystem Hierarchy Standard. While not specific to LXC, the FHS defines standard file locations. It specifies /dev as the location for device files. The presence of /dev/log as a socket for local syslog message delivery is a de facto standard in Linux distributions, and LXC templates create it to ensure applications can log messages correctly. (Reference: FHS Version 3.0, Section 3.7 /dev)

Scroll to Top