After changing hostname - UnicodeError: label empty or too long

  • Hey everyone :)
    I just finished installing OMV 5 on my Raspberry Pi 4 using this guide, and I began configuring it.
    I managed to change the administrator password and the auto logout timer without problems. The problems began when I wanted to change the hostname.
    I set the hostname to "nas" and applied changes. The hostname was indeed changed, but now the "Your configuration has been changed" prompt constantly shows up, and when I try to apply changes, I get:

    I used the latest Raspbian Buster Lite image from 2020-02-05. Rebooting the Pi does not affect the issue. Did I do something wrong? :(


    EDIT: I tried to revert the changes using the "Revert" button, the message disappeared, but I'm also getting the same error when trying to mount a file system.


    EDIT 2: I managed to recover from the issue by:
    - clicking the "Revert" button to revert changes
    - checking what's the default hostname set in "System > Network"
    - changing the hostname back to default, which in my case was "sudo hostname raspberrypi"


    The issue comes back every time I try to change the hostname either via the OMV panel, or with the "hostname" command.

  • The problem seems to be the Python socket library. Searching Google let you find a number of bug reports related to the same issue. The problematic function seems to be called by SaltStack, but i do not see that the hostname of your system is longer than 64 chars nor it is empty.


    Code
    domain:
    fqdn:
    raspberrypi
    fqdn_ip4:
    - 127.0.1.1
    fqdn_ip6:
    - ::1
    fqdns:

    The locale doesn't look exotic which might cause decoding issues.



    Code
    locale_info:
    ----------
    defaultencoding:
    UTF-8
    defaultlanguage:
    en_US
    detectedencoding:
    UTF-8
    timezone:
    GMT
  • Probably won't make a difference but I would be curious to see if setting a domain name (like local) fixes it.

    omv 5.5.1 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • I am the one from „the other thread“
    Setting a domain did not help.
    i tried to reconfigure a lot - all with the same error message
    Something must have happened before, to stop the config save mechanisms to work.


    Did a fresh install in my system today and only configured standard things and some shares - nothing fancy.
    So far, so good


    Tomorrow I will continue adding things like usbbackup, clamAV, rsync to my second NAS, etc

    Asrock J3160-ITX, 4GB RAM, 120GB SSD, 2x3TB Seagate Ironwolf as RAID1, Thermaltake Core1 Cube

  • I played a little bit with the SaltStack code and your system information.

    Python
    root@omv5box:/home/vagrant# python3
    Python 3.7.3 (default, Apr 3 2019, 05:39:12)
    [GCC 8.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> grains = {}
    >>> grains['fqdn'] = "raspberrypi"
    >>> (grains['host'], grains['domain']) = grains['fqdn'].partition('.')[::2]
    >>> grains
    {'fqdn': 'raspberrypi', 'host': 'raspberrypi', 'domain': ''}

    I can not see any problems here which might result in the idna error.

  • What is the output of


    Code
    # hostname
    # hostname --fqdn
    # hostnamectl

    First two return "raspberrypi", but hostnamectl returns something interesting:


    Code
    Static hostname: magazyn
    Transient hostname: raspberrypi
    Icon name: computer
    Machine ID: 81a6c17ba0354666a09e33b6b8c45285
    Boot ID: 6b9811258d7b47b39314a28fd7dbf45d
    Operating System: Raspbian GNU/Linux 10 (buster)
    Kernel: Linux 4.19.97-v7l+
    Architecture: arm

    "magazyn" is what I tried to set my hostname to earlier instead of "nas", which I was afraid would be too short.
    The "transient hostname" seems to be the one actually being used (since I can ping my device with it from another computer, and I can use it to access the web panel).

  • What is the output of the following interactive python code:


    Python
    root@omv5box:/home/vagrant# python3
    Python 3.7.3 (default, Apr 3 2019, 05:39:12)
    [GCC 8.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more in
    >>> import salt.utils.network
    >>> salt.utils.network.get_fqhostname()
    'omv5box'

    This is the origin of the problem.
    1. https://github.com/saltstack/s…salt/grains/core.py#L2177
    2. https://github.com/saltstack/s…salt/grains/core.py#L2251
    3. https://github.com/saltstack/s…salt/grains/core.py#L2259
    4. Boom

  • I just realized all my command output might have been useless because these commands weren't run in a state when OMV shows this error. So I recreated the error by changing the hostname to "testtesttest" in OMV and rerun all those commands again.
    Now your python code returns:

    Code
    >>> salt.utils.network.get_fqhostname()
    '.'


    Also, hostnamectl no longer returns a "transient hostname":


    Code
    root@raspberrypi:/home/pi# hostnamectl
    Static hostname: testtesttest
    Icon name: computer
    Machine ID: 81a6c17ba0354666a09e33b6b8c45285
    Boot ID: 6b9811258d7b47b39314a28fd7dbf45d
    Operating System: Raspbian GNU/Linux 10 (buster)
    Kernel: Linux 4.19.97-v7l+
    Architecture: arm
  • hostname --all-fqdns will return the fqdn for each network adapter including loopback (which can be different). This is why I was curious if setting a domain would help.

    omv 5.5.1 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • I just realized all my command output might have been useless because these commands weren't run in a state when OMV shows this error. So I recreated the error by changing the hostname to "testtesttest" in OMV and rerun all those commands again.
    Now your python code returns:

    Code
    >>> salt.utils.network.get_fqhostname()
    '.'

    Also, hostnamectl no longer returns a "transient hostname":


    Code
    root@raspberrypi:/home/pi# hostnamectl
    Static hostname: testtesttest
    Icon name: computer
    Machine ID: 81a6c17ba0354666a09e33b6b8c45285
    Boot ID: 6b9811258d7b47b39314a28fd7dbf45d
    Operating System: Raspbian GNU/Linux 10 (buster)
    Kernel: Linux 4.19.97-v7l+
    Architecture: arm

    That's the output that will cause the exception. Hmmm, and why the hell is the hostname . in this state?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!