#1082498 base-files: is /var/lock a directory or a symlink?

Package:
base-files
Source:
base-files
Description:
Debian base system miscellaneous files
Submitter:
Guillem Jover
Date:
2026-02-11 01:53:01 UTC
Severity:
normal
#1082498#5
Date:
2024-09-20 23:19:39 UTC
From:
To:
Hi!

While analyzing the archive for mismatched file metadata (as part of
the preparation to add support into dpkg), thanks to Helmut gathering
the data from the archive. I noticed that this package has a mismatch
in the permissions for the /var/lock/ directory compared to the
canonical permissions from base-files. The permissions of a directory
are decided by the first package being unpacked, and subsequent
directory unpacks get currently ignored (including any change in
permissions).

  $ dpkg-deb -c base-files_13.5_amd64.deb | grep var/lock
  drwxrwxrwt root/root         0 2024-08-04 23:30 ./var/lock/
  $ dpkg-deb -c drbd-utils_9.22.0-1.1_amd64.deb | grep var/lock
  drwxr-xr-x root/root         0 2024-07-17 19:22 ./var/lock/

While in this case, it currently poses no problem as base-files is in
theory always to be installed first (assuming one does not do funny
stuff with a bootstrapping tool). This mismatch might become a problem
in the future once dpkg grows filesystem metadata tracking, and this
kind of condition becomes either a warning or an error, which could
make this package uninstallable.

In this case I think the best option is to simply stop shipping the
/var/lock directory.

Thanks,
Guillem

#1082498#10
Date:
2024-09-21 07:04:02 UTC
From:
To:
Control: clone -1 -2
Control: retitle -2 base-files: is /var/lock a directory or a symlink?
Control: severity -2 normal
Control: reassign -2 base-files

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.

Helmut

#1082498#25
Date:
2025-02-15 00:24:56 UTC
From:
To:
base-files should possibly not even ship /var/lock and /var/run because
those directories are 1) legacy paths 2) get created by systemd anyway,
using configuration files in /usr/lib/tmpfiles.d/

#1082498#30
Date:
2026-02-10 01:23:14 UTC
From:
To:
I think we should use dpkg-maintscript-helper that handle this
#1082498#35
Date:
2026-02-11 01:51:00 UTC
From:
To:
Sorry, by mistake I replied to the drbd-utils bug! (#1082433)

Replies please to *this* Bug (#1082498), which is the base-files one.

Thanks.