Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge creation fail with error 'Error: Can't parse a version' #11902

Closed
Josue-T opened this issue Jun 28, 2023 · 8 comments · Fixed by #12201
Closed

Bridge creation fail with error 'Error: Can't parse a version' #11902

Josue-T opened this issue Jun 28, 2023 · 8 comments · Fixed by #12201
Labels
Bug Confirmed to be a bug Incomplete Waiting on more information from reporter
Milestone

Comments

@Josue-T
Copy link

Josue-T commented Jun 28, 2023

Required information

  • Distribution: Debian
  • Distribution version: 12
  • The output of "lxc info" or if that fails:
    • Kernel version: 6.1.0-9-amd64
    • LXC version: 5.0.2-1
    • LXD version: 5.0.2-5
    • Storage backend in use: btrfs

Issue description

When the system have a locale different than 'en', the creation of bridge fail. It's because of dnsmasq version parsing issue.
After trying to understand what is happening in the code it's related to theses following part of code: https://github.com/lxc/lxd/blob/master/lxd/dnsmasq/dnsmasq.go#L114-L115

The issue is that with english locales the result of the command dnsmasq --version return this:

Dnsmasq version 2.89  Copyright (c) 2000-2022 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.

But in french the result is different:

Version de Dnsmasq 2.89  Copyright (c) 2000-2022 Simon Kelley
Options à la compilation IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile

Ce logiciel est fourni sans AUCUNE GARANTIE.
Dnsmasq est un logiciel libre, il vous est permis de le redistribuer
sous les termes de la licence GPL (GNU General Public License), version 2 ou 3.

And in others language it's could be also different. But in the code it's expected that are always the same spaces between the version and the start of string.

Steps to reproduce

  1. Set your locale to an other language than English.
  2. Try to create a bridge with lxc network create lxcbr0 --type=bridge
  3. See that it will fail with Error: Can't parse a version.

Workaround

For now unitl the issue is fixed the issue could be fixed by adding this line in the systemd unit of lxd.service:

Environment=LANGUAGE=en:en_GB

By this dnsmasq will be called with the "english" language.

@tomponline
Copy link
Member

tomponline commented Jun 28, 2023

This sounds very similar to https://github.com/lxc/lxd/issues/6109 which was fixed by https://github.com/lxc/lxd/pull/6111 in 2019.

This runs the dnsmasq --version command with these environment vars:

append(os.Environ(), "LANG=C.UTF-8", "LANGUAGE=en")

So LXD is already overriding the locale when invoking dnsmasq apparently.

Can you confirm what you get if you run please:

LANG=C.UTF-8 LANGUAGE=en dnsmasq --version

@tomponline tomponline added the Incomplete Waiting on more information from reporter label Jun 28, 2023
@tomponline
Copy link
Member

Also can you try:

LANG=C LANGUAGE=en dnsmasq --version

@Josue-T
Copy link
Author

Josue-T commented Jun 28, 2023

Also can you try:

LANG=C LANGUAGE=en dnsmasq --version

Hello, both return the correct English version:

Dnsmasq version 2.89  Copyright (c) 2000-2022 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 Lua TFTP conntrack ipset nftset auth cryptohash DNSSEC loop-detect inotify dumpfile

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.

@tomponline
Copy link
Member

Hrm, strange, I wonder if that fix somehow is missing from LXD 5.0.2, although I doubt it. I'll check...

@tomponline tomponline self-assigned this Jun 28, 2023
@tomponline
Copy link
Member

Yes it is in LXD 5.0.2

@tomponline
Copy link
Member

Are you running snap or deb package?

@tomponline tomponline removed their assignment Jun 29, 2023
@Josue-T
Copy link
Author

Josue-T commented Jul 4, 2023

Hello,

I'm using debian package. here are the the result of dpkg -l | grep lxd:

ii  lxd                                           5.0.2-5                                 amd64        Powerful system container and virtual machine manager - daemon
ii  lxd-agent                                     5.0.2-5                                 amd64        LXD guest agent
ii  lxd-client                                    5.0.2-5                                 amd64        Powerful system container and virtual machine manager - client

@tomponline tomponline added the Bug Confirmed to be a bug label Jul 31, 2023
@tomponline tomponline added this to the lxd-5.17 milestone Jul 31, 2023
@tomponline tomponline modified the milestones: lxd-5.17, lxd-5.18 Aug 21, 2023
simondeziel added a commit to simondeziel/lxd that referenced this issue Aug 31, 2023
https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Locale-Environment-Variables.html:

> LC_ALL is an environment variable that overrides all of the LC_*.
> It is typically used in scripts that run particular programs.

This *might* help with canonical#11902

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@tomponline
Copy link
Member

Hopefully @simondeziel change will fix this issue, but we can reopen if it doesn't.

tomponline pushed a commit to tomponline/lxd that referenced this issue Sep 26, 2023
https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Locale-Environment-Variables.html:

> LC_ALL is an environment variable that overrides all of the LC_*.
> It is typically used in scripts that run particular programs.

This *might* help with canonical#11902

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug Incomplete Waiting on more information from reporter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants