Created attachment 415844 [details] emerge --info The logrotate script that the package installs has the following in postrotate: /etc/init.d/i2pd restart >/dev/null This means that as logrotate processes this script, it (re)starts the i2pd daemon even if the admin didn't mean it to autostart (didn't add it to runlevels). This shouldn't happen; restart should only be done if the daemon is already running.
The way i2pd is handling logrotate has changed in 2.5.0. Now logfile is reopened by SIGHUP, and there is no need to restart the daemon. See https://github.com/PurpleI2P/i2pd/commit/98d5e0b56d321b72340212564a662aa2e6d6a06e How should this be implemented properly in gentoo? There should be a PID somewhere to send the signal to, and this should work for both openrc and systemd.
I did some search. It looks like the following should work for the i2pd.logrotate file for version >=2.5.0. This would close this bug, I suppose. /var/log/i2pd.log { rotate 4 weekly missingok notifempty compress delaycompress create 640 i2pd i2pd postrotate /usr/bin/killall -HUP i2pd endscript } Or maybe it is better to send a signal by PID? kill -HUP $(cat /var/run/i2pd.pid)
Sending a signal by PID would be definitely better.
ok, so the logrotate file for version >=2.5.0 should be changed to /var/log/i2pd.log { rotate 4 weekly missingok notifempty compress delaycompress create 640 i2pd i2pd postrotate /bin/kill -HUP $(cat /var/run/i2pd.pid) endscript } currently both systemd and openrc scripts start i2pd to use /var/log/i2pd.log as a log file and /var/run/i2pd.pid as a PID file, so things look consistent
@maintainers, shall i commit?
(In reply to Alexey from comment #4) > ok, so the logrotate file for version >=2.5.0 should be changed to > > /var/log/i2pd.log { > rotate 4 > weekly > missingok > notifempty > compress > delaycompress > create 640 i2pd i2pd > postrotate > /bin/kill -HUP $(cat /var/run/i2pd.pid) > endscript > } > > currently both systemd and openrc scripts start i2pd to use > /var/log/i2pd.log as a log file and /var/run/i2pd.pid as a PID file, so > things look consistent Have you tested this for a week or more?
Created attachment 427808 [details] updated /etc/conf.d/i2pd
Created attachment 427810 [details] updated /etc/init.d/i2pd
I tried to test this, and it did not work, because no valid pid file was created. Solution would be change /etc/conf.d/i2pd by adding "--pidfile ${I2PD_PID}" to I2PDOPTIONS: # cat /etc/conf.d/i2pd I2PD_USER="${I2PD_USER:-i2pd}" I2PD_GROUP="${I2PD_GROUP:-i2pd}" I2PD_LOG="/var/log/i2pd.log" I2PD_PID="/var/run/i2pd.pid" I2PD_CFGDIR="/etc/i2pd/" # Options to i2pd I2PDOPTIONS="--conf=${I2PD_CFGDIR}i2pd.conf --tunconf=${I2PD_CFGDIR}tunnels.cfg --pidfile ${I2PD_PID}" I compared start scripts for i2p and i2pd, and saw that i2p checks if the pid file was created and there is a corresponding process. We could also do the same here (I added two lines starting with "sleep 1"): # cat /etc/init.d/i2pd #!/sbin/runscript # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ description="C++ daemon for accessing the I2P network" depend() { use dns logger netmount } start() { ebegin "Starting ${SVCNAME}" checkpath -f "${I2PD_LOG}" -o "${I2PD_USER}:${I2PD_GROUP}" checkpath -f "${I2PD_PID}" -o "${I2PD_USER}:${I2PD_GROUP}" start-stop-daemon -S -b -u "${I2PD_USER}:${I2PD_GROUP}" /usr/bin/i2pd -- ${I2PDOPTIONS} sleep 1 [ -e "$I2PD_PID" -a -e /proc/$(cat "$I2PD_PID") ] eend $? } stop() { ebegin "Stopping ${SVCNAME}" start-stop-daemon -K -p "${I2PD_PID}" -R SIGTERM/20 SIGKILL/20 -P eend $? }
Created attachment 427812 [details] updated i2pd.service
So far, to fix the pid file creation problems, I made changes to /etc/init.d/i2pd, /etc/conf.d/i2pd and /usr/lib/systemd/system/i2pd.service. I am testing it currently on openrc. Things seem working, but let us wait a bit to see if any problems come up. Would be good if somebody tested it on systemd, which I may not be able to do in the near future.
Created attachment 427884 [details] updated /etc/conf.d/i2pd Updating again /etc/conf.d/i2pd. There is another bug in i2pd: "service=1" in the configuration file is ignored, so "--service" has to be given in the command line. This option instructs the daemon to work system folders instead of like /home/user/.i2pd (see https://github.com/PurpleI2P/i2pd/issues/408 ) I added some more options explicitly in /etc/conf.d/i2pd: daemon, service, log location. On the original bug in this bug report: I tested logrotate, it rotates well.
Created attachment 427886 [details] updated /etc/logrotate.d/i2pd This is /etc/logrotate.d/i2pd, as discussed above.
Created attachment 427888 [details] updated i2pd.service this is an updated i2pd.service for systemd. I added explicitly options like in /etc/conf.d/i2pd above. Tested this with systemd, it starts and seems working.
@klondike @tomboy64 comments on the above before i commit?
Created attachment 428124 [details] updated /etc/logrotate.d/i2pd I have some minor comments. First, I found out by reading man logrotate that options compress, delaycompress and copytruncate in this case are no longer necessary in logrotate.d/i2pd. I removed them and tested for around 4 days, it seems to work just fine. I am replacing the attachment with logrotate.d/i2pd now. Another thing that would be very helpful, especially for new users: i2pd sources come with a file debian/subscriptions.txt. It provides initial subscriptions to lists of available hosts. It is supposed to be in the data directory (/var/lib/i2pd/), but be user-editable, like files in /etc/i2pd. We don't use it currently. Can we place it in /etc/i2pd/ and add a symlink ln -s /etc/i2pd/subscriptions.txt /var/lib/i2pd/ ? Just in case, I have tested this for a week. One last thing: there is a release 2.5.1, which is a bugfix for 2.5.0, no significant changes :-)
This bug discussion is getting long. To summarize, all my suggestions are: * replace the files in attachments * put debian/subscriptions.txt in /etc/i2pd/ and create a symlink ln -s /etc/i2pd/subscriptions.txt /var/lib/i2pd/ * when this is all done, create an identical ebuild for the bugfix version 2.5.1
(In reply to Alexey from comment #17) > This bug discussion is getting long. To summarize, all my suggestions are: > > * replace the files in attachments > * put debian/subscriptions.txt in /etc/i2pd/ and create a symlink > ln -s /etc/i2pd/subscriptions.txt /var/lib/i2pd/ > * when this is all done, create an identical ebuild for the bugfix version > 2.5.1 too long. please give me just a commit against the gentoo repo. break up each issue into a separate commit.
Uh, it will take me some time to figure out how to create commits against gentoo repo. I tried to follow https://wiki.gentoo.org/wiki/Gentoo_git_workflow, but failed to even chekout the current repo. Maybe there is a guide for beginners? I will describe the changes here once again, in case somebody else can create these commits. There are three changes: 1) fix the bug in this bugreport: replace files /etc/init.d/i2pd, /etc/conf.d/i2pd, i2pd.service, /etc/logrotate.d/i2pd as in attachments in this bugreport 2) use supplied suscriptions.txt: place debian/subscriptions.txt in /etc/i2pd/ and create a symlink ln -s /etc/i2pd/subscriptions.txt /var/lib/i2pd/ 3) bump to a bugfix version 2.5.1 copy the ebuild for 2.5.0
(In reply to Alexey from comment #19) > Uh, it will take me some time to figure out how to create commits against > gentoo repo. I tried to follow > https://wiki.gentoo.org/wiki/Gentoo_git_workflow, but failed to even chekout > the current repo. Maybe there is a guide for beginners? > > I will describe the changes here once again, in case somebody else can > create these commits. > > There are three changes: > 1) fix the bug in this bugreport: > replace files /etc/init.d/i2pd, /etc/conf.d/i2pd, i2pd.service, > /etc/logrotate.d/i2pd as in attachments in this bugreport > > 2) use supplied suscriptions.txt: > place debian/subscriptions.txt in /etc/i2pd/ and create a symlink > ln -s /etc/i2pd/subscriptions.txt /var/lib/i2pd/ > > 3) bump to a bugfix version 2.5.1 > copy the ebuild for 2.5.0 yes you have too many things going on here for me to follow what you want me to do with the package.
If you could fix issue 1), this would close this bug. This should be very straightforward. Issues 2) and 3) are not from this bugreport, I could create two more bugs form them. They are also easy to solve. I am unsure what to do, but I have reported the issues I found, how they are solved, and I tested solutions on my computer.
I created a pull request on github for issue 1) https://github.com/gentoo/gentoo/pull/1040 Is this OK? I am absolutely new to all this.
(In reply to Alexey from comment #22) > I created a pull request on github for issue 1) > https://github.com/gentoo/gentoo/pull/1040 > > Is this OK? I am absolutely new to all this. being a n00b is fine :) 1) your commit message must always start with <cat>/<pkg> so I had to change one of the commit messages 2) don't make a separate commit for the manifest 3) use repoman to check your work and do commits, so a) repoman -d full # to check that you didn't break anything b) repoman commit "net-misc/i2pd: fix bug #564596" Take a look at commits 6bcc3054f2f5dcc1c7b09d3961f3b12b8009e2c0 a70d3a9b1bd76537607fb27662190cfbb7629f93 b9adf62fa6ddc431f6c7cd60a6383ad4cabf4959
@everyone please test, i'd like to drop i2pd-0.10.0.ebuild i2pd-2.4.0-r1.ebuild i2pd-2.5.0.ebuild i2pd-2.5.0-r1.ebuild soon-ish like about 1 week. can someone ping me back on this bug when they're convince i2pd-2.5.0-r2.ebuild i2pd-2.5.1.ebuild work just fine. also is there a quickstart for i2pd?
Ok, thanks a lot. I still have to learn how to use repoman. But I will probably get there. I made a blunder - having switched almost all files to their correct versions I missed the most important one: logrotate. I created a new pull request: https://github.com/gentoo/gentoo/pull/1045 There are quickstart guides for i2pd, for example https://www.reddit.com/r/i2pd/comments/43f8dz/how_to_install_i2pd_tutorial_for_debianubuntu/ but they get obsolete very fast. In gentoo it is enough to start the service and point the browser to proxy on http://localhost:4444 (or whatever port is in the config file) to browse i2pd. And go to http://localhost:7070 for the web interface.
(In reply to Alexey Korepanov from comment #25) > Ok, thanks a lot. > > I still have to learn how to use repoman. But I will probably get there. > > I made a blunder - having switched almost all files to their correct > versions I missed the most important one: logrotate. > > I created a new pull request: > https://github.com/gentoo/gentoo/pull/1045 > > There are quickstart guides for i2pd, for example > https://www.reddit.com/r/i2pd/comments/43f8dz/ > how_to_install_i2pd_tutorial_for_debianubuntu/ > but they get obsolete very fast. In gentoo it is enough to start the service > and point the browser to proxy on http://localhost:4444 (or whatever port is > in the config file) to browse i2pd. And go to http://localhost:7070 for the > web interface. fix committed. i removed the older botched versions.
(In reply to Anthony Basile from comment #26) > (In reply to Alexey Korepanov from comment #25) > > Ok, thanks a lot. > > > > I still have to learn how to use repoman. But I will probably get there. > > > > I made a blunder - having switched almost all files to their correct > > versions I missed the most important one: logrotate. > > > > I created a new pull request: > > https://github.com/gentoo/gentoo/pull/1045 > > > > There are quickstart guides for i2pd, for example > > https://www.reddit.com/r/i2pd/comments/43f8dz/ > > how_to_install_i2pd_tutorial_for_debianubuntu/ > > but they get obsolete very fast. In gentoo it is enough to start the service > > and point the browser to proxy on http://localhost:4444 (or whatever port is > > in the config file) to browse i2pd. And go to http://localhost:7070 for the > > web interface. > > fix committed. i removed the older botched versions. i removed everything but i2pd-2.5.0-r3 i2pd-2.5.1-r1. open up a new bug if there's anything else wrong.