You are not logged in.

#1 2014-08-11 10:31:24

emdeex
Member
Registered: 2014-07-29
Posts: 10

Debugging systemctl script that won't start..

Hi All,

[att moderators] Yes, this is running on a Raspberry, but its a general problem that I can't get a resolution from from the ARM forums, please allow your gurus to help!

My arch distro is running fine, and it can run every other package and systemctl script, but this privoxy one just does not work, and I don't know what's wrong.

I've tried all sorts of things, even straced it, but can't see whats wrong.

The current privoxy.service file looks like:

[Unit]
Description=Privoxy Web Proxy With Advanced Filtering Capabilities
After=network.target

[Service]
Type=forking
PIDFile=/run/privoxy.pid
ExecStart=/usr/bin/privoxy /etc/privoxy/config
SuccessExitStatus=1
PrivateDevices=yes

[Install]
WantedBy=multi-user.target

and the error is:

# systemctl status privoxy.service
* privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/etc/systemd/system/privoxy.service; enabled)
   Active: failed (Result: resources) since Mon 2014-08-11 20:22:29 EST; 7min ago
  Process: 19762 ExecStart=/usr/bin/privoxy /etc/privoxy/config (code=exited, status=1/FAILURE)

Offline

#2 2014-08-11 10:46:27

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Debugging systemctl script that won't start..


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2014-08-11 11:21:07

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

Thanks, I have tried the suggestions there, but the suggested path (using journalctl) doesn't produce any useful results.

systemctl status privoxy
* privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/etc/systemd/system/privoxy.service; enabled)
   Active: failed (Result: resources) since Mon 2014-08-11 21:18:24 EST; 28s ago
  Process: 20267 ExecStart=/usr/bin/privoxy /etc/privoxy/config (code=exited, status=1/FAILURE)
[root@alarmpi ~]# journalctl -b _PID=20267
-- Logs begin at Thu 1970-01-01 10:00:03 EST, end at Sat 2014-08-09 22:27:55 EST. --

Offline

#4 2014-08-11 11:25:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Debugging systemctl script that won't start..

Is there a reason you are not using the service file included with the package?  If so, you should still look at that service file to see what yours is missing.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2014-08-11 11:32:28

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

Trilby wrote:

Is there a reason you are not using the service file included with the package?  If so, you should still look at that service file to see what yours is missing.

Thanks, there is no reason apart from it doesn't work.  It has some extra declarations but I don't think they are the problem.

To clarify, this works when run from root:

# privoxy /etc/privoxy/config

The daemon starts up and runs fine, for days or weeks.

But I can't get systemctl to run it.  I think it might be a permissions error?  Would systemctl run the process using a different user?  I'm not sure how to debug that...

Last edited by emdeex (2014-08-14 08:39:46)

Offline

#6 2014-08-11 11:38:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Debugging systemctl script that won't start..

*headdesk* well, start by using the provided service file then report any errors you get with that.

There are bits of the included service file that are different from yours that would really matter.  The most obvious is the SuccessExitStatus.  It's no wonder systemd reports that yours failed because the exit code of the process doesn't match what you indicates it should provide on success.

As to why the included service file might not work for you, I have no idea - and no one could have any idea unless you tell us about those errors.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2014-08-11 11:59:52

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

Trilby wrote:

*headdesk* well, start by using the provided service file then report any errors you get with that.
.

Thanks, *palmhead*.  ...

Using the package service file...

# systemctl start privoxy
Job for privoxy.service failed. See 'systemctl status privoxy.service' and 'journalctl -xn' for details.
# systemctl status privoxy.service
* privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/etc/systemd/system/privoxy.service; enabled)
   Active: failed (Result: exit-code) since Mon 2014-08-11 21:56:10 EST; 5s ago
  Process: 20529 ExecStart=/usr/bin/privoxy --pidfile /run/privoxy.pid --user privoxy.privoxy /etc/privoxy/config (code=exited, status=1/FAILURE)

Offline

#8 2014-08-11 12:55:59

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: Debugging systemctl script that won't start..

Most likely the privoxy log file and/or log file directory defined in your config are not owned by privoxy.privoxy
(Caused by you manually running privoxy without the --user switch)

Offline

#9 2014-08-11 22:07:08

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

ukhippo wrote:

Most likely the privoxy log file and/or log file directory defined in your config are not owned by privoxy.privoxy
(Caused by you manually running privoxy without the --user switch)

Sounds good. But log file dir and file look OK.

ls -la /var/log/privoxy/
total 8
drwx------ 2 privoxy privoxy 4096 Aug 11 21:53 .
drwxr-xr-x 5 root    root    4096 Aug 11 21:53 ..
-rw-r--r-- 1 privoxy privoxy    0 Aug 11 21:53 logfile

