[debian-mysql] Bug#1023778: mysql-server-8.0: fails to restart on upgrade with libpam-tmpdir

brian m. carlson sandals at crustytoothpaste.net
Thu Nov 10 00:54:34 GMT 2022


Package: mysql-server-8.0
Version: 8.0.30-1+b2
Severity: normal

On my systems, I use libpam-tmpdir, which provides each user with a
private temporary directory owned and accessible only by them under
/tmp/user/UID (e.g., /tmp/user/1000).  PAM sets the TMPDIR variable to
this value upon creating a session.

When I upgrade mysql-server-8.0, it is obviously as root, so TMPDIR is
set to /tmp/user/0.  This value does not work since MySQL doesn't run as
root, and so MySQL fails to start after upgrade in such a configuration,
like so:

  2022-09-28T19:02:43.113663Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-1) starting as process 134423
  2022-09-28T19:02:43.156068Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
  2022-09-28T19:02:43.156091Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
  mysqld: Can't create/write to file '/tmp/user/0/ibafhFAQ' (OS errno 13 - Permission denied)
  2022-09-28T19:02:44.224787Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file inside "/tmp/user/0"; errno: 13
  2022-09-28T19:02:44.224823Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
  2022-09-28T19:02:44.224856Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
  2022-09-28T19:02:44.225102Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
  2022-09-28T19:02:44.225217Z 0 [ERROR] [MY-010119] [Server] Aborting
  2022-09-28T19:02:44.226017Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-1)  (Debian).
  2022-10-17T13:26:08.726136Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-1+b1) starting as process 36399
  2022-10-17T13:26:08.755895Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
  mysqld: Can't create/write to file '/tmp/user/0/ibJujAnM' (OS errno 13 - Permission denied)
  2022-10-17T13:26:09.299586Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file inside "/tmp/user/0"; errno: 13
  2022-10-17T13:26:09.299605Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
  2022-10-17T13:26:09.299625Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
  2022-10-17T13:26:09.299737Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
  2022-10-17T13:26:09.299751Z 0 [ERROR] [MY-010119] [Server] Aborting
  2022-10-17T13:26:09.300393Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-1+b1)  (Debian).
  2022-11-09T21:40:40.722163Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-1+b2) starting as process 110969
  2022-11-09T21:40:40.731948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
  mysqld: Can't create/write to file '/tmp/user/0/iby1UOtJ' (OS errno 13 - Permission denied)
  2022-11-09T21:40:41.516120Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file inside "/tmp/user/0"; errno: 13
  2022-11-09T21:40:41.516155Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
  2022-11-09T21:40:41.516191Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
  2022-11-09T21:40:41.516337Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
  2022-11-09T21:40:41.516362Z 0 [ERROR] [MY-010119] [Server] Aborting
  2022-11-09T21:40:41.517553Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30-1+b2)  (Debian).

It's probably appropriate to sanitize the environment somewhat before
starting MySQL to avoid this problem.  For example, in my testing, `sudo
env -u TMPDIR dpkg-reconfigure mysql-server-8.0` causes the server to
restart properly, but there may be other environment variables that may
result in undesired behaviour.

Note that all of this is from another system, so none of the usual
information is relevant below.

-- System Information:
Debian Release: bookworm/sid
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.0.0-2-amd64 (SMP w/20 CPU threads; PREEMPT)
Kernel taint flags: TAINT_USER, TAINT_WARN
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mysql-server-8.0 depends on:
ii  adduser                    3.129
ii  debconf [debconf-2.0]      1.5.79
pn  mysql-client-8.0           <none>
ii  mysql-common               5.8+1.0.8
pn  mysql-server-core-8.0      <none>
ii  passwd                     1:4.12.3+dfsg1-3
ii  perl                       5.36.0-4
ii  psmisc                     23.5-3
ii  sysvinit-utils [lsb-base]  3.05-6

Versions of packages mysql-server-8.0 recommends:
pn  libhtml-template-perl  <none>
pn  mecab-ipadic-utf8      <none>

Versions of packages mysql-server-8.0 suggests:
ii  bsd-mailx [mailx]  8.1.2-0.20220412cvs-1
pn  tinyca             <none>

-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-mysql-maint/attachments/20221110/a110fdd3/attachment.sig>


More information about the pkg-mysql-maint mailing list