Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926219 - app-admin/restart-services-1.0: fails to restart services on merged-usr profiles
Summary: app-admin/restart-services-1.0: fails to restart services on merged-usr profiles
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Marc Schiffbauer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-05 20:08 UTC by Klemen Mihevc
Modified: 2024-03-13 08:49 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to find symlinked inittab processes (restart-services.patch,1.42 KB, patch)
2024-03-11 11:33 UTC, Marc Schiffbauer
Details | Diff
patch to find symlinked inittab processes (restart-services.patch,1.44 KB, patch)
2024-03-12 09:47 UTC, Marc Schiffbauer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Klemen Mihevc 2024-03-05 20:08:47 UTC
Im not sure when this started to happen, but restart-services stopped killing /sbin/agetty processes after sys-apps/util-linux update.


Reproducible: Always




mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing /sbin/agetty --noclear 38400 tty1 linux (pids 6601)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty --noclear 38400 tty1 linux (pids: 6601)
debug: 6601: checking pid 6601
debug: 6601: process root is /
debug: 6601: no direct hit: process /sbin/agetty --noclear 38400 tty1 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6601: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6601: /proc/6601/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty2 linux (pids 6603)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty2 linux (pids: 6603)
debug: 6603: checking pid 6603
debug: 6603: process root is /
debug: 6603: no direct hit: process /sbin/agetty 38400 tty2 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6603: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6603: /proc/6603/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty3 linux (pids 6604)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty3 linux (pids: 6604)
debug: 6604: checking pid 6604
debug: 6604: process root is /
debug: 6604: no direct hit: process /sbin/agetty 38400 tty3 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6604: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6604: /proc/6604/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty4 linux (pids 6605)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty4 linux (pids: 6605)
debug: 6605: checking pid 6605
debug: 6605: process root is /
debug: 6605: no direct hit: process /sbin/agetty 38400 tty4 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6605: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6605: /proc/6605/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.7-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: 6605: analyzing remaining processes (not direct hits) ...
debug: 6605: TODO_PROCESSES_EXE: /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty
debug: 6605: checking exe /usr/bin/agetty
debug: 6605: process does not look like a script
debug: 6605: does not belong to any package: /usr/bin/agetty
debug: 6605: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6604: checking exe /usr/bin/agetty
debug: 6604: process does not look like a script
debug: 6604: does not belong to any package: /usr/bin/agetty
debug: 6604: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6601: checking exe /usr/bin/agetty
debug: 6601: process does not look like a script
debug: 6601: does not belong to any package: /usr/bin/agetty
debug: 6601: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6603: checking exe /usr/bin/agetty
debug: 6603: process does not look like a script
debug: 6603: does not belong to any package: /usr/bin/agetty
debug: 6603: adding to UNKNOWN_PROCESSES: /usr/bin/agetty                                                                                                      done
No known services need to be restarted.
debug: looking for false positives in unknown processes
debug: looking at unknown process /usr/bin/agetty (6605)
debug: looking at unknown process /usr/bin/agetty (6604)
debug: looking at unknown process /usr/bin/agetty (6601)
debug: looking at unknown process /usr/bin/agetty (6603)

-> Warning: The following running processes did not match any known service but have been updated or deleted (or some deps)
->  If any of those match a custom service you can configure a service manually using 'CUSTOM_PROCESS_MAP'
=> 6605:  /sbin/agetty 38400 tty4 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6604:  /sbin/agetty 38400 tty3 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6601:  /sbin/agetty --noclear 38400 tty1 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6603:  /sbin/agetty 38400 tty2 linux [exe=/usr/bin/agetty] (owner: root, root: /)
Comment 1 Klemen Mihevc 2024-03-05 20:15:52 UTC
Relevant part of config is default value:

INITTAB_KILLALL=( /sbin/agetty )

Also in inittab terminals should be? spawned from /sbin/agetty

# TERMINALS
#x1:12345:respawn:/sbin/agetty 38400 console linux
c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux

However if i'm reading debug correctly this is not the case but it really runs from /usr/bin/agetty? On my installation i have agetty on both locations (they are the same) this is with sys-apps/util-linux-2.39.3-r3.
Comment 2 Klemen Mihevc 2024-03-05 20:16:18 UTC
Oh and emerge --info in case it helps

