anaconda icon indicating copy to clipboard operation
anaconda copied to clipboard

Split write network and hostname configuration

Open temaps opened this issue 1 year ago • 9 comments

When the parameter can_configure_network is disabled in the configuration, the file /etc/hostname is not written to the installed system.

temaps avatar Jun 29 '23 12:06 temaps

A bit of context why this change was made. A derivative of ROSA - MOS (ROSA-based distro for schools) - sets can_configure_network=False by default, because every teacher/student in Moscow schools has a personal password for the local WiFi network. Someone's password was made visible to every user by can_configure_network=True.

But we in ROSA generate random hostnames on start of the LiveCD (https://abf.io/import/anaconda/blob/rosa2023.1/anaconda-livecd-init.sh) and then inherit them into the installed system (see also: https://abf.io/import/anaconda/blob/6b6591efa3/0046-Copy-current-hostname-into-installed-system.patch , I think this could also be upstreamized, what do you think?). But without the changes in the PR both a randomly and manually (in the network spoke) set hostname was not copied into the installed system.

Setting random hostnames helps to identify machines inside network.

mikhailnov avatar Jun 29 '23 13:06 mikhailnov

@rvykydal Radku, can you please take a look at this?

VladimirSlavik avatar Jul 04 '23 18:07 VladimirSlavik

But I'd prefer to split the hostname configuration from write_configuration completely and call it separately after "Network confgiration" task (if can_configure_network or can_configure_hostname) so we are more clear and explicit in the tasks and logs in what is happening

+1 , code flow is not obvious otherwise

mikhailnov avatar Jul 14 '23 07:07 mikhailnov

But we in ROSA generate random hostnames on start of the LiveCD (https://abf.io/import/anaconda/blob/rosa2023.1/anaconda-livecd-init.sh) and then inherit them into the installed system (see also: https://abf.io/import/anaconda/blob/6b6591efa3/0046-Copy-current-hostname-into-installed-system.patch , I think this could also be upstreamized, what do you think?).

I am afraid making this default behavior would be in conflict with https://github.com/rhinstaller/anaconda/pull/643 where we stopped using the hostname from installer environment for target system.

rvykydal avatar Jul 14 '23 07:07 rvykydal

But we in ROSA generate random hostnames on start of the LiveCD (https://abf.io/import/anaconda/blob/rosa2023.1/anaconda-livecd-init.sh) and then inherit them into the installed system (see also: https://abf.io/import/anaconda/blob/6b6591efa3/0046-Copy-current-hostname-into-installed-system.patch , I think this could also be upstreamized, what do you think?).

I am afraid making this default behavior would be in conflict with #643 where we stopped using the hostname from installer environment for target system.

Hm... Commit message there says: "Doing so, the installed system would not use new transient hostname if it boots in different environment". But the current behaviour is to set the same static hostname, but not skip setting it, isn't it?

mikhailnov avatar Jul 14 '23 07:07 mikhailnov

The script generates a random hostname only if another hostname, including a transient one via DHCP, was not set: https://abf.io/import/anaconda/blob/d94b36a3eb/anaconda-livecd-init.sh#lc-21

mikhailnov avatar Jul 14 '23 07:07 mikhailnov

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 23 '23 02:10 github-actions[bot]

The tests are confused by the name "hostname" (write-hostname-configuration), there don't seem to be any more problems. Is this an obstacle?

temaps avatar Dec 13 '23 11:12 temaps

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 12 '24 02:02 github-actions[bot]

This PR was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Mar 13 '24 02:03 github-actions[bot]

manual testing required...

temaps avatar Mar 13 '24 08:03 temaps