This was my first impression with trying lxd 3.19:
$ lxc launch ubuntu:18.04 ubuntu-18.04
Creating ubuntu-18.04
Error: Failed instance creation: Create instance: Container name isn't a valid hostname
What you can’t see is that took several minutes for the error to be return.
First suggestion: Please validate the input immediately and fail fast. If the container name isn’t valid, please tell me that before spending 10 minutes to download an image.
Second suggestion: Clearly I don’t know what a valid container name is. lxc launch --help doesn’t tell me what the rules are. It would be hepful to have them there. The error message could also be improved to explain what the naming rules. Hopefully that just takes a sentence or two.
Thanks for LXD. I’ll look forward to getting some containers up and running.
Make it three suggestions. Here’s another first impression error message which could be improved:
$ lxc copy ubuntu-1804 ubuntu-1804-markbase
Error: Create instance from copy: exit status 1
That’s not at all clear why it failed. The user experience would be improved if there was a simple pre-check to see if the container was running. If so, emit a more helpful message: “Error: Create instance from copy: Can’t copy a running container.”
(As a new user, I had run “exec” to test it a container and then exited the container. I thought the container shutdown at that time and didn’t realize it was still running until I investigated this error.)
I was using the ZFS backend. I simply entered a default Ubuntu 18.04 container with exec -- bash and then exited. Is the copy command expected to succeed on a running container in that case?
I had looked at RFC 1123, which is a large document mostly unrelated to host name syntax. I presume it’s section “2.1 Host Names and Numbers” that would apply. But that has very little to say about the syntax either, only to say that’s “mostly like RFC 952 with this one exception”.
If you then look up RFC 952, it concerns both IP address and host names and is quite clear that dots are allowed.
While I appreciate that RFC 1123 is a very specific reference, in practice it’s a far less helpful tip than “ascii chars a-z A-Z 0-9 with - as separator”.
I like the way @tomp handled this in his alternate PR which provides specific tips and also checks that the name is not more than 63 characters-- a length which is a reference to the RFC.
yes you are correct RFC 1123 is only adding a minor variation on RFC 952. Dots are only allowed to separate between domain parts, as in discuss.linuxcontainers.org, discuss is the host name, so discuss can’t have a dot in the name.
Here’s another error message I ran into as a new user that could be clearer:
lxc launch ubuntu-1804 --profile default --profile x11 chromium
Creating chromium
Error: not found
What was found? lxc list shows that the container name exists, so I don’t think it’s that. I expect a default profile exists, so I don’t think that’s the issue and I just created an x11 profile. “chromium” just a name I provided so I don’t think that could be “not found”. So what’s not found?
I ran with --debug --verbose for more information. It appears that “ubuntu-1804” is “not found” because launch expects an image as argument but I made the beginner mistake of giving it a container name instead. It would have been helpful if the reply was “image not found”. An A+ response would have been “Could not find an image named “ubuntu-1804”. It looks like you provided a container name instead. Did you mean to use ‘lxc $correct_other_command’ instead?”
I created an alias of the one image I had and then tried again. lxc launch got further but still failed. It’s clear why lauching a stock Ubuntu image would fail.
$ lxc launch ubuntu-1804-image --profile default --profile x11 chromium
Creating chromium
Starting chromium
Error: Failed to run: /snap/lxd/current/bin/lxd forkstart chromium /var/snap/lxd/common/lxd/containers /var/snap/lxd/common/lxd/logs/chromium/lxc.conf:
Try `lxc info --show-log local:chromium` for more info
$ lxc info --show-log local:chromium
Name: chromium
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/02/03 01:14 UTC
Status: Stopped
Type: container
Profiles: default, x11
Log:
lxc chromium 20200203011408.903 WARN cgfsng - cgroups/cgfsng.c:chowmod:1525 - No such file or directory - Failed to chown(/sys/fs/cgroup/unified//lxc.payload/chromium/
memory.oom.group, 1000000000, 0)
lxc chromium 20200203011409.240 ERROR conf - conf.c:run_buffer:352 - Script exited with status 1
lxc chromium 20200203011409.240 ERROR conf - conf.c:lxc_setup:3653 - Failed to run mount hooks
lxc chromium 20200203011409.240 ERROR start - start.c:do_start:1321 - Failed to setup container "chromium"
lxc chromium 20200203011409.240 ERROR sync - sync.c:__sync_wait:62 - An error occurred in another process (expected sequence number 5)
lxc chromium 20200203011409.240 WARN network - network.c:lxc_delete_network_priv:3377 - Failed to rename interface with index 26 from "eth0" to its initial name "veth4
285f1d9"
lxc chromium 20200203011409.240 ERROR start - start.c:lxc_abort:1122 - Function not implemented - Failed to send SIGKILL to 12251
lxc chromium 20200203011409.240 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:873 - Received container state "ABORTING" instead of "RUNNING"
lxc chromium 20200203011409.241 ERROR start - start.c:__lxc_start:2039 - Failed to spawn container "chromium"
lxc 20200203011409.369 WARN commands - commands.c:lxc_cmd_rsp_recv:135 - Connection reset by peer - Failed to receive response for command "get_state"
I tried upgrading LXD to 3.20, but I got the same error with it.
lxc chromium 20200203011409.240 WARN network - network.c:lxc_delete_network_priv:3377 - Failed to rename interface with index 26 from "eth0" to its initial name "veth4
If you use lxc init rather than lxc launch then it will create the container but not try to start it.
At that point can you run and paste the output of: