Skip to content

nerdctl error message provides no context #3691

@RonBarkan

Description

@RonBarkan

Description

This command used to fail for me:

$ sudo nerdctl run --debug --rm registry.k8s.io/pause:3.9
DEBU[0000] verifying process skipped                    
DEBU[0000] generated log driver: binary:///usr/bin/nerdctl?_NERDCTL_INTERNAL_LOGGING=%2Fvar%2Flib%2Fnerdctl%2F1935db59 
FATA[0000] failed to verify networking settings: failed to check for default network: error parsing configuration: missing 'type'

I have wasted a few hours trying to figure out what was wrong, without much progress, because I had no idea where 'type' might be missing. On a different machine I had a similar error, only there it was something about a stray 'c', but providing no hint on where it might be. I inspected /etc/containderd/config.toml a few times but could not find anything wrong.

Eventually, somewhat by chance, I stumbled upon an incorrect net.d json files.

Steps to reproduce the issue

  1. A system with a properly configured containerd and nerdctl installed
  2. Run
echo '{
  "cniVersion": "0.3.1",
  "Network": "10.244.0.0/16",
  "Backend": {
    "Type": "vxlan"
  }
}' | sudo tee /etc/cni/net.d/net-conf.json
  1. Execute the command found above.

Describe the results you received and expected

Actual error message:

FATA[0000] failed to verify networking settings: failed to check for default network: error parsing configuration: missing 'type'

Expected error message with context that is helpful for the user:

FATA[0000] failed to verify networking settings: failed to check for default network: error parsing '/etc/cni/net.d/net-conf.json': missing json key 'type'

Bonus points if you can also document what is the proper expected schema and even give a link or easily found keyword (this is what error codes were used for) to this doc in your error.

What version of nerdctl are you using?

nerdctl version 1.7.7
containerd containerd.io 1.6.12

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

Namespace: default
Debug Mode: false

Server:
Server Version: 1.6.12
Storage Driver: overlayfs
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Log: fluentd journald json-file syslog
Storage: native overlayfs
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.9.10-1rodete5-amd64
Operating System: Debian GNU/Linux rodete
OSType: linux
Architecture: x86_64
CPUs: 24
Total Memory: 94.29GiB
Name:
ID: e34b639d-c6f1-4e15-b4f3-f4a96621f171

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions