Page MenuHomeVyOS Platform

VyOS Docker container not load config
In progress, NormalPublicBUG

Description

When VyOS runs as docker container, we have some problem with config loads. This appears only for CRUX (1.2.x-1.2.5-eap1) images, on latest rolling all works as expected.

root@df5e848a4876:/# journalctl | grep boot-config-loader
Mar 09 13:03:57 df5e848a4876 boot-config-loader[668]: Cannot set up configuration session.

root@df5e848a4876:/# cat /var/log/vyatta/vyatta-config-loader.log 
2020-03-09 13:03:57  == begin boot-config-loader
2020-03-09 13:03:57  Cannot set up configuration session.

root@df5e848a4876:/# cat /var/log/vyatta/vyatta-config-loader.log 
2020-03-09 13:03:57  == begin boot-config-loader
2020-03-09 13:03:57  Cannot set up configuration session.

root@df5e848a4876:/#  /bin/cli-shell-api setupSession
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase: __pos (which is 18446744073709551615) > this->size() (which is 0)
Aborted (core dumped)

Reproducing:

#Download latest stable ISO
mkdir rootfs
mkdir unsquashfs
#Mount ISO
mount -t iso9660  -o loop vyos-1.2.X.iso rootfs/
unsquashfs -f -d unsquashfs/ rootfs/live/filesystem.squashfs
#Create container
tar -C unsquashfs -c . | docker import - vyosimg/vyos
# Run container
docker run -d --name vyos --privileged -v /lib/modules:/lib/modules vyosimg/vyos:latest /sbin/init

Only if config loaded successfully, we can enter to the container with following command

docker exec -it vyos su vyos

Also we can use docker exec -it vyos /bin/bash for debugging.

Details

Difficulty level
Unknown (require assessment)
Version
1.2.5-epa1
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

Dmitry created this task.Mar 9 2020, 5:42 PM
Dmitry updated the task description. (Show Details)
pasik added a subscriber: pasik.Mar 10 2020, 5:09 PM

I've tracked this down to a bug in libboost-filesystem, versions < 1.56, that occurs if the locale is not properly set, as is the case within the Docker environment:

https://svn.boost.org/trac10/ticket/4688

Consequently, the problem appears only in the Crux setting (libboost-filesystem1.55.0). Workarounds are available; a proper fix will follow.

@Dmitry The simplest workaround for the moment is to add the following to your load steps:

...
unsquashfs -f -d unsquashfs/ rootfs/live/filesystem.squashfs
sed -i 's/^LANG=.*$/LANG=C.UTF-8/' unsquashfs/etc/default/locale
#Create container
...

Note that this is an (not-immediately-fatal) issue for the 1.3 image as well, as evidenced by the locale errors recorded in /var/log/messages. The cause is that the default LANG locale en_US.UTF-8 is not present in the squashfs image; it is generated during vyos-build image creation and inherited by the live cd, and thereby, the installed image. It was a fatal error for Crux due to the libboost bug mentioned above.

Dmitry changed the task status from Open to In progress.Mar 12 2020, 10:13 AM

Thanks @jestabro , works well with this change. After passing all the tests, I will write docs about VyOS in container.

syncer triaged this task as Normal priority.Mar 28 2020, 11:52 AM
syncer edited projects, added VyOS 1.3 Equuleus; removed VyOS 1.2 Crux.