Page MenuHomeVyOS Platform

KeyError: 'memory' container_config['memory'] on upgrading to 1.4-rolling-202302041536
Closed, ResolvedPublicBUG

Description

I just did an upgrade from 1.4-rolling-202211250318 to 1.4-rolling-202302041536 and am seeing the following commit error. My existing container config does not contain any memory setting and it appears the script expects memory to exist.

Report time:      2023-02-04 21:04:59
Image version:    VyOS 1.4-rolling-202302041536
Release train:    current

Built by:         [email protected]
Built on:         Sat 04 Feb 2023 15:36 UTC
Build UUID:       1edbf138-dede-4b53-9f1d-897c0260ad97
Build commit ID:  2767ac346e4d1a

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  CheckPoint
Hardware model:   T-110-00
Hardware S/N:     1546B00287
Hardware UUID:    03000200-0400-0500-0006-000700080009

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/container.py", line 401, in <module>
    generate(c)
  File "/usr/libexec/vyos/conf_mode/container.py", line 343, in generate
    run_args = generate_run_arguments(name, container_config)
  File "/usr/libexec/vyos/conf_mode/container.py", line 233, in generate_run_arguments
    memory = container_config['memory']
KeyError: 'memory'

noteworthy:
cmd 'podman image exists docker.io/adamnet/adamone:4.8.5-beta5'
returned (out):

returned (err):
time="2023-02-04T21:04:59Z" level=warning msg="Switching default driver from overlay2 to the equivalent overlay driver"
cmd 'podman image exists runzero:artooro'
returned (out):

returned (err):
time="2023-02-04T21:04:59Z" level=warning msg="Switching default driver from overlay2 to the equivalent overlay driver"

[[container]] failed
Commit failed
[edit]

Details

Difficulty level
Unknown (require assessment)
Version
1.4-rolling-202302041536
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Related Objects

Mentioned In
1.3.3

Event Timeline

I have the same issue

VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report time:      2023-02-09 22:13:06
Image version:    VyOS 1.4-rolling-202302080317
Release train:    current

Built by:         [email protected]
Built on:         Wed 08 Feb 2023 03:17 UTC
Build UUID:       ce4d9361-2f83-44a1-88f4-488f1aa20f02
Build commit ID:  8cade9112a16ed

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  HP
Hardware model:   HP EliteDesk 800 G3 SFF
Hardware S/N:     2UA7261T01
Hardware UUID:    7cf4b75d-8278-e91c-3fa6-2b60e8161e0a

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/container.py", line 401, in <module>
    generate(c)
  File "/usr/libexec/vyos/conf_mode/container.py", line 343, in generate
    run_args = generate_run_arguments(name, container_config)
  File "/usr/libexec/vyos/conf_mode/container.py", line 233, in generate_run_arguments
    memory = container_config['memory']
KeyError: 'memory'

noteworthy:
cmd 'podman image exists registry.k8s.io/coredns/coredns:v1.10.0'
returned (out):

returned (err):
time="2023-02-09T22:13:06-05:00" level=warning msg="Switching default driver from overlay2 to the equivalent overlay driver"
cmd 'podman image exists quay.io/prometheus/node-exporter:v1.5.0'
returned (out):

returned (err):
time="2023-02-09T22:13:06-05:00" level=warning msg="Switching default driver from overlay2 to the equivalent overlay driver"

[[container]] failed
Commit failed

To fix it I had to set

set container name node-exporter memory 0
set container name node-exporter shared-memory 0
set container name node-exporter restart on-failure

Thanks for reporting.
We will take a look at it.

c-po changed the task status from Open to In progress.Feb 11 2023, 5:52 PM
c-po claimed this task.
c-po triaged this task as High priority.

This is quiet interesting as container memory defaults to 512.

Can you please share your complete container config?

vyos@vyos# set container name unifi
Possible completions:
   allow-host-networks  Allow host networks in container
+  cap-add              Container capabilities/permissions
   description          Description
+> device               Add a host device to the container
   disable              Disable instance
+> environment          Add custom environment variables
   image                Image name in the hub-registry
   memory               Memory (RAM) available to this container (default: 512)
+> network              Attach user defined network to container
+> port                 Publish port to the container
   restart              Restart options for container (default: on-failure)
   shared-memory        Shared memory available to this container (default: 64)