mih ~ # emerge --info
Portage 3.0.63 (python 3.11.8-final-0, default/linux/amd64/23.0/hardened, gcc-13, glibc-2.39-r2, 6.7.7-gentoo-dist-hardened x86_64)
=================================================================
System uname: Linux-6.7.7-gentoo-dist-hardened-x86_64-AMD_Ryzen_5_2600_Six-Core_Processor-with-glibc2.39
KiB Mem:    16296944 total,   2712124 free
KiB Swap:   33554428 total,  33554428 free
Timestamp of repository gentoo: Tue, 05 Mar 2024 19:49:02 +0000
Head commit of repository gentoo: 9a2ce9d9b616a92e61652e1987213576cf99922a

sh bash 5.2_p26
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.3::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.2::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           3.11.8_p1::gentoo
sys-apps/baselayout:       2.14-r2::gentoo
sys-apps/openrc:           0.53::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.7::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: False
    sync-git-verify-commit-signature: true
    sync-git-clone-extra-opts: -b stable -c remote.origin.prune=true -c gc.pruneExpire=now -c gc.worktreePruneExpire=now -c gc.reflogExpire=now -c gc.reflogExpireUnreachable=now -c gc.rerereresolved=0 -c gc.rerereunresolved=0

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://gentoo.mirror.garr.it/releases/amd64/binpackages/23.0/x86-64_hardened

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.3/ext-active/ /etc/php/cgi-php8.3/ext-active/ /etc/php/cli-php8.3/ext-active/ /etc/php/fpm-php8.3/ext-active/ /etc/php/phpdbg-php8.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe -fomit-frame-pointer -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
GENTOO_MIRRORS="https://gentoo.mirror.garr.it/ https://mirror.init7.net/gentoo/ https://mirror.netcologne.de/gentoo/ https://mirror.leaseweb.com/gentoo/"
LANG="sl_SI.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
LINGUAS="en sl"
MAKEOPTS="-j12 -l12"
PKGDIR="/var/cache/binpkgs"
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"
SHELL="/bin/bash"
USE="acl acpi amd64 apache2 avif bzip2 caps cet change-password cli client crypt curl dhcp dist-kernel doh dovecot-sasl dracut eap exif expat extraengine fontconfig ftp gd gdbm glib gmp grub gssapi gzip hardened http2 iconv icu idn intl iptables ipv6 jpeg kerberos lcms libtirpc lm-sensors lto lz4 lzma lzo managesieve modules-compress mp3 multilib mysql mysqli ncurses nls nping nvenc nvidia-gpu openssl pam pci pcntl pcre pdo perl pic pie png qt6 rar readline rpc samba seccomp server sieve slang smtp soap sockets socks5 spell sqlite ssh ssl ssp suexec test-rust threads tiff tracepath truetype udev unicode urandom usb vhosts webp webui x264 x265 xattr xml xmlreader xmlwriter xslt xtpax xvid xz zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias authn_dbd authn_socache authz_dbd cache_socache dbd http2 proxy proxy_html proxy_http proxy_http2 proxy_wstunnel xml2enc" APACHE2_MPMS="event" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en sl" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-4" LUA_TARGETS="lua5-4" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-3" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="nvidia" XTABLES_ADDONS="geoip"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 3 Marc Schiffbauer gentoo-dev 2024-03-09 15:55:08 UTC
Hi Klemen, thanks for reporting.

Please try adding /usr/bin/agetty to INITTAB_KILLALL and check if its working again then.

I think this is due to your profile being a merged-usr profile and so the path of agetty has changed...
Comment 4 Klemen Mihevc 2024-03-09 16:16:58 UTC
Yes it is merge-usr profile, changed to it about ~2-3 weeks ago (when 23.0 profiles became experimental i converted to merge-usr and switched profiles), but i do think i noticed issue before... not really sure :)

