AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 18.217.26.8


Current Path : /snap/lxd/31333/commands/
Upload File :
Current File : //snap/lxd/31333/commands/buginfo

#!/bin/sh
set -u

# Re-exec outside of apparmor confinement
if [ -d /sys/kernel/security/apparmor ] && [ "$(cat /proc/self/attr/current)" != "unconfined" ]; then
    exec aa-exec -p unconfined -- "$0" "$@"
fi

# Check that we're root
if [ "$(id -u)" != "0" ]; then
    echo "error: This tool must be run as root."
    exit 1
fi

# Environment
export LXD_DIR="${LXD_DIR:-"${SNAP_COMMON}/lxd/"}"

echo "# Base information"
if [ -e "/var/lib/snapd/hostfs/etc/os-release" ]; then
    # shellcheck disable=SC1091
    . /var/lib/snapd/hostfs/etc/os-release

    echo " - Distribution: ${NAME}"
    echo " - Distribution version: ${VERSION}"
else
    echo " - Distribution: unknown (no os-release)"
fi
echo " - Kernel version: $(uname -a)"
echo " - LXC version: $(lxc --version)"
echo " - LXD version: $(lxd --version)"
echo " - Snap revision: ${SNAP_REVISION}"
echo ""

echo "# Detailed snap information"
echo '```'
nsenter -t 1 -m snap info lxd
echo '```'
echo ""

echo "# Detailed LXD information"
if lxc info >/dev/null 2>&1; then
    echo "## Daemon configuration"
    echo '```'
    lxc info
    echo '```'
    echo ""

    echo "## Instances"
    echo '```'
    lxc list
    echo '```'
    echo ""

    echo "## Images"
    echo '```'
    lxc image list
    echo '```'
    echo ""

    echo "## Storage pools"
    echo '```'
    lxc storage list
    echo '```'
    echo ""

    echo "## Networks"
    echo '```'
    lxc network list
    echo '```'
    echo ""

    echo "## Projects"
    echo '```'
    lxc project list
    echo '```'
    echo ""

    echo "## Profiles"
    echo '```'
    lxc profile list
    echo '```'
    echo ""

    echo "## Default profile"
    echo '```'
    lxc profile show default
    echo '```'
    echo ""

    if lxc cluster list >/dev/null 2>&1; then
        echo "## Cluster"
        echo '```'
        lxc cluster list
        echo '```'
        echo ""
    fi
else
    echo "LXD daemon unreachable"
    echo ""
fi

echo "# Kernel log (last 50 lines)"
echo '```'
dmesg | tail -n 50
echo '```'
echo ""

echo "# Daemon log (last 50 lines)"
echo '```'
tail -n 50 "${SNAP_COMMON}/lxd/logs/lxd.log"
echo '```'
echo ""

echo "# Systemd log (last 50 lines)"
echo '```'
nsenter -t 1 -m journalctl -u snap.lxd.daemon -n50 | cat
echo '```'