bootc-docs/exec-in-host-mount-namespace/bootc-exec-in-host-mount-namespace-external-commands.md
robojerk 526f1c1afd Initial commit: Comprehensive Debian bootc documentation
- Complete documentation for all bootc commands and subcommands
- Debian-specific adaptations and workarounds
- Manual installation methods to bypass bootc reliability issues
- Technical guides with Rust source code analysis
- Flowcharts and external command references
- Hidden command documentation (bootc internals, state, etc.)
- Composefs integration analysis
- Base image creation guides (with and without bootc binary)
- Management scripts and automation
- Comprehensive troubleshooting and examples
2025-09-15 14:02:28 -07:00

910 lines
14 KiB
Markdown

# bootc exec-in-host-mount-namespace - External Commands Reference
## Overview
This document provides a comprehensive reference for all external commands used by `bootc exec-in-host-mount-namespace` operations. These commands are essential for understanding the dependencies and integration points of the exec-in-host-mount-namespace system.
## Core Commands
### bootc
**Purpose**: Main bootc command for exec-in-host-mount-namespace operations
**Usage**: `bootc exec-in-host-mount-namespace [ARGS]...`
**Dependencies**: None (core command)
#### Examples
```bash
# Execute command in host mount namespace
bootc exec-in-host-mount-namespace ls /
# Execute with arguments
bootc exec-in-host-mount-namespace mount /dev/sda1 /mnt
# Execute system command
bootc exec-in-host-mount-namespace systemctl status
```
## System Commands
### setns
**Purpose**: Change namespace membership
**Usage**: `setns [options...] <file> [program [arguments...]]`
**Dependencies**: util-linux
#### Examples
```bash
# Change to mount namespace
setns /proc/1/ns/mnt /bin/bash
# Change to PID namespace
setns /proc/1/ns/pid /bin/bash
# Change to network namespace
setns /proc/1/ns/net /bin/bash
```
### unshare
**Purpose**: Run program in new namespaces
**Usage**: `unshare [options...] [program [arguments...]]`
**Dependencies**: util-linux
#### Examples
```bash
# Create new mount namespace
unshare -m /bin/bash
# Create new PID namespace
unshare -p /bin/bash
# Create new network namespace
unshare -n /bin/bash
# Create multiple namespaces
unshare -m -p -n /bin/bash
```
### nsenter
**Purpose**: Enter namespaces
**Usage**: `nsenter [options...] [program [arguments...]]`
**Dependencies**: util-linux
#### Examples
```bash
# Enter mount namespace
nsenter -m -t 1 /bin/bash
# Enter PID namespace
nsenter -p -t 1 /bin/bash
# Enter network namespace
nsenter -n -t 1 /bin/bash
# Enter multiple namespaces
nsenter -m -p -n -t 1 /bin/bash
```
## Filesystem Commands
### mount
**Purpose**: Mount filesystems
**Usage**: `mount [options...] <device> <directory>`
**Dependencies**: util-linux
#### Examples
```bash
# Mount filesystem
mount /dev/sda1 /mnt
# Mount with options
mount -o ro,noexec /dev/sda1 /mnt
# Mount bind
mount --bind /source /target
# Mount tmpfs
mount -t tmpfs tmpfs /tmp
```
### umount
**Purpose**: Unmount filesystems
**Usage**: `umount [options...] <directory>`
**Dependencies**: util-linux
#### Examples
```bash
# Unmount filesystem
umount /mnt
# Force unmount
umount -f /mnt
# Lazy unmount
umount -l /mnt
# Unmount all
umount -a
```
### chroot
**Purpose**: Change root directory
**Usage**: `chroot [options...] <directory> <command>`
**Dependencies**: coreutils
#### Examples
```bash
# Change root
chroot /mnt /bin/bash
# Change root with specific command
chroot /mnt /bin/ls
# Change root with environment
chroot /mnt env -i /bin/bash
```
### chdir
**Purpose**: Change working directory
**Usage**: `chdir <directory>`
**Dependencies**: coreutils
#### Examples
```bash
# Change to root directory
chdir /
# Change to specific directory
chdir /var/lib/bootc
# Change to home directory
chdir ~
```
## Process Commands
### exec
**Purpose**: Replace current process
**Usage**: `exec [command [arguments...]]`
**Dependencies**: coreutils
#### Examples
```bash
# Replace with new command
exec /bin/bash
# Replace with command and arguments
exec /bin/ls -la /
# Replace with shell
exec /bin/sh
```
### ps
**Purpose**: Process status
**Usage**: `ps [options...]`
**Dependencies**: procps
#### Examples
```bash
# Show all processes
ps aux
# Show process tree
ps -ef
# Show specific process
ps -p 1234
# Show processes by user
ps -u username
```
### kill
**Purpose**: Send signals to processes
**Usage**: `kill [options...] <pid>`
**Dependencies**: util-linux
#### Examples
```bash
# Kill process
kill 1234
# Force kill process
kill -9 1234
# Send signal
kill -TERM 1234
# Kill by name
pkill process_name
```
## System Information Commands
### uname
**Purpose**: System information
**Usage**: `uname [options...]`
**Dependencies**: coreutils
#### Examples
```bash
# Show system name
uname
# Show all information
uname -a
# Show kernel name
uname -s
# Show kernel version
uname -r
# Show machine type
uname -m
```
### hostname
**Purpose**: Hostname operations
**Usage**: `hostname [options...]`
**Dependencies**: hostname
#### Examples
```bash
# Show hostname
hostname
# Show FQDN
hostname -f
# Show short hostname
hostname -s
# Show domain name
hostname -d
```
### lscpu
**Purpose**: CPU information
**Usage**: `lscpu [options...]`
**Dependencies**: util-linux
#### Examples
```bash
# Show CPU information
lscpu
# Show in JSON format
lscpu -J
# Show in extended format
lscpu -e
# Show in parseable format
lscpu -p
```
### free
**Purpose**: Memory information
**Usage**: `free [options...]`
**Dependencies**: procps
#### Examples
```bash
# Show memory usage
free
# Show in human readable format
free -h
# Show in bytes
free -b
# Show with total
free -t
# Show with wide format
free -w
```
## File Commands
### ls
**Purpose**: List directory contents
**Usage**: `ls [options...] [file...]`
**Dependencies**: coreutils
#### Examples
```bash
# List files
ls
# List with details
ls -l
# List all files
ls -a
# List with human readable sizes
ls -lh
# List with recursive
ls -R
# List with sort by time
ls -lt
```
### find
**Purpose**: Find files
**Usage**: `find [path...] [expression]`
**Dependencies**: findutils
#### Examples
```bash
# Find files by name
find /path -name "*.txt"
# Find files by type
find /path -type f
# Find files by size
find /path -size +100M
# Find files by modification time
find /path -mtime -7
# Find files by permissions
find /path -perm 644
```
### stat
**Purpose**: File status
**Usage**: `stat [options...] [file...]`
**Dependencies**: coreutils
#### Examples
```bash
# Show file status
stat file.txt
# Show in custom format
stat -c "%n %s %Y" file.txt
# Show filesystem status
stat -f /path
# Show with format
stat --format="%n: %s bytes" file.txt
```
## Storage Commands
### df
**Purpose**: Disk space usage
**Usage**: `df [options...] [file...]`
**Dependencies**: coreutils
#### Examples
```bash
# Show disk usage
df -h
# Show specific filesystem
df -h /var/lib/bootc
# Show inode usage
df -i
# Show all filesystems
df -a
```
### du
**Purpose**: Directory space usage
**Usage**: `du [options...] [file...]`
**Dependencies**: coreutils
#### Examples
```bash
# Show directory usage
du -h /var/lib/bootc
# Show total usage
du -sh /var/lib/bootc
# Show usage by subdirectory
du -h --max-depth=1 /var/lib/bootc
# Show usage of all files
du -ah /var/lib/bootc
```
### lsblk
**Purpose**: List block devices
**Usage**: `lsblk [options...]`
**Dependencies**: util-linux
#### Examples
```bash
# List block devices
lsblk
# Show device tree
lsblk -f
# Show device sizes
lsblk -b
# Show device types
lsblk -d
```
## Network Commands
### curl
**Purpose**: HTTP client for registry operations
**Usage**: `curl [options...] <url>`
**Dependencies**: curl
#### Examples
```bash
# Download file
curl -O https://example.com/file.tar
# Get HTTP headers
curl -I https://example.com
# POST data
curl -X POST -d "data" https://example.com
# With authentication
curl -u username:password https://example.com
# With custom headers
curl -H "Authorization: Bearer token" https://example.com
```
### wget
**Purpose**: HTTP client for downloading files
**Usage**: `wget [options...] <url>`
**Dependencies**: wget
#### Examples
```bash
# Download file
wget https://example.com/file.tar
# Download with progress
wget --progress=bar https://example.com/file.tar
# Download recursively
wget -r https://example.com/
# Download with authentication
wget --user=username --password=password https://example.com
```
## Systemd Commands
### systemctl
**Purpose**: Systemd service management
**Usage**: `systemctl <subcommand> [options...]`
**Dependencies**: systemd
#### Examples
```bash
# Check service status
systemctl status bootc-*
# Start service
systemctl start bootc-*
# Enable service
systemctl enable bootc-*
# Reload systemd configuration
systemctl daemon-reload
```
### journalctl
**Purpose**: Systemd journal viewing
**Usage**: `journalctl [options...]`
**Dependencies**: systemd
#### Examples
```bash
# Show all logs
journalctl
# Show logs for service
journalctl -u bootc-*
# Show recent logs
journalctl -n 100
# Follow logs
journalctl -f
# Show logs since time
journalctl --since "1 hour ago"
# Show logs with priority
journalctl -p err
```
## Container Commands
### podman
**Purpose**: Container runtime
**Usage**: `podman <subcommand> [options...]`
**Dependencies**: podman
#### Examples
```bash
# List containers
podman ps
# List images
podman images
# Pull image
podman pull quay.io/myorg/image:latest
# Run container
podman run -it image:latest
# Build image
podman build -t myimage:latest .
# Inspect image
podman inspect image:latest
```
### docker
**Purpose**: Alternative container runtime
**Usage**: `docker <subcommand> [options...]`
**Dependencies**: docker
#### Examples
```bash
# List containers
docker ps
# List images
docker images
# Pull image
docker pull quay.io/myorg/image:latest
# Run container
docker run -it image:latest
# Build image
docker build -t myimage:latest .
```
## Bootloader Commands
### grub-mkconfig
**Purpose**: Generate GRUB configuration
**Usage**: `grub-mkconfig [options...]`
**Dependencies**: grub2
#### Examples
```bash
# Generate GRUB config
grub-mkconfig -o /boot/grub/grub.cfg
# Generate with specific output
grub-mkconfig -o /boot/grub2/grub.cfg
# Generate with verbose output
grub-mkconfig -v -o /boot/grub/grub.cfg
```
### grub-install
**Purpose**: Install GRUB bootloader
**Usage**: `grub-install [options...] <device>`
**Dependencies**: grub2
#### Examples
```bash
# Install GRUB
grub-install /dev/sda
# Install with specific directory
grub-install --boot-directory=/boot /dev/sda
# Install with verbose output
grub-install -v /dev/sda
```
### efibootmgr
**Purpose**: EFI boot manager
**Usage**: `efibootmgr [options...]`
**Dependencies**: efibootmgr
#### Examples
```bash
# List boot entries
efibootmgr
# Create boot entry
efibootmgr -c -d /dev/sda -p 1 -L "Bootc" -l /EFI/bootc/grubx64.efi
# Delete boot entry
efibootmgr -b 0000 -B
# Set boot order
efibootmgr -o 0000,0001,0002
```
## Archive Commands
### tar
**Purpose**: Archive operations
**Usage**: `tar [options...] <archive> [file...]`
**Dependencies**: tar
#### Examples
```bash
# Create archive
tar -cf archive.tar file1 file2
# Extract archive
tar -xf archive.tar
# List archive contents
tar -tf archive.tar
# Create compressed archive
tar -czf archive.tar.gz file1 file2
# Extract compressed archive
tar -xzf archive.tar.gz
```
### gzip
**Purpose**: Compression
**Usage**: `gzip [options...] [file...]`
**Dependencies**: gzip
#### Examples
```bash
# Compress file
gzip file.txt
# Decompress file
gzip -d file.txt.gz
# Compress with custom level
gzip -9 file.txt
# Keep original file
gzip -k file.txt
```
## Monitoring Commands
### top
**Purpose**: Process monitoring
**Usage**: `top [options...]`
**Dependencies**: procps
#### Examples
```bash
# Show processes
top
# Show specific user
top -u username
# Show specific process
top -p 1234
# Show with custom delay
top -d 5
# Show with custom sort
top -o %CPU
```
### htop
**Purpose**: Interactive process monitoring
**Usage**: `htop [options...]`
**Dependencies**: htop
#### Examples
```bash
# Show processes
htop
# Show specific user
htop -u username
# Show specific process
htop -p 1234
# Show with custom delay
htop -d 5
```
### iotop
**Purpose**: I/O monitoring
**Usage**: `iotop [options...]`
**Dependencies**: iotop
#### Examples
```bash
# Show I/O usage
iotop
# Show only processes doing I/O
iotop -o
# Show with custom delay
iotop -d 5
# Show with custom refresh
iotop -n 10
```
## Security Commands
### openssl
**Purpose**: SSL/TLS operations
**Usage**: `openssl <command> [options...]`
**Dependencies**: openssl
#### Examples
```bash
# Generate private key
openssl genrsa -out key.pem 2048
# Generate certificate
openssl req -new -x509 -key key.pem -out cert.pem
# Verify certificate
openssl verify cert.pem
# Check certificate details
openssl x509 -in cert.pem -text -noout
# Generate hash
openssl dgst -sha256 file.txt
```
### gpg
**Purpose**: GPG operations
**Usage**: `gpg [options...]`
**Dependencies**: gnupg
#### Examples
```bash
# Generate key pair
gpg --gen-key
# List keys
gpg --list-keys
# Sign file
gpg --sign file.txt
# Verify signature
gpg --verify file.txt.asc
# Encrypt file
gpg --encrypt file.txt
```
## Development Commands
### make
**Purpose**: Build automation
**Usage**: `make [target...]`
**Dependencies**: make
#### Examples
```bash
# Build project
make
# Clean build
make clean
# Install
make install
# Run tests
make test
# Update generated files
make update-generated
```
### cargo
**Purpose**: Rust package manager
**Usage**: `cargo <subcommand> [options...]`
**Dependencies**: rust
#### Examples
```bash
# Build project
cargo build
# Run project
cargo run
# Run tests
cargo test
# Check code
cargo check
# Update dependencies
cargo update
```
### git
**Purpose**: Version control
**Usage**: `git <subcommand> [options...]`
**Dependencies**: git
#### Examples
```bash
# Clone repository
git clone https://github.com/containers/bootc.git
# Check status
git status
# Add files
git add .
# Commit changes
git commit -m "message"
# Push changes
git push
```
This comprehensive reference covers all external commands used by the bootc exec-in-host-mount-namespace system, providing examples and usage patterns for each command.