OH i forgot to say, that was first thing i tried... changing INITTAB_KILLALL to /usr/bin/agetty but here i tried again same log:

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing /sbin/agetty --noclear 38400 tty1 linux (pids 6088)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty --noclear 38400 tty1 linux (pids: 6088)
debug: 6088: checking pid 6088
debug: 6088: process root is /
debug: 6088: no direct hit: process /sbin/agetty --noclear 38400 tty1 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6088: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6088: /proc/6088/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty2 linux (pids 6089)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty2 linux (pids: 6089)
debug: 6089: checking pid 6089
debug: 6089: process root is /
debug: 6089: no direct hit: process /sbin/agetty 38400 tty2 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6089: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6089: /proc/6089/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty3 linux (pids 6090)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty3 linux (pids: 6090)
debug: 6090: checking pid 6090
debug: 6090: process root is /
debug: 6090: no direct hit: process /sbin/agetty 38400 tty3 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6090: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6090: /proc/6090/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty4 linux (pids 6091)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty4 linux (pids: 6091)
debug: 6091: checking pid 6091
debug: 6091: process root is /
debug: 6091: no direct hit: process /sbin/agetty 38400 tty4 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6091: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6091: /proc/6091/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: 6091: analyzing remaining processes (not direct hits) ...
debug: 6091: TODO_PROCESSES_EXE: /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty
debug: 6089: checking exe /usr/bin/agetty
debug: 6089: process does not look like a script
debug: 6089: does not belong to any package: /usr/bin/agetty
debug: 6089: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6088: checking exe /usr/bin/agetty
debug: 6088: process does not look like a script
debug: 6088: does not belong to any package: /usr/bin/agetty
debug: 6088: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6090: checking exe /usr/bin/agetty
debug: 6090: process does not look like a script
debug: 6090: does not belong to any package: /usr/bin/agetty
debug: 6090: adding to UNKNOWN_PROCESSES: /usr/bin/agetty
debug: 6091: checking exe /usr/bin/agetty
debug: 6091: process does not look like a script
debug: 6091: does not belong to any package: /usr/bin/agetty
debug: 6091: adding to UNKNOWN_PROCESSES: /usr/bin/agetty                                                                                                      done
No known services need to be restarted.
debug: looking for false positives in unknown processes
debug: looking at unknown process /usr/bin/agetty (6089)
debug: looking at unknown process /usr/bin/agetty (6088)
debug: looking at unknown process /usr/bin/agetty (6090)
debug: looking at unknown process /usr/bin/agetty (6091)

-> Warning: The following running processes did not match any known service but have been updated or deleted (or some deps)
->  If any of those match a custom service you can configure a service manually using 'CUSTOM_PROCESS_MAP'
=> 6089:  /sbin/agetty 38400 tty2 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6088:  /sbin/agetty --noclear 38400 tty1 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6090:  /sbin/agetty 38400 tty3 linux [exe=/usr/bin/agetty] (owner: root, root: /)
=> 6091:  /sbin/agetty 38400 tty4 linux [exe=/usr/bin/agetty] (owner: root, root: /)

since i saw script is also parsing inittab and matching processes there i also tried to change to /usr/bin/agetty there without a luck at the end i even tried to remove agetty from /usr/bin and hoped it will pick up the one from /sbin/ but that just stopped spawning terminals :) but i did first suspected merge-usr issue my self as well tbh, but somehow i think i saw this issue couple of months ago, but back then since i was rebooting server anyway, just didnt bother with the error (but im not 100% sure), if there would be easy way to go back to split-usr i would try it, but its sadly not... i mean issue its not critical... util-linux gets updated rarely and potentially doing "killall -9 agetty" by hand is not such a big deal if i notice a warning, just i guess should be fixed at some point :)
Comment 5 Marc Schiffbauer gentoo-dev 2024-03-09 18:39:13 UTC
Thanks. Will it work if you add both paths?
Comment 6 Klemen Mihevc 2024-03-09 20:05:51 UTC
OK i took a bit of time an learn how restart-script works. First issue is with util-linux or portage. Portage doesnt register /usr/bin/agetty as a part of util-linux, while register /sbin/agetty just fine (i even looked in to ebuild, but its to complicated to figure out how install works for me, for all i notice it just runs make install and thats it, not sure why /usr/bin/agetty wouldnt be registered by portage in this case). Since /usr/bin/agetty is not registered as part of a util-linux

pkg=$(qfile --nocolor -- "$exe"|awk '{print $1}')

fails (empty) inside function get_package_of_file() and script doesnt register it as a PKG

This is first issue. So i tested it with just manually added /usr/bin/agetty in to /var/db/pkg/sys-apps/util-linux-2.39.3-r3/CONTENTS. Then to make it work you need to change INITTAB_KILLALL=( /usr/bin/agetty ) in config AND change inittab to /usr/bin/agetty from /sbin/agetty. Changing config is reasonable but not sure if changing inittab is. I guess 

elif [[ -e /etc/inittab ]] && grep -Eq ":respawn:$lu_exe([[:space:]]+|$)" /etc/inittab; then

should be somehow changed. Not sure how i guess they are other terminals then agetty :) if not maybe something like

grep -Eq ":respawn:.*agetty([[:space:]]+|$)" /etc/inittab

would work :)

how to fix util-linux/portage issue... i have no idea
Comment 7 Klemen Mihevc 2024-03-09 20:24:27 UTC
Maybe even check like this if someone uses something other then agetty + it works for both /sbin/agetty and /usr/bin/agetty