+> volume               Mount a volume into the container

Here's the commands I ran for node-exporter:

set container name node-exporter allow-host-networks
set container name node-exporter description 'Prometheus Node Exporter'
set container name node-exporter environment procfs value '/host/proc'
set container name node-exporter environment rootfs value '/rootfs'
set container name node-exporter environment sysfs value '/host/sys'
set container name node-exporter image 'quay.io/prometheus/node-exporter:v1.5.0'
set container name node-exporter memory '0'
set container name node-exporter port node-exporter destination '9100'
set container name node-exporter port node-exporter protocol 'tcp'
set container name node-exporter port node-exporter source '9100'
set container name node-exporter restart 'on-failure'
set container name node-exporter shared-memory '0'
set container name node-exporter volume procfs destination '/host/proc'
set container name node-exporter volume procfs mode 'ro'
set container name node-exporter volume procfs source '/proc'
set container name node-exporter volume rootfs destination '/rootfs'
set container name node-exporter volume rootfs mode 'ro'
set container name node-exporter volume rootfs source '/'
set container name node-exporter volume sysfs destination '/host/sys'
set container name node-exporter volume sysfs mode 'ro'
set container name node-exporter volume sysfs source '/sys'

Same problem here, on 1.3:

[edit]
vyos@gw# set container name multitool port http source 80
[edit]
vyos@gw# set container name multitool port http destination 80
[edit]
vyos@gw# commit
[ container ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your
  business policy requires it)
- and include all the information presented below

Report time:      2023-02-20 16:49:50
Image version:    VyOS 1.3-rolling-202302190903
Release train:    equuleus

Built by:         vyos@...
Built on:         Sun 19 Feb 2023 09:03 UTC
Build UUID:       a4ccc56a-0457-46be-9aba-f89003ba713d
Build commit ID:  c4521c495a5dc6

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  Deciso B.V.
Hardware model:   NetBoard-A10
Hardware S/N:
Hardware UUID:    12345678-1234-5678-90ab-cddeefaabbcc

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/container.py", line 401, in <module>
    generate(c)
  File "/usr/libexec/vyos/conf_mode/container.py", line 343, in generate
    run_args = generate_run_arguments(name, container_config)
  File "/usr/libexec/vyos/conf_mode/container.py", line 233, in generate_run_arguments
    memory = container_config['memory']
KeyError: 'memory'

[[container]] failed
Commit failed
[edit]
vyos@gw#

Container config:

set container name multitool description 'Network multitool container'
set container name multitool image 'wbitt/network-multitool:fedora'
set container name multitool network cntr-net
set container name nrpe allow-host-networks
set container name nrpe image 'incitem/almalinux9:nrpe'
set container network cntr-net description 'VyOS Container Network'
set container network cntr-net prefix '172.253.253.0/24'

Let me know if I can help test.

The thing is we have default values (for example memory) only for the first container:

##################################################
{'name': {'multitool': {'description': 'Network multitool container',
                        'image': 'wbitt/network-multitool:fedora',
                        'memory': '512',
                        'network': {'cntr-net': {}},
                        'port': {'http': {'destination': '80',
                                          'protocol': 'tcp',
                                          'source': '80'}},
                        'restart': 'on-failure',
                        'shared_memory': '64'},
          'nrpe': {'allow_host_networks': {},
                   'image': 'incitem/almalinux9:nrpe',
                   'protocol': 'tcp'},
          'radius': {'allow_host_networks': {},
                     'image': 'dchidell/radius-web',
                     'protocol': 'tcp',
                     'volume': {'clients': {'destination': '/etc/raddb/clients.conf',
                                            'mode': 'rw',
                                            'source': '/config/containers/radius/clients'},
                                'users': {'destination': '/etc/raddb/users',
                                          'mode': 'rw',
                                          'source': '/config/containers/radius/users'}}}},
 'network': {'cntr-net': {'description': 'VyOS Container Network',
                          'prefix': ['172.253.253.0/24']}},
 'registry': ['docker.io', 'quay.io']}
##################################################

We must set default values for all containers

Viacheslav changed the task status from In progress to Needs testing.Feb 22 2023, 5:09 PM
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus (1.3.3) board.