StreisandEffect / streisand

Streisand sets up a new server running your choice of WireGuard, OpenConnect, OpenSSH, OpenVPN, Shadowsocks, sslh, Stunnel, or a Tor bridge. It also generates custom instructions for all of these services. At the end of the run you are given an HTML file with instructions that can be shared with friends, family members, and fellow activists.
https://twitter.com/streisandvpn
Other
23.19k stars 1.99k forks source link

can not start tinyproxy error PID file. Failing. #1381

Closed rdbox closed 6 years ago

rdbox commented 6 years ago

tinyproxy error how to start?

 root@streisand-sgr:~# systemctl start tinyproxy.service
Job for tinyproxy.service failed because a configured resource limit was exceeded. See "systemctl status tinyproxy.service" and "journalctl -xe" for details.
root@streisand-sgr:~# systemctl status tinyproxy.service
● tinyproxy.service - tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
   Loaded: loaded (/etc/systemd/system/tinyproxy.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: resources) since Thu 2018-06-14 18:30:01 UTC; 2s ago
     Docs: man:tinyproxy(8)
           https://www.banu.com/tinyproxy/
  Process: 3465 ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf (code=exited, status=0/SUCCESS)

Jun 14 18:30:01 streisand-sgr systemd[1]: tinyproxy.service: Daemon never wrote its PID file. Failing.
Jun 14 18:30:01 streisand-sgr systemd[1]: Failed to start tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating syJun 14 18:30:01 streisand-sgr systemd[1]: tinyproxy.service: Unit entered failed state.
Jun 14 18:30:01 streisand-sgr systemd[1]: tinyproxy.service: Failed with result 'resources'.
nopdotcom commented 6 years ago

It should be running already. Check if you're out of disk space or RAM or something.

