Whonix Wiki Download Docs News Support Tips Issues Contribute DONATE

Kicksecure /etc/hostname /etc/hosts

whenever you type sudo something it says:

sudo: unable to resolve host localhost.localdomain: Name or service not known

1 Like

Confirmed bug. Workaround:

sudo hostname localhost
1 Like

Apparently there is no real default hostname. By Debian default, /etc/hostname and /etc/hosts is not managed by any package. For Debian installations that file is generated by Debian installer.

I thought by writing localhost into /etc/hostname during Kicksecure build process could be avoided to have /etc/hostname or /etc/hosts managed by any package in Kicksecure. And then later user can just customize it if needed. But that does not work…

Even though /etc/hosts by default (as created by grml-debootstrap)…

Already contains:

127.0.0.1       localhost 

Other VM creation tools (example: https://grml.org/grml-debootstrap/) set /etc/hostname to something (example: grml).

I wonder where Debian is getting the .localdomain part from anyhow? It is nowhere to be found in folder /etc.

Related:

solved (message gone) by:

go to /etc/hosts

change:

127.0.0.1 localhost

to

127.0.0.1 localhost.localdomain localhost

[Ref]

1 Like

I don’t want to add this by default. Not sure you suggested that but in case if anyone interprets it as such as suggestion, here’s why.

This long thread and who knows where it even started looks rather complicated:

Might argue somewhere against .localdomain such as here:

Since some modification must be shipped anyhow, and since there is no generic default / convention for default host name, can as well as also add a “proper” hostname, i.e. not localhost.

Will probably use same settings in Kicksecure as in Whonix. I.e. default hostname host.

I.e. package kicksecure-base-files effectively shipping files:

  • /etc/hostname
  • /etc/hosts

Unless there are better suggestions for default hostname / hosts file / implementation details.

1 Like

Now I remember why I didn’t want to add files /etc/hostname and /etc/hosts into packages. This is because for Kicksecure we’ll be needing to rely distro morphing installation method for the server use case for a while. Users using VPS will probably have no other chance than telling their VPS provider to install Debian and then sudo apt install kicksecure-cli. In that case, the installed packages shouldn’t modify the server’s existing /etc/hostname and /etc/hosts. Therefore for Kicksecure builds, these files need to be auto generated during the build process so that these aren’t managed by any packages.

1 Like

But many of the VPS now providing freedom of uploading your own distro
ISO, So not really every host provider this applies to it.

Patrick via Whonix Forum:

1 Like

I see. I didn’t notice or overlooked that. Good to know.

1 Like

Inside a Kicksecure VM…

cat /etc/hostname

localhost

Looks correct.

cat /etc/hosts

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Looks also correct.

dsudo test

No output as expected (no error message), also ok.

hostname

localhost.localdomain

This is wrong.

Why is that? Related to network manager, DHCP?

Related to network manager…

Quote NetworkManager.conf(5) — network-manager — Debian bullseye-backports — Debian Manpages

hostname-mode

Set the management mode of the hostname. This parameter will affect only the transient hostname. If a valid static hostname is set, NetworkManager will skip the update of the hostname despite the value of this option. An hostname empty or equal to ‘localhost’, ‘localhost6’, ‘localhost.localdomain’ or ‘localhost6.localdomain’ is considered invalid.

Bingo.

This will be fixed after updates.

(The following file will solve it.)