grep -Eq ":respawn:.*$(basename $lu_exe)([[:space:]]+|$)" /etc/inittab
Comment 8 Marc Schiffbauer gentoo-dev 2024-03-11 07:51:43 UTC
Hi Klemen,

will this patch fix it for you?

diff --git a/restart-services b/restart-services
index e64d94f..f4e2007 100755
--- a/restart-services
+++ b/restart-services
@@ -535,7 +535,7 @@ while IFS=";" read -r lu_pids lu_libs lu_proc; do

                R="$(readlink "/proc/$lu_pid/root")"
                unset lu_exe
-               lu_exe="$(readlink "/proc/$lu_pid/exe")"
+               lu_exe="$(readlink -e "/proc/$lu_pid/exe")"

                # remove /var/tmp/portage/*/*/image prefix, see kernel bug #10856
                # https://bugzilla.kernel.org/show_bug.cgi?id=10856
Comment 9 Klemen Mihevc 2024-03-11 08:13:02 UTC
No, same issue:

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing /sbin/agetty 38400 tty2 linux (pids 3335)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty2 linux (pids: 3335)
debug: 3335: checking pid 3335
debug: 3335: process root is /
debug: 3335: no direct hit: process /sbin/agetty 38400 tty2 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 3335: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 3335: /proc/3335/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty3 linux (pids 3336)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty3 linux (pids: 3336)
debug: 3336: checking pid 3336
debug: 3336: process root is /
debug: 3336: no direct hit: process /sbin/agetty 38400 tty3 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 3336: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 3336: /proc/3336/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty4 linux (pids 3337)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty4 linux (pids: 3337)
debug: 3337: checking pid 3337
debug: 3337: process root is /
debug: 3337: no direct hit: process /sbin/agetty 38400 tty4 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 3337: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 3337: /proc/3337/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty --noclear 38400 tty1 linux (pids 3338)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty --noclear 38400 tty1 linux (pids: 3338)
debug: 3338: checking pid 3338
debug: 3338: process root is /
debug: 3338: no direct hit: process /sbin/agetty --noclear 38400 tty1 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 3338: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 3338: /proc/3338/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: 3338: analyzing remaining processes (not direct hits) ...
debug: 3338: TODO_PROCESSES_EXE:
debug: 3336: checking exe
debug: 3336: process does not look like a script
debug: 3336: does not belong to any package:
debug: 3336: adding to UNKNOWN_PROCESSES:
debug: 3337: checking exe
debug: 3337: process does not look like a script
debug: 3337: does not belong to any package:
debug: 3337: adding to UNKNOWN_PROCESSES:
debug: 3335: checking exe
debug: 3335: process does not look like a script
debug: 3335: does not belong to any package:
debug: 3335: adding to UNKNOWN_PROCESSES:
debug: 3338: checking exe
debug: 3338: process does not look like a script
debug: 3338: does not belong to any package:
debug: 3338: adding to UNKNOWN_PROCESSES:                                                                                                                      done
No known services need to be restarted.
debug: looking for false positives in unknown processes
debug: looking at unknown process  (3336)
debug: looking at unknown process  (3337)
debug: looking at unknown process  (3335)
debug: looking at unknown process  (3338)

-> Warning: The following running processes did not match any known service but have been updated or deleted (or some deps)
->  If any of those match a custom service you can configure a service manually using 'CUSTOM_PROCESS_MAP'
=> 3336:  /sbin/agetty 38400 tty3 linux [exe=] (owner: root, root: /)
=> 3337:  /sbin/agetty 38400 tty4 linux [exe=] (owner: root, root: /)
=> 3335:  /sbin/agetty 38400 tty2 linux [exe=] (owner: root, root: /)
=> 3338:  /sbin/agetty --noclear 38400 tty1 linux [exe=] (owner: root, root: /)
mih ~ # readlink -e /proc/3338/exe
mih ~ # readlink /proc/3338/exe
/usr/bin/agetty (deleted)

also tried with inittab_killall with both /sbin/agetty and /usr/bin/agetty
Comment 10 Klemen Mihevc 2024-03-11 08:21:57 UTC
Also reported portage bug:

https://bugs.gentoo.org/926727
Comment 11 Marc Schiffbauer gentoo-dev 2024-03-11 11:33:21 UTC
Created attachment 887356 [details, diff]
patch to find symlinked inittab processes
Comment 12 Marc Schiffbauer gentoo-dev 2024-03-11 11:33:36 UTC
Hi Klemen,

can you verify, that the attached patch works for you? I managed to reproduce your bug and this fixed it for me.

