0

I recently hit issue with the creation of LXC container:

tsenov@hometower:~$ createContainer.sh tester 1 256MB lxd_sp0 2
Creating tester
Error: Failed container creation: Create container from image: Failed to clone the filesystem: cannot open 'lxd_sp0/images/9a93b6bd640cee54bd052ea9b631de0a8dc49a8c0c73197879aee66e780aaca7@readonly': dataset does not exist

Failed to launch CentOS 7

I have other containers with CentOS 7, created before the issue which run without any issues:

tsenov@hometower:~$ lxc ls
+------------+---------+-----------------------+------+------------+-----------+
|    NAME    |  STATE  |         IPV4          | IPV6 |    TYPE    | SNAPSHOTS |
+------------+---------+-----------------------+------+------------+-----------+
| laravel    | RUNNING | 10.113.186.60 (eth0)  |      | PERSISTENT |           |
+------------+---------+-----------------------+------+------------+-----------+
| owncloud   | RUNNING | 10.113.186.119 (eth0) |      | PERSISTENT |           |
+------------+---------+-----------------------+------+------------+-----------+
| prometheus | RUNNING | 10.113.186.174 (eth0) |      | PERSISTENT |           |
+------------+---------+-----------------------+------+------------+-----------+

Here is the createContainer.sh script:

tsenov@hometower:~$ cat bin/createContainer.sh 
#!/bin/bash
SCRIPT_NAME=$0
NAME=$1
CPU_COUNT=$2
RAM=$3
STORAGE_POOL=$4
DISK_SIZE=$5

function usage {
  echo "usage: $SCRIPT_NAME <name> <cpu cores> <memory> <storage_pool> <disk size> "
  echo "  <name> <STR>                   name for the container"
  echo "  <cpu cores> <INT>              count of CPU cores"
  echo "  <memory> <INT>[kMGPE]B         amount of RAM with suffix. The supported suffixes are kB, MB, GB, TB, PB and EB"
  echo "  <storage_pool>         one of the below ZFS storage pools"
  echo "  <disk size> <INT>              GBs of Disk Space"
  echo "================================================================"
  sudo zpool list
  exit 1
}

function createContainer {

  NAME=$1
  CPU_COUNT=$2
  RAM=$3
  STORAGE_POOL=$4
  DISK_SIZE=$5

  # Create the container
  lxc launch images:centos/7 "$NAME" -s "$STORAGE_POOL" ||  { echo 'Failed to launch CentOS 7'; exit 1; }

  # Set the Disk Size of the container
  #lxc config device add $NAME root disk pool=$STORAGE_POOL path=/ size="$DISK_SIZE"GB
  lxc config device set "$NAME" root size "$DISK_SIZE"GB ||  { echo 'Failed to set root size'; exit 1; }

  # Set the CPU cores count for the container
  lxc config set "$NAME" limits.cpu "$CPU_COUNT" ||  { echo 'Failed to set CPU limit'; exit 1; }

  # Set the RAM for the container
  lxc config set "$NAME" limits.memory "$RAM" ||  { echo 'Failed to set RAM limit'; exit 1; }

  exit 0
}

if [ $# -ne 5 ]
then
  usage
fi

# Main program
createContainer "$NAME" "$CPU_COUNT" "$RAM" "$STORAGE_POOL" "$DISK_SIZE"

There is no issue with other than the images:centos/7 image - tried with arch linux.

I tried: - deleting the centos/7 image and re-downloading it - lxd init to reinitialise the service

Seems like an issue with the zfs, which is quite odd considering that I re-download the image...

Any thoughts?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.