Offline

#10 2014-08-11 22:40:36

branch
Member
Registered: 2014-03-16
Posts: 209

Re: Debugging systemctl script that won't start..

Try calling it this way from root shell, as this is how systemd calls it:

/usr/bin/privoxy --pidfile /run/privoxy.pid --user privoxy.privoxy /etc/privoxy/config

Offline

#11 2014-08-12 03:31:28

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

branch wrote:

Try calling it this way from root shell, as this is how systemd calls it:

/usr/bin/privoxy --pidfile /run/privoxy.pid --user privoxy.privoxy /etc/privoxy/config

Executing that command, returns nothing.  No error message.  No process starts.  Not sure where to look for the error.

Offline

#12 2014-08-13 16:38:17

branch
Member
Registered: 2014-03-16
Posts: 209

Re: Debugging systemctl script that won't start..

I just noticed that your working command uses /etc/config/privoxy, but the systemd service file uses /etc/privoxy/config.

In any case, it is no longer a systemd issue, just privoxy. A few things to try if your problem persists after reconciling the config file issue:

1) Output should go to the logfile, /var/log/privoxy/logfile by default if it could be opened. You may try --no-daemon to make output go to the terminal, but this may not work in combination with --user.

2) Reinstall the privoxy package

3) Since "privoxy /etc/config/privoxy" works but "/usr/bin/privoxy --pidfile /run/privoxy.pid --user privoxy.privoxy /etc/privoxy/config" does not, test to see which difference is causing the failure.

4) run 'echo $?' directly after trying to run privoxy to print the return value, this may give a clue.

Offline

#13 2014-08-14 09:03:33

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

branch wrote:

I just noticed that your working command uses /etc/config/privoxy, but the systemd service file uses /etc/privoxy/config.

Thanks for that pickup, had me scratching my head, but it was just a typo.. I hadn't been using that actual command in real life

I'm narrowing it down to something with the user.

4) run 'echo $?' directly after trying to run privoxy to print the return value, this may give a clue.

Running the same command without the --user flag executes with a 0 return (success).  Running with the --user privoxy.privoxy flag gives a 1 response (fail)

Running it with --no-daemon is weird... it runs as user privoxy, but of course doesn't become a daemon which is what I need.

# /usr/bin/privoxy --no-daemon --pidfile /run/privoxy.pid --user privoxy.privoxy /etc/privoxy/config
2014-08-14 19:05:11.090 b6fbd000 Info: Privoxy version 3.0.21
2014-08-14 19:05:11.091 b6fbd000 Info: Program name: /usr/bin/privoxy

It's annoying that the binary or journalctl doesn't show any log messages when it fails with a 1 return code.

Would pastebin'ing two straces outputs of each command be of any use to anyone?  I can see the differences, but can't yet decode whats going on.

Last edited by emdeex (2014-08-14 12:09:22)

Offline

#14 2014-08-14 14:30:06

branch
Member
Registered: 2014-03-16
Posts: 209

Re: Debugging systemctl script that won't start..

Probably ukhippo was on the right track. File permissions or some such.

Try to run privoxy as the privoxy user:

# as root
su privoxy --shell=/usr/bin/bash
/usr/bin/privoxy /etc/privoxy/config

If the above fails, check the permissions of the following files, as well as the permissions of the directories they reside in (from the privoxy man page):
/etc/privoxy/config
/etc/privoxy/match-all.action
/etc/privoxy/default.action
/etc/privoxy/user.action
/etc/privoxy/default.filter
/etc/privoxy/user.filter
/etc/privoxy/trust
/etc/privoxy/templates/*
/var/log/privoxy/logfile

Offline

#15 2014-08-14 22:01:52

emdeex
Member
Registered: 2014-07-29
Posts: 10

Re: Debugging systemctl script that won't start..

branch wrote:

Probably ukhippo was on the right track. File permissions or some such.

Try to run privoxy as the privoxy user:

# as root
su privoxy --shell=/usr/bin/bash
/usr/bin/privoxy /etc/privoxy/config

If I do this.. and run it exists with a 1 return.  No logs or error messages.

If I run it with --no-deamon it runs OK

Offline

#16 2014-10-29 23:18:04

kafula
Member
Registered: 2014-10-29
Posts: 1

Re: Debugging systemctl script that won't start..

#!/bin/sh
#### Trying to connect using privoxy and tor
echo " Trying to connect to connect anonimously"
echo
cd  /etc/privoxy       
sudo /usr/sbin/privoxy
sudo /usr/sbin/rctor start
echo
sudo netstat -tulpn | grep :
echo
echo "Thank you "

Offline

Board footer

Powered by FluxBB