Thanks!
Comment 13 Klemen Mihevc 2024-03-11 13:13:11 UTC
Now it works fine with with default inittab_kill to /sbin/agetty

in case you set inittab_kill to /usr/bin/agetty you get following error:

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing /sbin/agetty 38400 tty4 linux (pids 6730)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty4 linux (pids: 6730)
debug: 6730: checking pid 6730
debug: 6730: process root is /
debug: 6730: no direct hit: process /sbin/agetty 38400 tty4 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6730: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6730: /proc/6730/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty2 linux (pids 6738)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty2 linux (pids: 6738)
debug: 6738: checking pid 6738
debug: 6738: process root is /
debug: 6738: no direct hit: process /sbin/agetty 38400 tty2 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6738: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6738: /proc/6738/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty 38400 tty3 linux (pids 6744)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty 38400 tty3 linux (pids: 6744)
debug: 6744: checking pid 6744
debug: 6744: process root is /
debug: 6744: no direct hit: process /sbin/agetty 38400 tty3 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6744: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6744: /proc/6744/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: analyzing /sbin/agetty --noclear 38400 tty1 linux (pids 6750)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of /sbin/agetty --noclear 38400 tty1 linux (pids: 6750)
debug: 6750: checking pid 6750
debug: 6750: process root is /
debug: 6750: no direct hit: process /sbin/agetty --noclear 38400 tty1 linux has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 6750: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 6750: /proc/6750/environ: DRACUT_QUIET=yes CMDLINE= rd.driver.pre=btrfs   BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened root=UUID=46b93ef5-fde4-4968-9e36-6892f4533108 ro PWD=/ HOME=/ TERM=linux SHLVL=0 BOOT_IMAGE=/vmlinuz-6.7.9-gentoo-dist-hardened PATH=/sbin:/usr/sbin:/bin:/usr/bin SHELL=/bin/sh RUNLEVEL=3 PREVLEVEL=N CONSOLE=/dev/console INIT_VERSION=sysvinit-3.08
debug: 6750: analyzing remaining processes (not direct hits) ...
debug: 6750: TODO_PROCESSES_EXE: /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty /usr/bin/agetty
debug: 6730: checking exe /usr/bin/agetty
debug: 6730: process does not look like a script
debug: 6730: found package: sys-apps/util-linux
debug: 6730: inittab process found with alternate (symlinked) path: /sbin/agetty
debug: 6730: adding to INITTAB_PROCESSES: 6730:/sbin/agetty
debug: 6738: checking exe /usr/bin/agetty
debug: 6738: process does not look like a script
debug: 6738: found package: sys-apps/util-linux
debug: 6738: inittab process found with alternate (symlinked) path: /sbin/agetty
debug: 6738: adding to INITTAB_PROCESSES: 6738:/sbin/agetty
debug: 6744: checking exe /usr/bin/agetty
debug: 6744: process does not look like a script
debug: 6744: found package: sys-apps/util-linux
debug: 6744: inittab process found with alternate (symlinked) path: /sbin/agetty
debug: 6744: adding to INITTAB_PROCESSES: 6744:/sbin/agetty
debug: 6750: checking exe /usr/bin/agetty
debug: 6750: process does not look like a script
debug: 6750: found package: sys-apps/util-linux
debug: 6750: inittab process found with alternate (symlinked) path: /sbin/agetty
debug: 6750: adding to INITTAB_PROCESSES: 6750:/sbin/agetty                                                                                                    done
debug: 6730: checking if /sbin/agetty is a known inittab process
debug: 6730: '/sbin/agetty' added to FOUND_INITTAB_PROCESSES_UNKNOWN
debug: 6738: checking if /sbin/agetty is a known inittab process
debug: 6738: '/sbin/agetty' added to FOUND_INITTAB_PROCESSES_UNKNOWN
debug: 6744: checking if /sbin/agetty is a known inittab process
debug: 6744: '/sbin/agetty' added to FOUND_INITTAB_PROCESSES_UNKNOWN
debug: 6750: checking if /sbin/agetty is a known inittab process
debug: 6750: '/sbin/agetty' added to FOUND_INITTAB_PROCESSES_UNKNOWN
No known services need to be restarted.
=> /sbin/agetty (6730): Not killing unclassified inittab process (requires -u) ...
=> /sbin/agetty (6738): Not killing unclassified inittab process (requires -u) ...
=> /sbin/agetty (6744): Not killing unclassified inittab process (requires -u) ...
=> /sbin/agetty (6750): Not killing unclassified inittab process (requires -u) ...
debug: looking for false positives in unknown processes

