Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Failed to append name - rootfs' error while destroying container with btrfs storage #2826

Closed
aston-r opened this issue Feb 6, 2019 · 5 comments

Comments

@aston-r
Copy link

aston-r commented Feb 6, 2019

Hi,

General Information:

cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 

lxc-start --version
3.1.0

cat /proc/1/mounts | grep btrfs
/dev/nvme1n1p3 /var/lib/lxc btrfs rw,noatime,nodatasum,nodatacow,ssd,space_cache,subvolid=5,subvol=/ 0 0

STR:

  • mkfs.btrfs /dev/nvme1n1p3 -f
  • mount /dev/nvme1n1p3 /var/lib/lxc -o noatime,nodatacow
  • lxc-create --name="btrfs" --bdev='btrfs' --template="download" -- --dist centos --release 7 --arch amd64
btrfs subvolume list  /var/lib/lxc/ | grep btrfs
ID 570 gen 1200 top level 5 path btrfs/rootfs
cat /var/lib/lxc/btrfs/config 
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template: --dist centos --release 7 --arch amd64
# For additional config options, please look at lxc.container.conf(5)

# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)


# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = x86_64

# Container specific configuration
lxc.rootfs.path = btrfs:/var/lib/lxc/btrfs/rootfs
lxc.uts.name = btrfs

# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = br-ex
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:fe:b7:f4
  • lxc-destroy -n btrfs
lxc-destroy -n btrfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs
lxc-destroy: btrfs: tools/lxc_destroy.c: main: 271 Destroyed container btrfs
@mullnerz
Copy link

The same happens also on Ubuntu 18.04...

uname -a
Linux test2 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/issue.net 
Ubuntu 18.04.2 LTS

lxc-start --version
3.0.3

cat /proc/1/mounts | grep btrfs
/dev/md4 /var/lib/lxc btrfs rw,relatime,ssd,space_cache,subvolid=5,subvol=/ 0 0

lxc-destroy -n testbtrfs

lxc-destroy: master-vdmg-trading: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs���
lxc-destroy: master-vdmg-trading: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs���
lxc-destroy: master-vdmg-trading: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs���
lxc-destroy: master-vdmg-trading: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs���
lxc-destroy: master-vdmg-trading: storage/btrfs.c: get_btrfs_subvol_path: 103 Failed to append name - rootfs���
lxc-destroy: master-vdmg-trading: tools/lxc_destroy.c: main: 271 Destroyed container testbtrfs

@brauner
Copy link
Member

brauner commented Mar 11, 2019

Tracked it down and sent a branch that fixes it:
#2900

@brauner brauner closed this as completed Mar 11, 2019
@visibilityspots
Copy link

@brauner is there a manual fix one can perform in the meantime while waiting on a release with the fix included?

@ceremcem
Copy link

ceremcem commented Mar 8, 2021

Why is this issue closed, while it still exists in version 3.0.3 (on Debian Buster)?

@ceremcem
Copy link

ceremcem commented Mar 8, 2021

Meanwhile anyone who encounters this issue can insert the following function into ~/.bash_aliases (or ~/.bashrc):

is_btrfs_subvolume() {
    sudo btrfs subvolume show "$1" >/dev/null 2>&1
}

lxc-destroy(){
    # See: https://github.com/lxc/lxc/issues/2826
    >&2 echo "I: Using lxc-destroy from bash_aliases."
    >&2 echo
    local name=$1
    [[ -n $name ]] || { echo "Container name is required"; return 1; }
    local path=/var/lib/lxc/$name
    [[ -d $path ]] || { echo "$path does not exist."; return 1; }
    echo "Removing $path"
    if [[ -d $path/rootfs ]]; then
        if is_btrfs_subvolume $path/rootfs; then
            sudo btrfs sub del $path/rootfs
        else
            sudo rm -r $path/rootfs
        fi
    fi
    sudo rm -r $path
    echo "Deleted $path"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants