Lxc-create - unable to download rootfs.tar.xz but URL with wget works

Hello,

when I am trying to create a new container using lxc-create, it timeouts during the downloading phase, but when after trying to download URL with wget, it works. It is weird!

root@router:~# lxc-create -l debug -t download -n Ubuntu --logfile=test.log --logpriority=DEBUG
Setting up the GPG keyring
Downloading the image index

---
DIST    RELEASE ARCH    VARIANT BUILD
---
Turris_OS       stable  armv7l  default 2020-12-20
Turris_OS       stable  ppc     default 2020-12-20
Alpine  3.11    armv7l  default 2020-12-20
Alpine  3.11    aarch64 default 2020-12-20
Alpine  3.12    armv7l  default 2020-12-20
Alpine  3.12    aarch64 default 2020-12-20
Alpine  Edge    armv7l  default 2020-12-20
Alpine  Edge    aarch64 default 2020-12-20
ArchLinux       latest  armv7l  default 2020-12-20
ArchLinux       latest  aarch64 default 2020-12-20
Debian  Stretch armv7l  default 2020-12-20
Debian  Stretch aarch64 default 2020-12-20
Debian  Buster  armv7l  default 2020-12-20
Debian  Buster  aarch64 default 2020-12-20
Gentoo  stable  armv7l  default 2020-12-20
openSUSE        15.2    armv7l  default 2020-12-20
openSUSE        15.2    aarch64 default 2020-12-20
openSUSE        Tumbleweed      armv7l  default 2020-12-20
openSUSE        Tumbleweed      aarch64 default 2020-12-20
Sabayon 16      armv7l  default 2020-12-20
Ubuntu  Xenial  armv7l  default 2020-12-20
Ubuntu  Xenial  aarch64 default 2020-12-20
Ubuntu  Bionic  armv7l  default 2020-12-20
Ubuntu  Bionic  aarch64 default 2020-12-20
Ubuntu  Focal   armv7l  default 2020-12-20
Ubuntu  Focal   aarch64 default 2020-12-20
---

Distribution: 
Ubuntu
Release: 
Focal
Architecture: 
armv7l

Downloading the image index
Downloading the rootfs
ERROR: Failed to download http://repo.turris.cz/lxc//images/Ubuntu/Focal/armv7l/2020-12-20/rootfs.tar.xz
lxc-create: Ubuntu: lxccontainer.c: create_run_template: 1617 Failed to create container from template
lxc-create: Ubuntu: tools/lxc_create.c: main: 327 Failed to create container Ubuntu

Error log:

root@tx-router:~# cat test.log
lxc-create Ubuntu 20201221204030.776 DEBUG    storage - storage/storage.c:get_storage_by_name:231 - Detected rootfs type "dir"
lxc-create Ubuntu 20201221204102.723 ERROR    lxccontainer - lxccontainer.c:create_run_template:1617 - Failed to create container from template
lxc-create Ubuntu 20201221204102.724 DEBUG    storage - storage/storage.c:get_storage_by_name:231 - Detected rootfs type "dir"
lxc-create Ubuntu 20201221204102.724 INFO     lxccontainer - lxccontainer.c:container_destroy:2977 - Destroyed rootfs for Ubuntu
lxc-create Ubuntu 20201221204102.724 INFO     lxccontainer - lxccontainer.c:container_destroy:3042 - Destroyed directory "/srv/lxc/Ubuntu" for "Ubuntu"
lxc-create Ubuntu 20201221204102.724 ERROR    lxc_create - tools/lxc_create.c:main:327 - Failed to create container Ubuntu
lxc-create Ubuntu 20201221204147.833 DEBUG    storage - storage/storage.c:get_storage_by_name:231 - Detected rootfs type "dir"
lxc-create Ubuntu 20201221204230.173 ERROR    lxccontainer - lxccontainer.c:create_run_template:1617 - Failed to create container from template
lxc-create Ubuntu 20201221204230.173 DEBUG    storage - storage/storage.c:get_storage_by_name:231 - Detected rootfs type "dir"
lxc-create Ubuntu 20201221204230.174 INFO     lxccontainer - lxccontainer.c:container_destroy:2977 - Destroyed rootfs for Ubuntu
lxc-create Ubuntu 20201221204230.174 INFO     lxccontainer - lxccontainer.c:container_destroy:3042 - Destroyed directory "/srv/lxc/Ubuntu" for "Ubuntu"
lxc-create Ubuntu 20201221204230.174 ERROR    lxc_create - tools/lxc_create.c:main:327 - Failed to create container Ubuntu

