Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LXC BASH

Bash Completions, Aliases and Functions for working with LXC (not LXD, just plain LXC)

Installation

Source the completion file in your .bashrc:

source /path/to/lxc-bash-completion.bash

Commands

Command Description
lxc-ls List all containers with full info
lxc-start <name> Start a stopped container
lxc-stop <name> Stop a running container
lxc-shutdown <name> Gracefully shutdown via poweroff
lxc-attach <name> [user] Attach to container (auto-starts if stopped)
lxc-info <name> Show container info
lxc-ip <name> Get container IP address
lxc-freeze <name> Freeze a running container
lxc-unfreeze <name> Unfreeze a frozen container
lxc-start-debug <name> [logfile] Debug container startup failures

All commands support tab completion for container names.

Debugging Container Startup Failures

When a container fails to start, lxc-start automatically offers to run debug mode (interactive terminals only). You can also run it directly:

lxc-start-debug mycontainer

This will:

  1. Run pre-flight checks (bridge, IPv6 config, config/rootfs)
  2. Offer to restart services (e.g., lxc-net) with failure diagnosis
  3. Attempt foreground start to capture detailed errors
  4. Analyze output and suggest fixes
  5. Offer to retry after fixes

Common issues detected:

  • Missing bridge (lxcbr0) - offers to restart lxc-net
  • IPv6 disabled - detects when system has IPv6 disabled but lxc-net expects it
  • Permission denied - checks for AppArmor/SELinux issues
  • Network/cgroup problems - with specific fix suggestions

Optionally save debug output to a file:

lxc-start-debug mycontainer /tmp/debug.log

About

Bash Completions and Functions for working with LXC (not LXD, just plain LXC)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages