Opened 2 years ago

Last modified 6 months ago

#2324 assigned defect

i2prouter doesnt recognize I2P running within Systemctl

Reported by: anonymous maybe Owned by: Masayuki Hatta
Priority: minor Milestone: 0.9.39
Component: package/debian Version: 0.9.36
Keywords: systemd Cc:
Parent Tickets: Sensitive: no

Description

i2prouter status doesnt recognize i2p status if its run through systemctl:

user@host:~$ sudo systemctl status i2p
● i2p.service - load-balanced unspoofable packet switching network
   Loaded: loaded (/lib/systemd/system/i2p.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-10-03 13:53:55 UTC; 1min 15s ago
  Process: 868 ExecStart=/usr/sbin/wrapper $I2P_ARGS (code=exited, status=0/SUCCESS)
  Process: 863 ExecStartPre=/bin/chmod 750 /var/log/i2p (code=exited, status=0/SUCCESS)
  Process: 857 ExecStartPre=/bin/chown -R ${I2PUSER}:${I2PUSER} /var/log/i2p /run/i2p /tmp/i2p-daemon (code=exited, status=0/SUCCESS)
  Process: 833 ExecStartPre=/bin/mkdir -p /tmp/i2p-daemon (code=exited, status=0/SUCCESS)
 Main PID: 870 (wrapper)
    Tasks: 62 (limit: 4915)
   CGroup: /system.slice/i2p.service
           ├─870 /usr/sbin/wrapper /etc/i2p/wrapper.config wrapper.java.additional.1=-DloggerFilenameOverride=/var/log/i2p/log-router-@.txt wrapper.java.additional.10
           └─950 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -DloggerFilenameOverride=/var/log/i2p/log-router-@.txt -Di2p.dir.base=/usr/share/i2p -Dwrapper.logfile

Oct 03 13:53:55 host systemd[1]: Starting load-balanced unspoofable packet switching network...
Oct 03 13:53:55 host systemd[1]: Started load-balanced unspoofable packet switching network.
user@host:~$ i2prouter status 
I2P Service is not running.
user@host:~$                                                                                                                                                                            

Expected Behavior:

to recognize I2P status

Actual Behavior:

it doesnt recognize I2P status

Subtickets

Change History (5)

comment:1 Changed 2 years ago by zzz

Component: otherpackage/debian
Owner: set to Masayuki Hatta
Status: newassigned

comment:2 Changed 22 months ago by backup

Keywords: systemd added

Installing fresh 0.9.37 shows similar problems on a Arch Linux:

# ~/i2p/i2prouter
RUN_AS_USER=i2puser

And running

sudo i2prouter install

to install the systemd unit results in following error in the journalctl when doing

sudo systemctl start i2p

i2prouter[1807]: Starting I2P Service...
i2prouter[1807]: Waiting for I2P Service...
i2prouter[1807]: ....
i2prouter[1807]: running: PID:1983
systemd[1]: i2p.service: New main PID 1983 does not belong to service, and PID file is not owned by root. Refusing.
systemd[1]: i2p.service: New main PID 1983 does not belong to service, and PID file is not owned by root. Refusing.
systemd[1]: i2p.service: Failed with result 'protocol'.
systemd[1]: Failed to start I2P Service.

# probably root-cause:
I found this:

systemd: be stricter when handling PID files and MAINPID sd_notify() messages
https://github.com/systemd/systemd/commit/db256aab13d8a89d583ecd2bacf0aca87c66effc

and systemd (?) deletes the invalid i2p.pid, although i2p is running, resulting in status errors on further calls on the status of the i2p process.

# Proposed solution:
Add this to the systemd unit i2p.service:

[Service]
User=i2puser
Group=i2puser

where i2puser has to be replaced by the provided RUN_AS_USER from i2p/i2prouter.
In these case runuser/su should not be called inside i2p/i2prouter script of course.

Thanks very much,
backup

comment:3 Changed 21 months ago by zzz

Milestone: undecided0.9.39

Milestone set to .39 as requested by mhatta

comment:4 Changed 9 months ago by idk

Sensitive: unset

This appears to be fixed in the current router on Ubuntu 18.04 and 19.10 as well ad Debian Buster and Sid. Is anyone able still able to reproduce this bug?

comment:5 Changed 6 months ago by anonymous maybe

Still not working using Debian Buster:

user@host:~$ sudo systemctl status i2p
● i2p.service - load-balanced unspoofable packet switching network
   Loaded: loaded (/lib/systemd/system/i2p.service; disabled; vendor preset: ena
   Active: inactive (dead)
user@host:~$ i2prouter status 
I2P Service is running: PID:879, Wrapper:STARTED, Java:STARTED

Last edited 6 months ago by anonymous maybe (previous) (diff)
Note: See TracTickets for help on using tickets.