Opened 3 years ago

Closed 3 years ago

#2280 closed defect (invalid)

nginx: [emerg] mkdir() "/var/tmp/nginx/body" failed (2: No such file or directory)

Reported by: delleceste@… Owned by:
Priority: major Milestone:
Component: documentation Version: 1.19.x
Keywords: Cc:
uname -a: Linux woody 5.14.16-arch1-1 #1 SMP PREEMPT Tue, 02 Nov 2021 22:22:59 +0000 x86_64 GNU/Linux
Arch Linux
nginx -V: nginx version: nginx/1.21.4
built by gcc 11.1.0 (GCC)
built with OpenSSL 1.1.1l 24 Aug 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx-1.21.1 --conf-path=/etc/nginx --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-log-path=/var/log/nginx/http.log --http-client-body-temp-path=/var/tmp/nginx/body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --add-dynamic-module=/home/giacomo/devel/nchan --with-http_ssl_module --with-debug

Description

After configuring and building nginx 1.21.1 with the following configure options:

./configure --prefix=/usr/local/nginx-1.21.1 --conf-path=/etc/nginx --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-log-path=/var/log/nginx/http.log --http-client-body-temp-path=/var/tmp/nginx/body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --add-dynamic-module=/home/giacomo/devel/nchan --with-http_ssl_module --with-debug

=================================================================

$ cat /etc/systemd/system/nginx.service

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx-1.21.1/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/usr/local/nginx-1.21.1/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

===================== end .service ======================

$ sudo systemctl start nginx

[giacomo@woody nginx-1.21.4]$ sudo systemctl status nginx
× nginx.service - The NGINX HTTP and reverse proxy server

Loaded: loaded (/etc/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2021-11-11 14:43:28 CET; 1s ago

Process: 25072 ExecStart=/usr/local/nginx-1.21.1/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

CPU: 15ms

Nov 11 14:43:28 woody systemd[1]: Starting The NGINX HTTP and reverse proxy server...
Nov 11 14:43:28 woody nginx[25072]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucke>
Nov 11 14:43:28 woody nginx[25072]: nginx: [emerg] mkdir() "/var/tmp/nginx/body" failed (2: No such file or directory)
Nov 11 14:43:28 woody systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Nov 11 14:43:28 woody systemd[1]: nginx.service: Failed with result 'exit-code'.
Nov 11 14:43:28 woody systemd[1]: Failed to start The NGINX HTTP and reverse proxy server.

====> nginx: [emerg] mkdir() "/var/tmp/nginx/body" failed (2: No such file or directory)

====> sudo mkdir -p /var/tmp/nginx/body [ OK ]

$ sudo systemctl start nginx [ fails with the same error ]

a) setting /var/tmp/nginx/body world readable writable executable: same error
b) removing /var/tmp/nginx/body (leaving only) /var/tmp/nginx/: same error

This blocks our development, forcing us to install nginx under /opt

Thanks.

Change History (3)

comment:1 by delleceste@…, 3 years ago

Component: no documentation, actually...

comment:2 by thresh, 3 years ago

Are you removing directories tmp as used by systemd (PrivateTmp=true) or the one in your filesystem root?

Why are you using PrivateTmp=true in the first place?

comment:3 by Maxim Dounin, 3 years ago

Resolution: invalid
Status: newclosed

Feedback timeout.

To avoid human errors, nginx does not try to create intermediate directories, and only tries to create final directories specified in the configuration. In the described case there is no /var/tmp/nginx intermediate directory (due to PrivateTmp=true), so creating the /var/tmp/nginx/body directory fails.

Note: See TracTickets for help on using tickets.