root@streisand-do3:~# systemctl restart tinyproxy.service
root@streisand-do3:~# systemctl status tinyproxy.service
● tinyproxy.service - tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
   Loaded: loaded (/etc/systemd/system/tinyproxy.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-06-14 20:57:12 UTC; 4s ago
     Docs: man:tinyproxy(8)
           https://www.banu.com/tinyproxy/
  Process: 17679 ExecStop=/usr/bin/killall -9 tinyproxy (code=exited, status=0/SUCCESS)
  Process: 17686 ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf (code=exited, status=0/SUCCESS)
 Main PID: 17690 (tinyproxy)
    Tasks: 11
   Memory: 3.1M
      CPU: 16ms
   CGroup: /system.slice/tinyproxy.service
           ├─17690 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17691 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17692 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17693 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17694 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17695 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17696 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17697 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17698 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           ├─17699 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf
           └─17700 /usr/sbin/tinyproxy -c /etc/tinyproxy.conf

Jun 14 20:57:12 streisand-do3 systemd[1]: Starting tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems...
Jun 14 20:57:12 streisand-do3 systemd[1]: tinyproxy.service: PID file /var/run/tinyproxy/tinyproxy.pid not readable (yet?) after start: No such file or directory
Jun 14 20:57:12 streisand-do3 systemd[1]: tinyproxy.service: Supervising process 17690 which is not our child. We'll most likely not notice when it exits.
Jun 14 20:57:12 streisand-do3 systemd[1]: Started tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems.
root@streisand-do3:~#

Check if it works on a fresh server, and if it doesn't, paste in the streisand-diagnostics.md from the fresh server and we'll go from there.

rdbox commented 6 years ago

tinyproxy support responded that it did not correctly configure the configuration with PID the error is still preserved

root@streisand-sgr:~# systemctl restart tinyproxy.service
Job for tinyproxy.service failed because a configured resource limit was exceeded. See "systemctl status tinyproxy.service" and "journalctl -xe" for details.
root@streisand-sgr:~# systemctl status tinyproxy.service
● tinyproxy.service - tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
   Loaded: loaded (/etc/systemd/system/tinyproxy.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: resources) since Fri 2018-06-15 03:45:51 UTC; 4s ago
     Docs: man:tinyproxy(8)
           https://www.banu.com/tinyproxy/
  Process: 3420 ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf (code=exited, status=0/SUCCESS)

Jun 15 03:45:51 streisand-sgr systemd[1]: tinyproxy.service: Daemon never wrote its PID file. Failing.
Jun 15 03:45:51 streisand-sgr systemd[1]: Failed to start tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating syJun 15 03:45:51 streisand-sgr systemd[1]: tinyproxy.service: Unit entered failed state.
Jun 15 03:45:51 streisand-sgr systemd[1]: tinyproxy.service: Failed with result 'resources'.
root@streisand-sgr:~# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  487M     0  487M   0% /dev
tmpfs          tmpfs     100M   11M   89M  11% /run
/dev/vda1      ext4       25G  3.4G   21G  14% /
tmpfs          tmpfs     497M     0  497M   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     497M     0  497M   0% /sys/fs/cgroup
/dev/vda15     vfat      105M  3.4M  101M   4% /boot/efi
tmpfs          tmpfs     100M     0  100M   0% /run/user/0
root@streisand-sgr:~#
root@streisand-sgr:~# free  -h
              total        used        free      shared  buff/cache   available
Mem:           992M         57M        472M         10M        462M        768M
Swap:            0B          0B          0B
root@streisand-sgr:~#
nopdotcom commented 6 years ago

I don't understand why tinyproxy can't write to /var/run/tinyproxy/tinyproxy.pid.

I changed /etc/tinyproxy.conf to point at /tmp/tinyproxy.pid, which it seems like it can write to.

I decided to switch away from the forking model to simple. I edited /etc/systemd/system/tinyproxy.service to take out the PID file watcher. and put it in the foreground with -d.

[Service]
Type=simple
#PIDFile=/var/run/tinyproxy/tinyproxy.pid
ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf -d

This seems to work.

Something is really screwed up with /var/run/tinyproxy and I don't understand it.

rdbox commented 6 years ago

did as you wrote, but something does not work out

root@streisand-sgr:~# systemctl daemon-reload
root@streisand-sgr:~# systemctl start tinyproxy.service
root@streisand-sgr:~# systemctl status tinyproxy.service
● tinyproxy.service - tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
   Loaded: loaded (/etc/systemd/system/tinyproxy.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2018-06-17 12:04:10 UTC; 3s ago
  Process: 27036 ExecStop=/usr/bin/killall -9 tinyproxy (code=exited, status=1/FAILURE)
  Process: 27033 ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf -d (code=exited, status=71)
 Main PID: 27033 (code=exited, status=71)

Jun 17 12:04:10 streisand-sgr systemd[1]: tinyproxy.service: Control process exited, code=exited status=1Jun 17 12:04:10 streisand-sgr systemd[1]: tinyproxy.service: Unit entered failed state.
Jun 17 12:04:10 streisand-sgr systemd[1]: tinyproxy.service: Failed with result 'exit-code'.
root@streisand-sgr:~#

here is the file /etc/systemd/system/tinyproxy.service

  1 [Unit]
  2 Description=tinyproxy - a light-weight HTTP/HTTPS proxy daemon for POSIX operating systems
  3 After=network-online.target sshd.service
  4 #Documentation=man:tinyproxy(8)
  5 #Documentation=https://www.banu.com/tinyproxy/
  6
  7
  8 [Service]
  9 Type=simple
 10 #PIDFile=/var/run/tinyproxy/tinyproxy.pid
 11 ExecStart=/usr/sbin/tinyproxy -c /etc/tinyproxy.conf -d
 12 ExecStop=/usr/bin/killall -9 tinyproxy
 13 ExecReload=/bin/kill -HUP $MAINPID
 14 PrivateTmp=true
 15 RestartSec=5s
 16 Restart=on-failure
 17
 18 [Install]
 19 WantedBy=multi-user.target
~
greenfuse commented 6 years ago

Check the User and Group settings in /etc/tinyproxy.conf and the permissions for the directory /var/run/tinyproxy/

You can either change the permissions to match the User and Group in the conf file, or change the conf file to match the permissions on the directory.

My solution was to edit /etc/tinyproxy.conf and change

User nobody Group nogroup

to

User tinyproxy Group tinyproxy

qbaze commented 5 years ago

Just for a record, same here on archlinux.

Used to work without any problem and when I wanted to start it after a few weeks again through the systemd it took a while and reported

Nov 25 23:00:27 qube systemd[1]: tinyproxy.service: Can't open PID file /run/tinyproxy/tinyproxy.pid (yet?) after start: No such file or directory
Nov 25 23:01:57 qube systemd[1]: tinyproxy.service: Start operation timed out. Terminating.
Nov 25 23:01:57 qube tinyproxy[5717]: Shutting down.
Nov 25 23:01:57 qube systemd[1]: tinyproxy.service: Failed with result 'timeout'.
Nov 25 23:01:57 qube systemd[1]: Failed to start Tinyproxy Web Proxy Server.

Systemd expected PID to be written to /run/tinyproxy/tinyproxy.pid

Tinyproxy user and group set to tinyproxy, the directory for PID existed with the correct permissions.

Finally I checked tinyproxy.conf and voilla

# PidFile: Write the PID of the main tinyproxy thread to this file so it
# can be used for signalling purposes.
# If not specified, no pidfile will be written.
#
#PidFile "/run/tinyproxy/tinyproxy.pid"

PidFile commented out and # If not specified, no pidfile will be written..

I believe the default must have changed meanwhile and not in sync with systemd script. Anyway just uncomment to make it work :)

Nomia commented 5 years ago

I have the same problem, but the situation is different from @qbaze 's.

the PidFile entry is not commented. But tinyproxy just cannot write the pid file, the permission is right.

I've changed the PidFile location, and changed the permission to it should be tinyproxy. But tinyproxy seems cached the config file. It still try to write to its previous location, which I've changed.

Nomia commented 5 years ago

Drives me crazy, anyone help😭

ronalddevos commented 5 years ago

Same here

ronalddevos commented 5 years ago

Following the above to the letter fixed it for me.

Nomia commented 5 years ago

For me, changing the port in tinyproxy.conf fixed it. I don't know why the 50506 port is not supported, and there was no error about it. When I changed it to any valid number, tinyproxy started to work

shaobo76 commented 4 years ago

killing all previous tinyproxy processes works for me