I'll give this a whirlwind.  Thank you for the response!
Respectfully, 
Lucas N

Yahoo Mail: Search, Organize, Conquer 
 
  On Fri, Jul 4, 2025 at 1:55 AM, Bryce Harrington<[email protected]> 
wrote:   The clamav-base.postinst.in includes code to create the clamav user, 
but
this only runs on fresh installations (i.e. when the second arg to the
postinst is blank).  If somehow you had clamav installed but the clamav
user and/or group had been removed (or had never been properly set up to
begin with), then the code to create the user is skipped.  The
subsequent chown then fails, obviously.

My proposed fix would be:


--- a/debian/clamav-base.postinst
+++ b/debian/clamav-base.postinst
@@ -23,20 +23,18 @@
  configure)
  
  DATABASEDIR=/var/lib/clamav
  LOGDIR=/var/log/clamav
  user=clamav
 
  # Set up the clamav user on new install
-  if [ -z "$2" ]; then
-    if ! getent passwd clamav >/dev/null; then
-        adduser --system --no-create-home --quiet \
-            --disabled-password --disabled-login \
-            --shell /bin/false --group --home /var/lib/clamav clamav
-    fi
-    if [ -f /etc/aliases ] || [ -L /etc/aliases ]; then
-      if ! grep -qi "^clamav" /etc/aliases; then
-        echo "clamav: root" >> /etc/aliases
-        newal=`which newaliases || true`
-        if [ -n "$newal" ] && [ -x "$newal" ]; then
-          $newal || true
-        fi
-      fi
-    fi
-  fi
+ if ! getent passwd clamav >/dev/null; then
+  adduser --system --no-create-home --quiet \
+      --disabled-password --disabled-login \
+      --shell /bin/false --group --home /var/lib/clamav clamav
+ fi
+ if [ -f /etc/aliases ] || [ -L /etc/aliases ]; then
+  if ! grep -qi "^clamav" /etc/aliases; then
+    echo "clamav: root" >> /etc/aliases
+    newal=`which newaliases || true`
+    if [ -n "$newal" ] && [ -x "$newal" ]; then
+      $newal || true
+    fi
+  fi
+ fi
  chown $user:$user $DATABASEDIR
  chown $user:$user $LOGDIR
  ;;

This patch will move the entire user creation and aliases setup block
outside the if [ -z "$2" ] conditional, ensuring that the clamav user
and group are always created if missing, regardless of whether it's a
first install or an upgrade.  I think this should fix the issue.

** Tags added: server-todo

-- 
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/2115832

Title:
  package clamav-base 1.4.3+dfsg-0ubuntu0.24.04.1 failed to
  install/upgrade: chown: invalid user: ‘clamav:clamav’

Status in clamav package in Ubuntu:
  New

Bug description:
  package clamav-base 1.4.3+dfsg-0ubuntu0.24.04.1 failed to
  install/upgrade: installed clamav-base package post-installation
  script subprocess returned error exit status 1

  Error message is:
  chown: invalid user: ‘clamav:clamav’

  ProblemType: Package
  DistroRelease: Ubuntu 24.04
  Package: clamav-base 1.4.3+dfsg-0ubuntu0.24.04.1
  ProcVersionSignature: Ubuntu 6.11.0-29.29~24.04.1-generic 6.11.11
  Uname: Linux 6.11.0-29-generic x86_64
  NonfreeKernelModules: nvidia_modeset nvidia
  ApportVersion: 2.28.1-0ubuntu3.7
  Architecture: amd64
  CasperMD5CheckResult: pass
  Date: Wed Jul  2 18:03:28 2025
  ErrorMessage: installed clamav-base package post-installation script 
subprocess returned error exit status 1
  InstallationDate: Installed on 2024-11-23 (221 days ago)
  InstallationMedia: Ubuntu 24.04.1 LTS "Noble Numbat" - Release amd64 
(20240827.1)
  PackageArchitecture: all
  ProcCmdline: BOOT_IMAGE=/boot/vmlinuz-6.11.0-29-generic 
root=UUID=8ebabfdc-452c-4287-ba52-6a9f01f131e3 ro quiet splash vt.handoff=7
  Python3Details: /usr/bin/python3.12, Python 3.12.3, python3-minimal, 
3.12.3-0ubuntu2
  PythonDetails: N/A
  RelatedPackageVersions:
   dpkg 1.22.6ubuntu6.1
   apt  2.8.3
  SourcePackage: clamav
  Title: package clamav-base 1.4.3+dfsg-0ubuntu0.24.04.1 failed to 
install/upgrade: installed clamav-base package post-installation script 
subprocess returned error exit status 1
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/2115832/+subscriptions

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2115832

Title:
  package clamav-base 1.4.3+dfsg-0ubuntu0.24.04.1 failed to
  install/upgrade: chown: invalid user: ‘clamav:clamav’

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/2115832/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to