diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index 9d233f4f497cbfba3a3bbc395181ed9e61d8d8bd..3e51713078830ddb427216757f37e22dfdeb7855 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -1,5 +1,16 @@
 $Id$
 
+2022-02-18  Christian Franke  <franke@computer.org>
+
+	Allow to specify a separate install location for drivedb.h.
+	This prevents that update-smart-drivedb overwrites the package
+	installed file (Debian Bug 976696, Ubuntu Bug 1893202).
+
+	configure.ac, Makefile.am: Add '--with-drivedbinstdir' option.
+	update-smart-drivedb.in: Add '--install' option.
+	update-smart-drivedb.8.in: Document new functionality.
+	smartctl.8.in, smartd.8.in: Adjust path names.
+
 2022-02-16  Douglas Gilbert  <dgilbert@interlog.com>
 
 	smartctl.cpp: add new --log=tapedevstat to print out SCSI
diff --git a/smartmontools/Makefile.am b/smartmontools/Makefile.am
index b87b15dcd5da333966b75a4ae54483735814d4b2..66191c0a4987c87f018f5af6f8851512326e4fcf 100644
--- a/smartmontools/Makefile.am
+++ b/smartmontools/Makefile.am
@@ -508,7 +508,7 @@ endif
 
 
 if ENABLE_DRIVEDB
-drivedb_DATA = drivedb.h
+drivedbinst_DATA = drivedb.h
 endif
 
 update-smart-drivedb: update-smart-drivedb.in config.status
@@ -591,7 +591,7 @@ smartd.service: smartd.service.in Makefile
 # Create empty directories if configured.
 # Default install rules no longer create empty directories since automake 1.11.
 installdirs-local:
-	@for d in '$(smartdplugindir)' '$(savestatesdir)' '$(attributelogdir)'; do \
+	@for d in '$(smartdplugindir)' '$(drivedbdir)' '$(savestatesdir)' '$(attributelogdir)'; do \
 	  test -n "$$d" || continue; \
 	  echo " $(MKDIR_P) '$(DESTDIR)$$d'"; \
 	  $(MKDIR_P) "$(DESTDIR)$$d" || exit 1; \
@@ -619,10 +619,16 @@ MAN_FILTER = { \
         -e 's|/usr/bin/mail|/usr/bin/$(os_mailer)|g' \
         -e 's|RELEASE_6_0_DRIVEDB|$(DRIVEDB_BRANCH)|g' | \
     if test -n '$(drivedbdir)'; then \
-      sed 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g' ; \
+      sed -e 's|/usr/local/share/smartmontools/drivedb\.h|$(drivedbinstdir)/drivedb.h|g' \
+          -e 's|/usr/local/var/lib/smartmontools/drivedb\.h|$(drivedbdir)/drivedb.h|g'  ; \
     else \
       sed '/^\.\\" %IF ENABLE_DRIVEDB/,/^\.\\" %ENDIF ENABLE_DRIVEDB/ s,^,.\\"\# ,' ; \
     fi | \
+    if test '$(drivedbinstdir)' != '$(drivedbdir)'; then \
+      cat; \
+    else \
+      sed '/^\.\\" %IF ENABLE_DB_INSTALL/,/^\.\\" %ENDIF ENABLE_DB_INSTALL/ s,^,.\\"\# ,' ; \
+    fi | \
     if test '$(with_update_smart_drivedb)' = 'yes'; then \
       cat; \
     else \
diff --git a/smartmontools/configure.ac b/smartmontools/configure.ac
index 12d9b8c54e97fec798fa06cc0810d91d9dc04218..f6d58727b87d1bdac92bbc0daeba15b49fcfb203 100644
--- a/smartmontools/configure.ac
+++ b/smartmontools/configure.ac
@@ -187,9 +187,23 @@ AC_ARG_WITH(exampledir,
 AC_SUBST(exampledir)
 
 drivedbdir='${datadir}/${PACKAGE}'
+drivedbinstdir=
+AC_ARG_WITH(drivedbinstdir,
+  [AS_HELP_STRING([--with-drivedbinstdir@<:@=DIR|yes|no@:>@],
+    [Optional separate install location of drive database file [no] (yes=DATADIR/smartmontools)])],
+  [ case "$withval" in
+      no) ;;
+      yes) drivedbinstdir=$drivedbdir; drivedbdir='${localstatedir}/lib/${PACKAGE}' ;;
+      *)   drivedbinstdir=$withval;    drivedbdir='${localstatedir}/lib/${PACKAGE}' ;;
+    esac
+  ])
+
 AC_ARG_WITH(drivedbdir,
-  [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
+  [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@],
+    [Location of drive database file [DATADIR/smartmontools or LOCALSTATEDIR/lib/smartmontools if separate INSTDIR]])],
   [case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac])
+test -n "$drivedbinstdir" || drivedbinstdir=$drivedbdir
+AC_SUBST(drivedbinstdir)
 AC_SUBST(drivedbdir)
 AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
 