.

root@tx-router:~# wget  http://repo.turris.cz/lxc//images/Ubuntu/Focal/armv7l/2020-12-20/rootfs.tar.xz
URL transformed to HTTPS due to an HSTS policy
--2020-12-21 21:43:41--  https://repo.turris.cz/lxc//images/Ubuntu/Focal/armv7l/2020-12-20/rootfs.tar.xz
Resolving repo.turris.cz... 217.31.192.69, 2001:1488:ac15:ff80::69
Connecting to repo.turris.cz|217.31.192.69|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87720708 (84M) [application/x-tar]
Saving to: 'rootfs.tar.xz'

rootfs.tar.xz                                              100%[=======================================================================================================================================>]  83.66M  11.4MB/s    in 6.4s    

2020-12-21 21:43:47 (13.0 MB/s) - 'rootfs.tar.xz' saved [87720708/87720708]

Did you follow the guide:

specifically the section where it says “Enable SSL - Check this to enable SSL support. If you use repo.turris.cz as your repository this must be checked.”?

I have read the whole documentation and SSL is enabled, I see a problem with rootfs.tar.xz download, it does not work or it is extremely slow.

Regarding wget:

“wget” can be provided via “busybox” or as standalone tool (ssl/non-ssl). Some users reported issues when contacting Turris servers/repository/api… (to get package list, to get signatures …to get lxc images, to update TOS to new version due wget glitches …). If i remember well, busybox-wget vs regular-wget is all about symlinks in “bin” , those should be handled by post-install script (but not in all situation). So just ensure it is not your case where you have both variants, but using regular from shell while busybox one is called by “turris” wrappers/scripts.
If you have wget as standalone binary, ensure you do not use non-ssl, just remove it and keep busybox version only or if you really need full wget, get only with ssl (and ensure that symlinks in bin are pointing to wanted version).

If you can fetch the rootfs.tar.xz manually, you should be able to install/create lxc from it locally. Does that works? You need to create config and use correct template (you should have them already present on your system) and that roofs image. Personally i did not try full manual lxc-create, so i am not sure if you can just grab that rootfs or you have to create meta.tar.xz using that image builder.

Are you using Storage plugin? This could be a reason., why you are not able to use LXC containers.

Checked LXC package list in reForis, waited a while so all the packages are downloaded and installed and it works for me.

Here is my output:

root@omnia:~# lxc-create -n test -t download
Setting up the GPG keyring
Downloading the image index

---
DIST    RELEASE ARCH    VARIANT BUILD
---
Turris_OS       stable  armv7l  default 2020-12-23
Turris_OS       stable  ppc     default 2020-12-23
Alpine  3.11    armv7l  default 2020-12-23
Alpine  3.11    aarch64 default 2020-12-23
Alpine  3.12    armv7l  default 2020-12-23
Alpine  3.12    aarch64 default 2020-12-23
Alpine  Edge    armv7l  default 2020-12-23
Alpine  Edge    aarch64 default 2020-12-23
ArchLinux       latest  armv7l  default 2020-12-23
ArchLinux       latest  aarch64 default 2020-12-23
Debian  Stretch armv7l  default 2020-12-23
Debian  Stretch aarch64 default 2020-12-23
Debian  Buster  armv7l  default 2020-12-23
Debian  Buster  aarch64 default 2020-12-23
Gentoo  stable  armv7l  default 2020-12-23
openSUSE        15.2    armv7l  default 2020-12-23
openSUSE        15.2    aarch64 default 2020-12-23
openSUSE        Tumbleweed      armv7l  default 2020-12-23
openSUSE        Tumbleweed      aarch64 default 2020-12-23
Sabayon 16      armv7l  default 2020-12-23
Ubuntu  Xenial  armv7l  default 2020-12-23
Ubuntu  Xenial  aarch64 default 2020-12-23
Ubuntu  Bionic  armv7l  default 2020-12-23
Ubuntu  Bionic  aarch64 default 2020-12-23
Ubuntu  Focal   armv7l  default 2020-12-23
Ubuntu  Focal   aarch64 default 2020-12-23
---

Distribution:
Ubuntu
Release:
Focal
Architecture:
armv7l

Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
Distribution Ubuntu version Focal was just installed as a container.

Content of the tarballs is provided by third party, thus there is no warranty of any kind nor support from Turris team.

Do not use containers on internal flash, they can wear it down really fast!!!