So it works as it should with defaults... i do still think that issue with merge-usr and portage/portage-utils/gentoolkit should be somehow changed... :)
Comment 14 Klemen Mihevc 2024-03-11 13:14:16 UTC
But obviously thats out of scope of this issue now.
Comment 15 Klemen Mihevc 2024-03-12 07:20:57 UTC
I noticed another issue, not sure if its related to merge-usr and to not open another bug... today after openssh update:

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids 25705)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids: 25705)
debug: 25705: checking pid 25705
debug: 25705: process root is /
debug: 25705: no direct hit: process sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 25705: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 25705: /proc/25705/environ: onfig [listener] 0 of 10-100 startups                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                n
debug: analyzing sshd: root@pts/0 (pids 25715)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: root@pts/0 (pids: 25715)
debug: 25715: checking pid 25715
debug: 25705: lu_pid set to its ppid (was 25715)
debug: 25705: checking /usr/bin/sshd (pid 25715): we already found the ppid (25705) but did not find an init script yet
debug: 25705: checking env of pid 25715
debug: 25705: no luck, forgetting 25715
debug: 25705: analyzing remaining processes (not direct hits) ...
debug: 25705: TODO_PROCESSES_EXE: /usr/bin/sshd
debug: 25705: checking exe /usr/bin/sshd
debug: 25705: process does not look like a script
debug: 25705: does not belong to any package: /usr/bin/sshd
debug: 25705: adding to UNKNOWN_PROCESSES: /usr/bin/sshd                                                                                                       done
No known services need to be restarted.
debug: looking for false positives in unknown processes
debug: looking at unknown process /usr/bin/sshd (25705)

-> Warning: The following running processes did not match any known service but have been updated or deleted (or some deps)
->  If any of those match a custom service you can configure a service manually using 'CUSTOM_PROCESS_MAP'
=> 25705:  sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups [exe=/usr/bin/sshd] (owner: root, root: /)
  -> This is you! You may need to relogin/reconnect and/or restart your screen/tmux session to get rid of this
mih ~ # lib_users
25705 "sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups"
25715 "sshd: root@pts/0"

pid 25705 is actual sshd deamon that should be restarted while 25715 is "me".
Comment 16 Marc Schiffbauer gentoo-dev 2024-03-12 09:47:47 UTC
Created attachment 887467 [details, diff]
patch to find symlinked inittab processes
Comment 17 Marc Schiffbauer gentoo-dev 2024-03-12 09:48:58 UTC
The patch did not catch enough cases, can you please try the updated patch? That should include the sshd being installed in /usr/bin instead of /usr/sbin now
Comment 18 Klemen Mihevc 2024-03-12 10:17:09 UTC
Hello,

I tried it, now it restarts service but doesnt produce warning about relog.

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids 24357)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids: 24357)
debug: 24357: checking pid 24357
debug: 24357: process root is /
debug: 24357: no direct hit: process sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 24357: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 24357: /proc/24357/environ: onfig [listener] 0 of 10-100 startups                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                n
debug: analyzing sshd: root@pts/0 (pids 24368)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: root@pts/0 (pids: 24368)
debug: 24368: checking pid 24368
debug: 24357: lu_pid set to its ppid (was 24368)
debug: 24357: checking /usr/bin/sshd (pid 24368): we already found the ppid (24357) but did not find an init script yet
debug: 24357: checking env of pid 24368
debug: 24357: no luck, forgetting 24368
debug: 24357: analyzing remaining processes (not direct hits) ...
debug: 24357: TODO_PROCESSES_EXE: /usr/bin/sshd
debug: 24357: checking exe /usr/bin/sshd
debug: 24357: process does not look like a script
debug: 24357: found package: net-misc/openssh
debug: 24357: found init scripts: /etc/init.d/sshd
debug: 24357: found started service, adding init script: /etc/init.d/sshd                                                                                      done
debug: mapping service sshd:
debug:   SV_ALWAYS
=> sshd: Restarting...
debug: running rc-service sshd -- --ifstarted  restart
 * Caching service dependencies ...                                                                                                                       [ ok ]
 * Stopping sshd ...                                                                                                                                      [ ok ]
 * Starting sshd ...                                                                                                                                      [ ok ]
