InterNetNews / inn

INN (InterNetNews) Usenet server
https://www.isc.org/othersoftware/#INN
Other
68 stars 13 forks source link

`apt-get install inn2` fails on Docker #311

Open cclauss opened 4 days ago

cclauss commented 4 days ago

The apt-get install inn2 script very helpfully creates a default inn.conf file but that file causes hostname errors at Docker built-time. Could that script be modified to succeed when the hostname command returns buildkitsandbox?

Related to:

Using the Dockerfile

# FROM debian:bookworm
FROM ubuntu:24.04
# `hostname` at Docker built-time returns 'buildkitsandbox' on both Debian and Ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && apt-get install --yes inn2
CMD ["systemctl", "status", "inn2"]

% docker build --no-cache --progress plain .

Setting up inn2 (2.7.2~20240212-1build3) ...
innconfval: hostname does not resolve or domain not set in inn.conf
innconfval: the FQDN of the server contains invalid characters not suitable for Message-IDs
dpkg: error processing package inn2 (--configure):
installed inn2 package post-installation script subprocess returned error exit status 1

Following the example from #310, I have tried to add the following modifications without success:

ENV INN_HOSTNAME=localhost.localdomain
# ENV INN_HOSTNAME=localhost.example.com
RUN echo "#!/bin/bash\n echo ${INN_HOSTNAME}" > /usr/bin/hostname && \
    echo "${INN_HOSTNAME}" > /etc/hostname && \
    hostname && \
    cat /etc/hostname && \
    apt-get update -qq && apt-get install --yes inn2

@ewxrjk @rfc1036

Julien-Elie commented 3 days ago

We do not have such an apt-get install inn2 script. The request should be asked to the Debian packager. A way to initialize the domain parameter could be given (via preseeding for instance).

Form previous discussions about Docker, relaxing the check of a valid hostname in INN is not wanted because it can lead to unexpected and weird issues in Message-IDs or Path header fields.

Julien-Elie commented 3 days ago

Incidentally, Docker could provide a way for the end user to customize the hostname. It is insane to force other applications to adapt to their hard-coded hostname... and what if they also decide to change the hostame to another one in a future release? ...

cclauss commented 3 days ago

Oh... It breaks even if I attempt to bring my own inn.conf file by adding to the Dockerfile:

COPY inn.conf /etc/news/inn.conf

Dispite DEBIAN_FRONTEND=noninteractive, the apt-get install inn2 process then asks

Setting up inn2-inews (2.7.2~20240212-1build3) ...

Configuration file '/etc/news/inn.conf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** inn.conf (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package inn2-inews (--configure):
 end of file on stdin at conffile prompt
Errors were encountered while processing:
 inn2-inews
E: Sub-process /usr/bin/dpkg returned an error code (1)
rfc1036 commented 3 days ago

Look at what I did to make the Debian autopkgtest work, which also runs in an environment without a proper hostname.

cclauss commented 3 days ago

Thanks @rfc1036, but unfortunately, I do not know Purl. Please point me to which lines to focus on.