@@ -893,6 +907,9 @@ info=`
       echo "doc file install path:  \`eval eval eval echo $docdir\`"
       echo "examples install path:  \`eval eval eval echo $exampledir\`"
       if test -n "$drivedbdir"; then
+        if test "$drivedbinstdir" != "$drivedbdir"; then
+          echo "installed drivedb file: \`eval eval eval echo $drivedbinstdir\`/drivedb.h"
+        fi
         echo "drive database file:    \`eval eval eval echo $drivedbdir\`/drivedb.h"
         if test "$with_update_smart_drivedb" = "yes"; then
           echo "database update script: \`eval eval eval echo $sbindir\`/update-smart-drivedb"
diff --git a/smartmontools/smartctl.8.in b/smartmontools/smartctl.8.in
index 4ecb668a498887524ff219fc65244f530e9c7f7c..21b95ae1e0a7f199beca672a241efb764bf515cf 100644
--- a/smartmontools/smartctl.8.in
+++ b/smartmontools/smartctl.8.in
@@ -1,6 +1,6 @@
 .ig
 Copyright (C) 2002-10 Bruce Allen
-Copyright (C) 2004-21 Christian Franke
+Copyright (C) 2004-22 Christian Franke
 
 SPDX-License-Identifier: GPL-2.0-or-later
 
@@ -1933,7 +1933,7 @@ if this option is not specified.
 .Sp
 If
 .\" %IF NOT OS Windows
-\fB/usr/local/share/smartmontools/drivedb.h\fP
+\fB/usr/local/var/lib/smartmontools/drivedb.h\fP
 .\" %ENDIF NOT OS Windows
 .\" %IF OS ALL
 (Windows: \fBEXEDIR/drivedb.h\fP)
@@ -2431,7 +2431,7 @@ done
 full path of this executable.
 .\" %IF ENABLE_DRIVEDB
 .TP
-.B /usr/local/share/smartmontools/drivedb.h
+.B /usr/local/var/lib/smartmontools/drivedb.h
 drive database (see \*(Aq\-B\*(Aq option).
 .\" %ENDIF ENABLE_DRIVEDB
 .TP
diff --git a/smartmontools/smartd.8.in b/smartmontools/smartd.8.in
index 95250af4a02ff68a9fe29d62da38ff12708af4af..ff9585dd4befbc31cbce385386be73b463e70c64 100644
--- a/smartmontools/smartd.8.in
+++ b/smartmontools/smartd.8.in
@@ -832,7 +832,7 @@ plugin directory for smartd warning script (see \*(Aq\-m\*(Aq directive on
 .\" %ENDIF ENABLE_SMARTDPLUGINDIR
 .\" %IF ENABLE_DRIVEDB
 .TP
-.B /usr/local/share/smartmontools/drivedb.h
+.B /usr/local/var/lib/smartmontools/drivedb.h
 drive database (see \*(Aq\-B\*(Aq option).
 .\" %ENDIF ENABLE_DRIVEDB
 .TP
diff --git a/smartmontools/update-smart-drivedb.8.in b/smartmontools/update-smart-drivedb.8.in
index 21cea294fde9402f18b785d610806debb265cf58..f5b82f4fd0cb2ec9d661b5658410091dfc6681a5 100644
--- a/smartmontools/update-smart-drivedb.8.in
+++ b/smartmontools/update-smart-drivedb.8.in
@@ -1,6 +1,6 @@
 .ig
 Copyright (C) 2013 Hannes von Haugwitz <hannes@vonhaugwitz.com>
-Copyright (C) 2014-21 Christian Franke
+Copyright (C) 2014-22 Christian Franke
 
 SPDX-License-Identifier: GPL-2.0-or-later
 
@@ -41,7 +41,7 @@ update-smart-drivedb \- update smartmontools drive database
 .\" %ENDIF NOT OS ALL
 .B update-smart-drivedb
 updates
-.B /usr/local/share/smartmontools/drivedb.h
+.B /usr/local/var/lib/smartmontools/drivedb.h
 or
 .I DESTFILE
 from branches/RELEASE_6_0_DRIVEDB of smartmontools SVN repository.
@@ -84,7 +84,7 @@ The form \*(Aq\-s \-\*(Aq disables the syntax check.
 The default is
 .BR /usr/local/sbin/smartctl .
 .TP
-.B \-t [/DIR/]TOOL, \-\-tool [/DIR/]TOOL
+.B \-t [DIR/]TOOL, \-\-tool [DIR/]TOOL
 Use TOOL for download.
 TOOL is one of:
 .I curl wget lynx
@@ -134,6 +134,15 @@ exist unless \*(Aq\-\-no\-verify\*(Aq is also specified.
 Copy from local FILE.
 A valid OpenPGP/GPG signature \*(AqFILE.raw.asc\*(Aq must also exist
 unless \*(Aq\-\-no\-verify\*(Aq is also specified.
+.\" %IF ENABLE_DB_INSTALL
+.TP
+.B \-\-install
+[NEW EXPERIMENTAL UPDATE-SMART-DRIVEDB FEATURE]
+Copy from originally installed drive database file.
+This is the same as:
+.br
+\*(Aq\-\-no\-verify \-\-file /usr/local/share/smartmontools/drivedb.h\*(Aq
+.\" %ENDIF ENABLE_DB_INSTALL
 .TP
 .B \-\-trunk
 Download from SVN trunk.
@@ -186,14 +195,14 @@ Print help text.
 Regular update:
 .Vb 2
 # update-smart-drivedb
-/usr/local/share/smartmontools/drivedb.h 7.2/5225 updated to 7.2/5237
+/usr/local/var/lib/smartmontools/drivedb.h 7.2/5225 updated to 7.2/5237
 .Ve
 .PP
 Revert to previous version:
 .Vb 2
 # update-smart-drivedb --force \e
-  --file /usr/local/share/smartmontools/drivedb.h.old
-/usr/local/share/smartmontools/drivedb.h 7.2/5237 downgraded to 7.2/5225
+  --file /usr/local/var/lib/smartmontools/drivedb.h.old
+/usr/local/var/lib/smartmontools/drivedb.h 7.2/5237 downgraded to 7.2/5225
 .Ve
 .PP
 Download the database from SVN trunk to current directory:
@@ -214,23 +223,28 @@ full path of this script.
 .TP
 .B /usr/local/sbin/smartctl
 used to check syntax of new drive database.
+.\" %IF ENABLE_DB_INSTALL
 .TP
 .B /usr/local/share/smartmontools/drivedb.h
+originally installed drive database.
+.\" %ENDIF ENABLE_DB_INSTALL
+.TP
+.B /usr/local/var/lib/smartmontools/drivedb.h
 current drive database.
 .TP
-.B /usr/local/share/smartmontools/drivedb.h.raw
+.B /usr/local/var/lib/smartmontools/drivedb.h.raw
 current drive database with unexpanded SVN Id string.
 .TP
-.B /usr/local/share/smartmontools/drivedb.h.raw.asc
+.B /usr/local/var/lib/smartmontools/drivedb.h.raw.asc
 signature file.
 .TP
-.B /usr/local/share/smartmontools/drivedb.h.*old*
+.B /usr/local/var/lib/smartmontools/drivedb.h.*old*
 previous files.
 .TP
-.B /usr/local/share/smartmontools/drivedb.h.*error*
+.B /usr/local/var/lib/smartmontools/drivedb.h.*error*
 new files if rejected due to errors.
 .TP
-.B /usr/local/share/smartmontools/drivedb.h.lastcheck
+.B /usr/local/var/lib/smartmontools/drivedb.h.lastcheck
 empty file created if downloaded file was identical.
 .Sp
 .SH AUTHORS
diff --git a/smartmontools/update-smart-drivedb.in b/smartmontools/update-smart-drivedb.in
index f70650b50dcd8102d2cd05014f4c8a143ba33029..c155ad474f0c9f2b875f1d312491d0cf64bc0304 100644
--- a/smartmontools/update-smart-drivedb.in
+++ b/smartmontools/update-smart-drivedb.in
@@ -22,6 +22,8 @@ exec_prefix="@exec_prefix@"
 sbindir="@sbindir@"
 datarootdir="@datarootdir@"
 datadir="@datadir@"
+localstatedir="@localstatedir@"
+drivedbinstdir="@drivedbinstdir@"
 drivedbdir="@drivedbdir@"
 
 # Download tools
@@ -57,7 +59,7 @@ Usage: $myname [OPTIONS] [DESTFILE]
   -s, --smartctl SMARTCTL
                     Use SMARTCTL for syntax check ('-s -' to disable)
                     [default: $default_smartctl]
-  -t, --tool [/DIR/]TOOL
+  -t, --tool [DIR/]TOOL
                     Use TOOL for download: $os_dltools
                     [default: first one found in $pathinfo]
   -u, --url-of LOCATION
@@ -69,6 +71,13 @@ Usage: $myname [OPTIONS] [DESTFILE]
                       trac (Trac code browser)
   --url URL         Download from URL
   --file FILE       Copy from local FILE
+EOF
+  test "$drivedbinstdir" = "$drivedbdir" || cat <<EOF
+  --install         Copy from originally installed drive database file
+                    This is the same as:
+                    '--no-verify --file $drivedbinstdir/drivedb.h'
+EOF
+  cat <<EOF
   --trunk           Download from SVN trunk (requires '--no-verify')
   --branch X.Y      Download from branches/RELEASE_X_Y_DRIVEDB
   --cacert FILE     Use CA certificates from FILE to verify the peer
@@ -603,6 +612,12 @@ while true; do case $1 in
     check_optarg "$@"; shift
     file=$1 ;;
 
+  --install)
+    test "$drivedbinstdir" != "$drivedbdir" \
+    || error "'$1' is not supported in this configuration"
+    file="$drivedbinstdir/drivedb.h"
+    no_verify=t ;;
+
   --dryrun)
     dryrun=t ;;