debug: looking for false positives in unknown processes
mih ~ # lib_users
24368 "sshd: root@pts/0"
Comment 19 Marc Schiffbauer gentoo-dev 2024-03-12 10:33:21 UTC
OK, what do you mean by "relog"? The warning about a user having to relogin to restart running session?
Comment 20 Klemen Mihevc 2024-03-12 10:35:59 UTC
(In reply to Marc Schiffbauer from comment #19)
> OK, what do you mean by "relog"? The warning about a user having to relogin
> to restart running session?

Yes there is no warning to relog to restart current session, but it does restart main service. I mean i dont need it, but since it was there before you probably want it working :)
Comment 21 Marc Schiffbauer gentoo-dev 2024-03-12 11:35:16 UTC
(In reply to Klemen Mihevc from comment #20)
> (In reply to Marc Schiffbauer from comment #19)
> > OK, what do you mean by "relog"? The warning about a user having to relogin
> > to restart running session?
> 
> Yes there is no warning to relog to restart current session, but it does
> restart main service. I mean i dont need it, but since it was there before
> you probably want it working :)

It seems to me, that this is an unrelated issue. Or can you see any different behavior between patched vs unpatched restart-servces?
Comment 22 Larry the Git Cow gentoo-dev 2024-03-12 12:08:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04ece1e06f0968a43bbf60353f2e2acdec9a42ed

commit 04ece1e06f0968a43bbf60353f2e2acdec9a42ed
Author:     Marc Schiffbauer <mschiff@gentoo.org>
AuthorDate: 2024-03-12 12:07:00 +0000
Commit:     Marc Schiffbauer <mschiff@gentoo.org>
CommitDate: 2024-03-12 12:07:51 +0000

    app-admin/restart-services: add 1.1
    
    Closes: https://bugs.gentoo.org/926219
    Signed-off-by: Marc Schiffbauer <mschiff@gentoo.org>

 app-admin/restart-services/Manifest                |  1 +
 .../restart-services/restart-services-1.1.ebuild   | 36 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)
Comment 23 Klemen Mihevc 2024-03-12 13:28:09 UTC
Since there was an update i didnt know if i should open new bug or not but anyway... here it is restart-services-1.0 (unpatched):

mih ~ # restart-services -d
debug: this is restart-services version 1.0
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids 24007)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids: 24007)
debug: 24007: checking pid 24007
debug: 24007: process root is /
debug: 24007: no direct hit: process sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 24007: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 24007: /proc/24007/environ: onfig [listener] 0 of 10-100 startups                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             n
debug: analyzing sshd: root@pts/0 (pids 24958)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: root@pts/0 (pids: 24958)
debug: 24958: checking pid 24958
debug: 24007: lu_pid set to its ppid (was 24958)
debug: 24007: checking /usr/bin/sshd (pid 24958): we already found the ppid (24007) but did not find an init script yet
debug: 24007: checking env of pid 24958
debug: 24007: no luck, forgetting 24958
debug: 24007: analyzing remaining processes (not direct hits) ...
debug: 24007: TODO_PROCESSES_EXE: /usr/bin/sshd
debug: 24007: checking exe /usr/bin/sshd
debug: 24007: process does not look like a script
debug: 24007: does not belong to any package: /usr/bin/sshd
debug: 24007: adding to UNKNOWN_PROCESSES: /usr/bin/sshd                                                                                                       done
No known services need to be restarted.
debug: looking for false positives in unknown processes
debug: looking at unknown process /usr/bin/sshd (24007)

-> Warning: The following running processes did not match any known service but have been updated or deleted (or some deps)
->  If any of those match a custom service you can configure a service manually using 'CUSTOM_PROCESS_MAP'
=> 24007:  sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups [exe=/usr/bin/sshd] (owner: root, root: /)
  -> This is you! You may need to relogin/reconnect and/or restart your screen/tmux session to get rid of this

mih ~ # lib_users
24007 "sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups"
24958 "sshd: root@pts/0"


it detects change in sshd, but only gives warning on wrong processs.
Comment 24 Klemen Mihevc 2024-03-12 13:29:04 UTC
And here is with updated restart-services-1.1

