From nobody Sun Apr 14 17:46:50 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VHd625qFcz5Glbm; Sun, 14 Apr 2024 17:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VHd625Gjwz4YtG; Sun, 14 Apr 2024 17:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713116810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qzOYXtTX1RYvwLi/B51KcrrD3ajm7ZGtvDAZ2fG2Jfk=; b=ihUUKWNaxjPO67ksAKygssBHGXhKL+WtqSvaodSwNSdE7OMhudT+l5pbNJ3ByKKeGMCviZ 4oO8ediZ07De0k4mMXwF6vMTuNR+meV6e8kirELQhL/wWcKFSd41sE+YkkLVNwcWVaHmlH qfpH+qN8Ov/KWPtV2T//5Up8AhaTYgD4qQG4zbpwtoIIP6ERw9O+0E4/LWuciKkZRlgyDz /iNc9Y24ejbxj4Dk2bYvPvcBPujDn/cW9+uH+IiBgzmtAcFVa0n2a8abL3OAg7Z5blIgx7 GquY5vbqWLAQl4kzURuCjiz1Nbo43AM/dUYPfq6cg/2fhV9EOICNKySFCVVPWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713116810; a=rsa-sha256; cv=none; b=F5n7sHVAf0xAyT9ZKWskXNwqhRuyETRrfyQXHZ2ecM2XI7F+bJYaPmY/gyqCLcudwu+Sjq ZKRLcOpAPbCL5HQPA+os4j27mwd6J2xDabhKiDBQC+WppZU3lb7rYtwdknY+0eLaeA1i3O SBaS0fndm5+wzVuonxizajGPjCPFWVfzEbjkZFSZLvSry39g0Vq4NNR4YwPs//H9Zo7nAh ffyhMkxCcI9WFeWAaTbAJKLJ9CD6r6IGSko4SUSH1KSzROzps2rNw+rxs+Z19eptWHgBkd Lrkbybjk4uN88E3eKaimrxqKNXvD0vytInQiIqyVb3hcqej4nCq+n2yIN8LFuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713116810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qzOYXtTX1RYvwLi/B51KcrrD3ajm7ZGtvDAZ2fG2Jfk=; b=oX81fRCd4LoOElfB6O+tkB3yZNnWMD5+pvGxJx8mID9B1y+OenL09zib4OEq7SsUvriCoV KtS/c6OXQ2mtq0udnGXzwSqsD4/tg3+eExQbC6m0wEra/08KvfTMovS254pxgS/0/6gi9B WX0QH70AymRQx7A90zsVIUDAtmmgGcxgiAac+d8cY3u/j7ZqqyjV7CgEy1iJF0tZgwb+Rg T5cBrdY4no4KCfeVaAlLiw4GDngmpKqFnSObRu2PO6GUJzOuZuZPpdnDXOV4a4ok+0+zlC Bc8PyG+j/Iwk3+GXN4QtJ8O0epALlzkzgkJa3abjgZ5mSWxLwrBiRQrbIrCZ9Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VHd624l1DzQNd; Sun, 14 Apr 2024 17:46:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43EHkoYg002930; Sun, 14 Apr 2024 17:46:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43EHkobl002927; Sun, 14 Apr 2024 17:46:50 GMT (envelope-from git) Date: Sun, 14 Apr 2024 17:46:50 GMT Message-Id: <202404141746.43EHkobl002927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando =?utf-8?Q?Apestegu=C3=ADa?= Subject: git: bc0c6c9cf3a9 - main - freebsd-update: Add check for kernel modules List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17 Auto-Submitted: auto-generated The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/src/commit/?id=bc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17 commit bc0c6c9cf3a9f9a54dbdd92dd8f1f65ff8092d17 Author: Fernando ApesteguĂ­a AuthorDate: 2023-04-19 16:08:47 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2024-04-14 17:46:23 +0000 freebsd-update: Add check for kernel modules People get confused when some software (VirtualBox, etc) does not work as expected (or at all) after a major upgrade. We have a nice way to deal with this when using sources, namely including PORTS_MODULES in /etc/make.conf, but we lack something similar for binary updates. This patch retrieves a list of kernel modules installed from packages and advises the user to recompile from ports to avoid problems. Approved by: zlei@ Differential Revision: https://reviews.freebsd.org/D39695 --- usr.sbin/freebsd-update/freebsd-update.sh | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 4a6a8d78330b..d1cd46963a6c 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -655,6 +655,63 @@ fetch_setup_verboselevel () { esac } +# Check if there are any kernel modules installed from ports. +# In that case warn the user that a rebuild from ports (i.e. not from +# packages) might need necessary for the modules to work in the new release. +upgrade_check_kmod_ports() { + local mod_name + local modules + local pattern + local pkg_name + local port_name + local report + local w + + if ! command -v pkg >/dev/null; then + echo "Skipping kernel modules check. pkg(8) not present." + return + fi + + # Most modules are in /boot/modules but we should actually look + # in every path configured in module_path + search_files="/boot/defaults/loader.conf /boot/loader.conf" + pattern=$(grep -shE '^module_path=' ${search_files} | + tail -1 | + cut -f2 -d\" | + tr ";" "|") + + if [ -z "${pattern}" ]; then + # Not having module_path in loader.conf is probably an error. + # Check at least the most common path + pattern="/boot/modules" + fi + + # Check the pkg database for modules installed in those directories + modules=$(pkg query '%Fp' | grep -E "${pattern}") + + if [ -z "${modules}" ]; then + return + fi + + echo -e "\n" + echo "The following modules have been installed from packages." + echo "As a consequence they might not work when performing a major or minor upgrade." + echo -e "It is advised to rebuild these ports:\n" + + + report="Module Package Port\n------ ------- ----\n" + for module in ${modules}; do + w=$(pkg which "${module}") + mod_name=$(echo "${w}" | awk '{print $1;}') + pkg_name=$(echo "${w}" | awk '{print $6;}') + port_name=$(pkg info -o "${pkg_name}" | awk '{print $2;}') + report="${report}${mod_name} ${pkg_name} ${port_name}\n" + done + + echo -e "${report}" | column -t + echo -e "\n" +} + # Perform sanity checks and set some final parameters # in preparation for fetching files. Figure out which # set of updates should be downloaded: If the user is @@ -3466,6 +3523,7 @@ cmd_cron () { cmd_upgrade () { finalize_components_config ${COMPONENTS} upgrade_check_params + upgrade_check_kmod_ports upgrade_run || exit 1 }