This should be a bug report, and it just started happening yesterday, but I’m not sure where to file bugs like this…
After adding the repository to apt
:
ubuntu@influx:~$ sudo apt install influxdb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
influxdb
0 upgraded, 1 newly installed, 0 to remove and 28 not upgraded.
Need to get 26.6 MB of archives.
After this operation, 115 MB of additional disk space will be used.
Get:1 https://repos.influxdata.com/debian stable/main amd64 influxdb amd64 1.11.8-1 [26.6 MB]
Fetched 26.6 MB in 3s (8047 kB/s)
Selecting previously unselected package influxdb.
(Reading database ... 64438 files and directories currently installed.)
Preparing to unpack .../influxdb_1.11.8-1_amd64.deb ...
useradd: invalid user ID '-m'
dpkg: error processing archive /var/cache/apt/archives/influxdb_1.11.8-1_amd64.deb (--unpack):
new influxdb package pre-installation script subprocess returned error exit status 3
Errors were encountered while processing:
/var/cache/apt/archives/influxdb_1.11.8-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
The problem stems from a bad useradd
command in the preinst
script:
#!/bin/bash
set -e
LOG_DIR=/var/log/influxdb
DATA_DIR=/var/lib/influxdb
if ! id influxdb &>/dev/null; then
useradd --system -u -m influxdb -s /bin/false -d "${data_dir}"
fi
Two problems:
- The
-u
should be a-U
.-u
expects a UID. - The
-d "${data_dir}"
should be-d "${DATA_DIR}"
. The lowercase variable doesn’t exist.
A workaround is to run the correct useradd
command before installing the package.
sudo useradd --system -U -m influxdb -s /bin/false -d /var/lib/influxdb