I have rtorrent working as daemon and it is at default runlevel. But sometimes (not always) it's crashed at system startup. 'rc-status' shows me: rtorrentd [ crashed ] Config file /etc/conf.d/rtorrentd contains: USER="p2p" Home directory is /home/p2p/ and the /home/p2p/_session/rtorrent.lock not always removed at system shutdown. According to https://wiki.gentoo.org/wiki/RTorrent#Controlling_rTorrent_exit I have changed /etc/init.d/rtorrentd, but it's not help :( Maybe it's needed also this line: /bin/rm /home/p2p/_session/rtorrent.lock ? Reproducible: Sometimes
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d978fda5625ae8ce70c59898734775beca572c5f commit d978fda5625ae8ce70c59898734775beca572c5f Author: Stephen Shkardoon <ss23@ss23.geek.nz> AuthorDate: 2018-01-16 17:50:49 +0000 Commit: Jason Zaman <perfinion@gentoo.org> CommitDate: 2018-01-19 12:02:27 +0000 net-p2p/rtorrent: Update init.d script to use correct PID Overwrites the start-stop-daemon created PID file with the child PID obtained by searching for children of screen. Closes: https://bugs.gentoo.org/634852 Package-Manager: Portage-2.3.13, Repoman-2.3.3 net-p2p/rtorrent/files/rtorrentd.init | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Oh, now it doesn't start all time. # /etc/init.d/rtorrentd start * Starting rtorrent ... [ !! ] * ERROR: rtorrentd failed to start # /etc/init.d/rtorrentd start * Starting rtorrent ... cat: /var/run/rtorrentd.pid: No such file or directory pgrep: option requires an argument -- 'P' Usage: pgrep [options] <pattern> Options: -d, --delimiter <string> specify output delimiter -l, --list-name list PID and process name -a, --list-full list PID and full command line -v, --inverse negates the matching -w, --lightweight list all TID -c, --count count of matching processes -f, --full use full process name to match -g, --pgroup <PGID,...> match listed process group IDs -G, --group <GID,...> match real group IDs -i, --ignore-case match case insensitively -n, --newest select most recently started -o, --oldest select least recently started -P, --parent <PPID,...> match only child processes of the given parent -s, --session <SID,...> match session IDs -t, --terminal <tty,...> match by controlling terminal -u, --euid <ID,...> match by effective IDs -U, --uid <ID,...> match by real IDs -x, --exact match exactly with the command name -F, --pidfile <file> read PIDs from file -L, --logpidfile fail if PID file is not locked --ns <PID> match the processes that belong to the same namespace as <pid> --nslist <ns,...> list which namespaces will be considered for the --ns option. Available namespaces: ipc, mnt, net, pid, user, uts -h, --help display this help and exit -V, --version output version information and exit For more details see pgrep(1). [ !! ] * ERROR: rtorrentd failed to start
Portage 2.3.13 (python 3.5.4-final-0, default/linux/amd64/17.0/no-multilib/hardened, gcc-6.4.0, glibc-2.25-r9, 4.8.17-hardened-r2-gnu x86_64) ================================================================= System uname: Linux-4.8.17-hardened-r2-gnu-x86_64-Intel-R-_Celeron-R-_CPU_N3050_@_1.60GHz-with-gentoo-2.4.1 KiB Mem: 1939224 total, 286252 free KiB Swap: 4194300 total, 4194212 free Timestamp of repository gentoo: Fri, 19 Jan 2018 18:00:01 +0000 Head commit of repository gentoo: 04c96b5345523a0900485ef3ae1cd1839bf80c89 sh bash 4.4_p12 ld GNU ld (Gentoo 2.29.1 p3) 2.29.1 app-shells/bash: 4.4_p12::gentoo dev-lang/perl: 5.24.3::gentoo dev-lang/python: 2.7.14-r1::gentoo, 3.5.4-r1::gentoo dev-util/cmake: 3.9.6::gentoo dev-util/pkgconfig: 0.29.2::gentoo sys-apps/baselayout: 2.4.1-r2::gentoo sys-apps/openrc: 0.34.11::gentoo sys-apps/sandbox: 2.12::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r4::gentoo sys-devel/automake: 1.15.1-r1::gentoo sys-devel/binutils: 2.29.1-r1::gentoo sys-devel/gcc: 6.4.0-r1::gentoo sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers) sys-libs/glibc: 2.25-r9::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=native" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -march=native" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--quiet-build=y --keep-going=y" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs buildsyspkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en_US" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="X acl alsa amd64 bzip2 consolekit crypt cxx dbus hardened iconv ipv6 ncurses nls nptl openmp pam pax_kernel pcre pie policykit qt5 readline seccomp smp ssl ssp threads unicode xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="i965 intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Looks like an issue where start-stop-daemon will return before creating the PID file, so the pgrep fails. I've pushed another PR for this which should fix it by doing a small sleep before the pgrep. It's not a nice solution, but I expect it'll work for now. I'd be happy to have an alternative if someone had one.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=427400b35fe4f1d1cafbad62458e2f5faae8b7e0 commit 427400b35fe4f1d1cafbad62458e2f5faae8b7e0 Author: Stephen Shkardoon <ss23@ss23.geek.nz> AuthorDate: 2018-01-20 19:46:41 +0000 Commit: Jason Zaman <perfinion@gentoo.org> CommitDate: 2018-01-21 04:04:15 +0000 net-p2p/rtorrent: Fix init script to ensure PID file is created By only replacing the PID in the stop action, we can ensure start-stop-daemon had time to create the PID file. Closes: https://bugs.gentoo.org/634852 Package-Manager: Portage-2.3.19, Repoman-2.3.6 net-p2p/rtorrent/files/rtorrentd.init | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Seems to be OK now. Thanks.