Bug: Update crashes because of invalid byte in /opt/gitlab/embedded/nodes/<<hostname>>.json

Summary

Gitlab CE update on Ubuntu24 crashes with this message:

Preparing to unpack .../21-gitlab-ce_17.10.4-ce.0_amd64.deb ...
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/json-2.10.1/lib/json/common.rb:245:in `encode': "\xE2" on US-ASCII (Encoding::InvalidByteSequenceError)
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/json-2.10.1/lib/json/common.rb:245:in `parse'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/json-2.10.1/lib/json/common.rb:245:in `parse'
        from /opt/gitlab/embedded/service/omnibus-ctl/check_config.rb:39:in `block in load_file'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/omnibus-ctl-0.6.12/lib/omnibus-ctl.rb:197:in `block in add_command'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/omnibus-ctl-0.6.12/lib/omnibus-ctl.rb:747:in `run'
        from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/omnibus-ctl-0.6.12/bin/omnibus-ctl:31:in `<top (required)>'
        from /opt/gitlab/embedded/bin/omnibus-ctl:25:in `load'
        from /opt/gitlab/embedded/bin/omnibus-ctl:25:in `<main>'
dpkg: error processing archive /tmp/apt-dpkg-install-j3TRDR/21-gitlab-ce_17.10.4-ce.0_amd64.deb (--unpack):

The issue comes from the field:

"hostnamectl": {
  ...,
  "chassis": "container �~X~P"
  ...
}

in the file /opt/gitlab/embedded/nodes/<<hostname>>.json

After removing it, the update process works normally, but this value comes back after each update.
This Gitlab instance is hosted in a LXC container in a Proxmox Virtual Environment.

Steps to reproduce

Update a Gitlab instance on an Ubuntu24, in a LXC container, in a Proxmox Virtual Environment.

Gitlab env info

Expand for output related to GitLab environment info
```
System information
System:         Ubuntu 24.04
Current User:   git
Using RVM:      no
Ruby Version:   3.2.5
Gem Version:    3.6.5
Bundler Version:2.6.5
Rake Version:   13.0.6
Redis Version:  7.0.15
Sidekiq Version:7.2.4
Go Version:     unknown

GitLab information
Version:        17.10.1
Revision:       5ef58a00091
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     14.17
URL:            https://<>
HTTP Clone URL: https://<>/some-group/some-project.git
SSH Clone URL:  git@<>:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: 

GitLab Shell
Version:        14.41.0
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address:      unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version:      17.10.1
- default Git Version:  2.48.1.gl1
```

Gitlab application checks

Expand for output related to the GitLab application check
```
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.41.0 ? ... OK (14.41.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes
Tables are truncated? ... skipped
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ... 
2/1 ... yes
10/3 ... yes
10/4 ... yes
10/6 ... yes
10/7 ... yes
10/8 ... yes
10/9 ... yes
25/10 ... yes
863/11 ... yes
10/12 ... yes
10/13 ... yes
25/14 ... yes
25/15 ... yes
863/17 ... yes
25/18 ... yes
10/19 ... yes
25/20 ... yes
25/21 ... yes
25/22 ... yes
10/23 ... yes
10/24 ... yes
25/25 ... yes
25/26 ... yes
10/27 ... yes
25/28 ... yes
25/29 ... yes
10/30 ... yes
25/31 ... yes
25/32 ... yes
25/33 ... yes
25/34 ... yes
25/35 ... yes
25/36 ... yes
25/37 ... yes
25/39 ... yes
25/40 ... yes
25/41 ... yes
25/42 ... yes
25/43 ... yes
25/44 ... yes
25/45 ... yes
25/46 ... yes
25/47 ... yes
694/48 ... yes
25/49 ... yes
25/50 ... yes
25/51 ... yes
10/52 ... yes
25/54 ... yes
25/55 ... yes
25/56 ... yes
10/57 ... yes
25/58 ... yes
10/59 ... yes
25/60 ... yes
25/61 ... yes
25/62 ... yes
25/63 ... yes
25/64 ... yes
10/66 ... yes
25/67 ... yes
10/68 ... yes
25/69 ... yes
10/70 ... yes
10/71 ... yes
25/72 ... yes
25/73 ... yes
25/74 ... yes
10/76 ... yes
25/77 ... yes
25/78 ... yes
25/79 ... yes
25/80 ... yes
25/81 ... yes
25/82 ... yes
10/83 ... yes
10/84 ... yes
25/85 ... yes
10/86 ... yes
25/87 ... yes
25/88 ... yes
25/89 ... yes
25/90 ... yes
25/91 ... yes
25/92 ... yes
25/93 ... yes
25/94 ... yes
25/95 ... yes
25/96 ... yes
208/97 ... yes
208/98 ... yes
291/99 ... yes
25/100 ... yes
25/102 ... yes
10/103 ... yes
25/104 ... yes
10/105 ... yes
25/106 ... yes
25/107 ... yes
25/108 ... yes
10/109 ... yes
10/110 ... yes
10/111 ... yes
25/112 ... yes
25/113 ... yes
25/114 ... yes
25/115 ... yes
25/116 ... yes
25/117 ... yes
10/118 ... yes
25/119 ... yes
10/120 ... yes
25/121 ... yes
25/122 ... yes
25/123 ... yes
488/124 ... yes
25/125 ... yes
25/126 ... yes
25/127 ... yes
25/128 ... yes
25/129 ... yes
10/130 ... yes
208/131 ... yes
25/132 ... yes
488/133 ... yes
10/134 ... yes
25/135 ... yes
25/136 ... yes
25/137 ... yes
10/138 ... yes
10/139 ... yes
25/140 ... yes
25/141 ... yes
25/142 ... yes
10/143 ... yes
10/144 ... yes
10/145 ... yes
696/147 ... yes
10/148 ... yes
25/149 ... yes
25/150 ... yes
10/151 ... yes
25/152 ... yes
25/153 ... yes
10/154 ... yes
10/155 ... yes
631/156 ... yes
10/157 ... yes
25/158 ... yes
10/159 ... yes
10/160 ... yes
25/161 ... yes
208/162 ... yes
25/163 ... yes
10/164 ... yes
25/165 ... yes
10/166 ... yes
12/167 ... yes
12/168 ... yes
12/169 ... yes
10/170 ... yes
696/171 ... yes
696/172 ... yes
694/173 ... yes
696/174 ... yes
696/175 ... yes
695/176 ... yes
694/177 ... yes
694/178 ... yes
25/179 ... yes
696/180 ... yes
695/183 ... yes
694/184 ... yes
696/185 ... yes
694/186 ... yes
694/187 ... yes
12/188 ... yes
12/189 ... yes
696/190 ... yes
696/191 ... yes
696/192 ... yes
696/193 ... yes
696/194 ... yes
694/195 ... yes
694/196 ... yes
694/197 ... yes
12/198 ... yes
696/199 ... yes
694/200 ... yes
694/201 ... yes
694/202 ... yes
12/203 ... yes
10/204 ... yes
12/205 ... yes
694/206 ... yes
696/207 ... yes
694/208 ... yes
694/209 ... yes
696/210 ... yes
Redis version >= 6.2.14? ... yes
Ruby version >= 3.0.6 ? ... yes (3.2.5)
Git user has default SSH configuration? ... yes
Active users: ... 586
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished
```