From patchwork Fri Oct 11 01:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13831712 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C87FF4C7D for ; Fri, 11 Oct 2024 01:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728608474; cv=none; b=kW5ZB8PDZojT2OECfgtYO1EuMsRfW4o0r3QuVg7sRJczMZGlStCglJVQ0o4m402YXcaSC0v/mzYtNqh5yUUw8k4FpJH+GRFbPPuoila0FgvjRsb4icg1Mt5gI6dp28NZ5z9Z0nI5DRIVc912gui//Y3/holRUYrQmBb2h7//fH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728608474; c=relaxed/simple; bh=+fvrBG0sZIzHJfYiRMPKmiE+rdYKjbQIQ/09mC0HSRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kjrsBZc9H6xkL85b7JH7Nivl2hs52hkswcZp9gwvbuCn6Tv9R7M/XVp+zCcPctdceccXLAd5VIpBYXL6kNwd3IoLTKVMSq/I8zCw9nBeY0ErQpW+Fm9BC2ipPZDshqhjFdbottV3MGPwsVScK3bgPBeL5EB0c0muTZlKHHr/6+Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=q0gjN7/G; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="q0gjN7/G" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=s8Ulqlz6OJ3GQ/lUoxVrbYF3DIrWT5+iTGX3syoZSBk=; b=q0gjN7/GHSsCUZ9ZFwt3w4HxCD VJrywdPBrV0JzzBLQRB2OtjRnhSaBhbWb5/YfJG0ijc6LVsfZhIHUQDvlPx8Qg6n/WDVxOCMRBWWN gD7wnYcAqABv6cGZQYFJCTRShiwhqVQ4Tipzj+ubFPViobGhok9qP2TR/8EgbLpkNOqw1ZmfkXygX lOs7N2pt2xrXNHlKbBxdR6A6nIDECGdK9OJ9VikWWR33rzWi4efnbk/0euTh8XRy/ioRgjEh7AHj0 5UmICyhoZDlesAvc9Hu24O45zCe7btCClbYFtdIFktN2rxq1DVexehyUxIBhyGmia5oocwNeMW2at axmcfS5w==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1sz41o-0000000ErxO-1zvI; Fri, 11 Oct 2024 01:01:12 +0000 From: Luis Chamberlain To: kdevops@lists.linux.dev, ross@kallisti.us Cc: mcgrof@kernel.org Subject: [PATCH kdevops 3/4] guestfs: fix trixie bringup Date: Thu, 10 Oct 2024 18:01:10 -0700 Message-ID: <20241011010111.3543993-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241011010111.3543993-1-mcgrof@kernel.org> References: <20241011010111.3543993-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Luis Chamberlain We have a series of fixups needed to the default generic debian 13 trixie image: - kdevops has support for default heuristic when debian is detected on the host, and if your host has an /etc/apt/sources.list with a hop 1 to the servers, we infer that you are using a local mirror for debian. *If* the host and guest match distributions or at least we feel confident in the upgrade process (upgrading buster to trixie on the guest) then we by default enable leveraging the host's sources.list file onto the guest so the guest can also save bandwidth. This works nicely. However trixie uses an /etc/nsswitch.conf like this: files myhostname resolve [!UNAVAIL=return] dns This will prevent using dns from finding the 1 hop server on /etc/apt/sources.list. To fix this enable dns to be used for host son trixie. - cloud-init is not used by us and so we should just stop it, otherwise we may timeout on some random clout init guess work. - setup locales for LANG=en_US.UTF-8, we can later add variability if folks want it - restart ssh as in practice I've seen issues on bringup and timeouts - Be sure to remove the distro's /etc/apt/sources.list.d/debian.sources if CONFIG_GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST is enabled (as explained above). Signed-off-by: Luis Chamberlain --- scripts/bringup_guestfs.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh index d09ae64dcaea..16bfa7a6c805 100755 --- a/scripts/bringup_guestfs.sh +++ b/scripts/bringup_guestfs.sh @@ -233,6 +233,31 @@ firstboot-command systemctl stop ssh firstboot-command DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure -p low --force openssh-server firstboot-command systemctl start ssh _EOT + # CONFIG_GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST will not work + # if etc/nsswitch.conf has a line like this: + # + # hosts: files myhostname resolve [!UNAVAIL=return] dns + # + # We need DNS to be used so virb0 will be used for a DNS request + if [[ "$CONFIG_GUESTFS_DEBIAN_TRIXIE" == "y" ]]; then + cat <<_EOT >>$cmdfile +edit /etc/nsswitch.conf:'s/^hosts:.*UNAVAIL=return.*dns/hosts: files myhostname resolve dns/' +uninstall cloud-init +write /etc/default/locale:LANG=en_US.UTF-8 +append-line /etc/default/locale:LANGUAGE=en_US:en +write /etc/locale.gen:en_US.UTF-8 UTF-8 +firstboot-command locale-gen en_US.UTF-8 +firstboot-command update-locale LANG=en_US.UTF-8 +firstboot-command DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true dpkg-reconfigure -p low --force locales +firstboot-command systemctl stop ssh +firstboot-command systemctl start ssh +_EOT + if [[ "$CONFIG_GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST" == "y" ]]; then + cat <<_EOT >>$cmdfile +delete /etc/apt/sources.list.d/debian.sources +_EOT + fi + fi } USE_SUDO=""