RexOps / RexOps/Rex

Request: Detect LXC virtualization type

Open
#1,184 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
737
Forks
214
PR merge metrics
No merged PRs in 30d

Description

From virt-what, lxc containers can be detected as follows. virt-what cites this documentation http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface

if [ -e "${root}/proc/1/environ" ] &&
    cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
    echo lxc
fi

/proc/1/environ contains
TERM=linux^@container=lxc^@container_ttys=/dev/pts/0 /dev/pts/1^@

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no file or test; start by locating Rex's existing virtualization-type detection entry point. Compare it with the provided virt-what and systemd ContainerInterface guidance for /proc/1/environ, and consider the work done when an LXC container is detected as lxc.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, perl
Domain
infrastructure, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.