[Debian-ha-maintainers] Bug#1082433: base-files: is /var/lock a directory or a symlink?

Santiago Vila sanvila at debian.org
Wed Feb 11 01:12:55 GMT 2026


(Adding Chris to Cc as he was involved in the usr-merge change
that happened in base-files 13.3).

On Sat, Sep 21, 2024 at 09:04:02AM +0200, Helmut Grohne wrote:

> On Sat, Sep 21, 2024 at 01:19:39AM +0200, Guillem Jover wrote:
> >   $ dpkg-deb -c base-files_13.5_amd64.deb | grep var/lock
> >   drwxrwxrwt root/root         0 2024-08-04 23:30 ./var/lock/
> > 
> > In this case I think the best option is to simply stop shipping the
> > /var/lock directory.
> 
> This hints at another problem. Whilst base-files' data.tar lists
> /var/lock as a directory, its postinst turns it into a symbolic link
> pointing at /run/lock. If dpkg were to verify that /var/lock indeed is a
> directory it would also issue a warning or error. I think this
> inconsistency within base-files should also be solved in addition to the
> one in drbd-utils.

Sorry for the late reply.

I agree that this is an inconsistency and that we should try to fix it,
but I don't really know how much risky the solution will be.

The attached patch seems to work for me, I tested it by doing this:

dpkg -i base-files_14.0_amd64.deb

and nothing bad seems to happen. After the new base-files is installed,
both /var/lock and /var/run are symlinks, while they still belong to
base-files, and the postinst does not do any dirty trick anymore.

I have not tested if debootstrap handles this ok or not.
(can anybody help me to test that?)

And I also don't know if it's ok to do this change in base-files
before we fix drbd-utils, or maybe we should fix drbd-utils first.

If we make /var/lock to be a symlink which belongs to base-files and
drbd-utils is fixed later so that it does not contain /var/lock
anymore, what will happen with /var/lock?

(Maybe the fact that those symlinks are still part of base-files
is what will allow drbd-utils to drop the directory without
creating a mess)

[ Note: I also plan to make those symlinks relative once that Debian
  Policy editors allow me to do so, and maybe I will do that in the
  same upload, but that's a completely orthogonal thing so I'm
  ignoring that for the purposes of discussing this bug ]

Thanks.
-------------- next part --------------
commit 840a571d7fe163d3c76f6236563b6f9e8bd7a9cb
Author: Santiago Vila <sanvila at debian.org>
Date:   Tue Feb 10 22:29:00 2026 +0100

    Handle /var/run and /var/lock in a more orthodox way. Closes: #1082498.
    
    They are now symlinks, still part of base-files.deb.
    
    Previously, they were directories, and postinst changed them to
    symlinks on the fly the very first time base-files was installed
    (via debootstrap). That was the non-orthodox thing.

diff --git a/debian/1777-dirs b/debian/1777-dirs
index c92add2..12719a5 100644
--- a/debian/1777-dirs
+++ b/debian/1777-dirs
@@ -1,3 +1,2 @@
 tmp
-var/lock
 var/tmp
diff --git a/debian/base-files.dirs b/debian/base-files.dirs
index d0769e4..ae94c36 100644
--- a/debian/base-files.dirs
+++ b/debian/base-files.dirs
@@ -31,8 +31,6 @@ var/lib
 var/lib/dpkg
 var/lib/misc
 var/local
-var/lock
 var/log
-var/run
 var/spool
 var/tmp
diff --git a/debian/base-files.links b/debian/base-files.links
index 3dd0249..24044a7 100644
--- a/debian/base-files.links
+++ b/debian/base-files.links
@@ -2,3 +2,5 @@ usr/share/doc/base-files/README    usr/share/doc/base-files/FAQ
 usr/share/common-licenses/GFDL-1.3 usr/share/common-licenses/GFDL
 usr/share/common-licenses/LGPL-3   usr/share/common-licenses/LGPL
 usr/share/common-licenses/GPL-3    usr/share/common-licenses/GPL
+run                                var/run
+run/lock                           var/lock
diff --git a/debian/postinst b/debian/postinst
index e1ad3a4..5ba383f 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -74,8 +74,6 @@ if [ "$1" = "configure" ] && [ "$2" = "" ]; then
     ln -s ../mail "$DPKG_ROOT/var/spool/mail"
   fi
   install_directory run/lock 1777 root
-  migrate_directory /var/run /run
-  migrate_directory /var/lock /run/lock
 
   install_local_dir /usr/local
   install_local_dir /usr/local/share


More information about the Debian-ha-maintainers mailing list