mih ~ # restart-services -d
debug: this is restart-services version 1.1
debug: using lib_users 0.15
debug: detect_init() called
debug: INIT is set to openrc
debug: loading config file: /etc/restart-services.conf
debug: loading config file: /etc/restart-services.d/00-local.conf
debug: configuration summary:
debug:   INITTAB_KILLALL: /sbin/agetty
debug:   SV_ALWAYS: acpid apache2 chronyd cronie dovecot fail2ban kea miniupnpd monit mysql named plex-media-server postfix redis rspamd qbittorrent radvd sshd udpxy vlmcsd vnstatd wsdd
debug:   SV_ALWAYS_RELOAD_ONLY:
debug:   SV_ALWAYS_WITH_NODEPS: syslog-ng udev
debug:   SV_CRITICAL: ipsec samba
debug:   SV_CRITICAL_WITH_NODEPS:
debug:   SV_IGNORE:
-> Searching for services that need to be restarted ...  debug: analyzing lib_users output ...
debug: analyzing sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids 24007)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups (pids: 24007)
debug: 24007: checking pid 24007
debug: 24007: process root is /
debug: 24007: no direct hit: process sshd: /usr/sbin/sshd -o PidFile=/run/sshd.pid -f /etc/ssh/sshd_config [listener] 0 of 10-100 startups has no RC_SERVICE env set, adding to TODO_PROCESSES
debug: 24007: WARNING: Including process environment. This might contain sensitive data. Please revise carefully before including it in bugreports.
debug: 24007: /proc/24007/environ: onfig [listener] 0 of 10-100 startups                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             n
debug: analyzing sshd: root@pts/0 (pids 24958)
debug: checking for custom process mapping ...
debug: trying pattern match on rspamd*
debug: no match found
debug: checking processes of sshd: root@pts/0 (pids: 24958)
debug: 24958: checking pid 24958
debug: 24007: lu_pid set to its ppid (was 24958)
debug: 24007: checking /usr/bin/sshd (pid 24958): we already found the ppid (24007) but did not find an init script yet
debug: 24007: checking env of pid 24958
debug: 24007: no luck, forgetting 24958
debug: 24007: analyzing remaining processes (not direct hits) ...
debug: 24007: TODO_PROCESSES_EXE: /usr/bin/sshd
debug: 24007: checking exe /usr/bin/sshd
debug: 24007: process does not look like a script
debug: 24007: found package: net-misc/openssh
debug: 24007: found init scripts: /etc/init.d/sshd
debug: 24007: found started service, adding init script: /etc/init.d/sshd                                                                                      done
debug: mapping service sshd:
debug:   SV_ALWAYS
=> sshd: Restarting...
debug: running rc-service sshd -- --ifstarted  restart
 * Caching service dependencies ...                                                                                                                       [ ok ]
 * Stopping sshd ...                                                                                                                                      [ ok ]
 * Starting sshd ...                                                                                                                                      [ ok ]
debug: looking for false positives in unknown processes

mih ~ # lib_users
24958 "sshd: root@pts/0"

as expected it restarts ssh main process, but doesnt give warning on open session relog.
Comment 25 Marc Schiffbauer gentoo-dev 2024-03-12 16:04:08 UTC
Ok, so its a regression. Can you please upload the output of

   lib_users -m -I /anon_hugepage -i '/tmp/*'

?
Thanks!
Comment 26 Klemen Mihevc 2024-03-12 18:04:28 UTC
(In reply to Marc Schiffbauer from comment #25)
> Ok, so its a regression. Can you please upload the output of
> 
>    lib_users -m -I /anon_hugepage -i '/tmp/*'
> 
> ?
> Thanks!

okey

mih ~ # lib_users -m -I /anon_hugepage -i '/tmp/*'
31621;/usr/bin/sshd;sshd: root@pts/0
Comment 27 Klemen Mihevc 2024-03-12 18:05:55 UTC
(In reply to Klemen Mihevc from comment #26)
> (In reply to Marc Schiffbauer from comment #25)
> > Ok, so its a regression. Can you please upload the output of
> > 
> >    lib_users -m -I /anon_hugepage -i '/tmp/*'
> > 
> > ?
> > Thanks!
> 
> okey
> 
> mih ~ # lib_users -m -I /anon_hugepage -i '/tmp/*'
> 31621;/usr/bin/sshd;sshd: root@pts/0

this was just after update and before relog.
Comment 28 Marc Schiffbauer gentoo-dev 2024-03-13 08:49:15 UTC
(In reply to Klemen Mihevc from comment #27)
> (In reply to Klemen Mihevc from comment #26)
> > (In reply to Marc Schiffbauer from comment #25)
> > > Ok, so its a regression. Can you please upload the output of
> > > 
> > >    lib_users -m -I /anon_hugepage -i '/tmp/*'
> > > 
> > > ?
> > > Thanks!
> > 
> > okey
> > 
> > mih ~ # lib_users -m -I /anon_hugepage -i '/tmp/*'
> > 31621;/usr/bin/sshd;sshd: root@pts/0
> 
> this was just after update and before relog.

Ok, thats short;)

Ich will rework some parts of that reporting and the result will propably be in 1.2 then, thanks again!