Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938262 - sys-process/runit-2.1.2-r3 does not reboot the machine
Summary: sys-process/runit-2.1.2-r3 does not reboot the machine
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-08-21 07:00 UTC by tberger2
Modified: 2024-09-05 14:42 UTC (History)
5 users (show)

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


Attachments
emerge --info (emerge.info,6.16 KB, text/plain)
2024-08-21 07:00 UTC, tberger2
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tberger2 2024-08-21 07:00:44 UTC
Created attachment 900843 [details]
emerge --info

sys-process/runit-2.1.2-r3 does not reboot the machine when pressing ctrl-alt-del whereas sys-process/runit-2.1.2-r1 works correctly.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-08-21 14:56:42 UTC
-r1 vs -r2:

commit 0e256f242d7ce36744c2165fd639bebe7f9b6589
Author: Robin H. Johnson <robbat2@gentoo.org>
Date:   Sat Jun 15 23:02:59 2024 -0700

    sys-process/runit: EAPI=8 porting and other fixes

    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
    Closes: https://bugs.gentoo.org/show_bug.cgi?id=920357
    Closes: https://bugs.gentoo.org/show_bug.cgi?id=875533
    Closes: https://bugs.gentoo.org/show_bug.cgi?id=721880
    Closes: https://bugs.gentoo.org/show_bug.cgi?id=590412
Comment 2 Mike Gilbert gentoo-dev 2024-08-21 15:28:43 UTC
The major change seems to be several patches being applied from Debian.
Comment 3 Larry the Git Cow gentoo-dev 2024-08-22 14:35:10 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9646b294a24fa9b7a6a89ba54e9ece4947635046

commit 9646b294a24fa9b7a6a89ba54e9ece4947635046
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2024-08-22 14:33:13 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2024-08-22 14:33:13 +0000

    sys-process/runit: restore 2.1.2-r1
    
    Allow users to downgrade to avoid reboot regression.
    
    Bug: https://bugs.gentoo.org/938262
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-process/runit/runit-2.1.2-r1.ebuild | 138 ++++++++++++++++++++++++++++++++
 1 file changed, 138 insertions(+)
Comment 4 Mike Gilbert gentoo-dev 2024-08-22 14:36:42 UTC
(In reply to Mike Gilbert from comment #2)
> The major change seems to be several patches being applied from Debian.

s/Debian/Ubuntu/
Comment 5 Zhixu Liu 2024-08-22 14:51:43 UTC
(In reply to tberger2 from comment #0)
> Created attachment 900843 [details]
> emerge --info
> 
> sys-process/runit-2.1.2-r3 does not reboot the machine when pressing
> ctrl-alt-del whereas sys-process/runit-2.1.2-r1 works correctly.

This might related with debian patch: 0007-move-communication-files.patch
which said:

Runit by default uses files /etc/runit/stop and /etc/runit/reboot.
This configuration will not work when /etc is mounted read-only,
as such this patch renames this files into /run/runit.stop and
/run/runit.reboot

@tberger2, could you please help provide following information:
1. cat /etc/runit/ctrlaltdel
2. strings sbin/runit|grep runit

if  /etc/runit/stopit is in 1, and /run/runit.stopit is in 2, then please modify 
/etc/runit/ctrlaltdel, and test bug fixed or not.

If bug fixed, we need to fix /var/db/repos/gentoo/sys-process/runit/files/ctrlaltdel
Comment 6 Alex Efros 2024-08-22 17:06:36 UTC
May also worth comparing ubuntu patches with ones mentioned in https://skarnet.org/lists/supervision/3174.html and followup message https://skarnet.org/lists/supervision/3175.html.
Comment 7 Alex Efros 2024-08-22 17:16:12 UTC
(In reply to Zhixu Liu from comment #5)
> Runit by default uses files /etc/runit/stop and /etc/runit/reboot.
> This configuration will not work when /etc is mounted read-only,

Is there any Gentoo users who needs/asks for such a configuration at all?
If not, then do we actually needs to make such a change?
It's not a trivial one, because users may already have custom /etc/runit/ctrlaltdel (which wasn't installed by the package before -r3 at all), and we need to provide some upgrade path/guidance in this case.

I mean, it makes sense to minimize changes to just newer GCC support.
And after that, maybe, consider making other changes, probably making them optional and non-default with USE flags.
Comment 8 Alex Efros 2024-08-22 17:25:28 UTC
(In reply to Alex Efros from comment #6)
> May also worth comparing ubuntu patches with ones mentioned in
> https://skarnet.org/lists/supervision/3174.html and followup message
> https://skarnet.org/lists/supervision/3175.html.

At a glance these ones looks reasonable and mostly avoid unrelated (to newer GCC) changes.
Comment 9 tberger2 2024-08-22 17:51:20 UTC
(In reply to Zhixu Liu from comment #5)
> @tberger2, could you please help provide following information:
> 1. cat /etc/runit/ctrlaltdel
#!/bin/sh
PATH=/bin:/usr/bin
touch /etc/runit/reboot
chmod 100 /etc/runit/reboot

> 2. strings sbin/runit|grep runit
- runit: fatal: 
- runit: 
- runit: warning: 
/etc/runit/1
/etc/runit/ctrlaltdel
/etc/runit/stopit
/etc/runit/2
/etc/runit/reb
Comment 10 tberger2 2024-08-22 20:02:28 UTC
(In reply to tberger2 from comment #9)
> > 2. strings sbin/runit|grep runit
> - runit: fatal: 
> - runit: 
> - runit: warning: 
> /etc/runit/1
> /etc/runit/ctrlaltdel
> /etc/runit/stopit
> /etc/runit/2
> /etc/runit/reb

Sry, this was for sys-process/runit-2.1.2-r1.

For sys-process/runit-2.1.2-r3 it is

strings /sbin/runit|grep runit
/etc/runit/nosync
- runit: fatal: 
- runit: 
- runit: warning: 
/etc/runit/1
/etc/runit/ctrlaltdel
/run/runit.stopit
/etc/runit/2
/run/runit.reboot
/etc/runit/3
Comment 11 Zhixu Liu 2024-08-23 00:53:46 UTC
(In reply to tberger2 from comment #10)
> (In reply to tberger2 from comment #9)
> > > 2. strings sbin/runit|grep runit
> > - runit: fatal: 
> > - runit: 
> > - runit: warning: 
> > /etc/runit/1
> > /etc/runit/ctrlaltdel
> > /etc/runit/stopit
> > /etc/runit/2
> > /etc/runit/reb
> 
> Sry, this was for sys-process/runit-2.1.2-r1.
> 
> For sys-process/runit-2.1.2-r3 it is
> 
> strings /sbin/runit|grep runit
> /etc/runit/nosync
> - runit: fatal: 
> - runit: 
> - runit: warning: 
> /etc/runit/1
> /etc/runit/ctrlaltdel
> /run/runit.stopit
> /etc/runit/2
> /run/runit.reboot
> /etc/runit/3

thanks, please help test w/ runit-2.1.2-r3:

1. cp -ar /etc/runit /etc/runit.bak
2. sed -i.bak 's:/etc/runit/:/run/runit.:g' /etc/runit/{1,3,ctrlaltdel}

then pressing ctrl-alt-del
Comment 12 tberger2 2024-08-23 06:46:44 UTC
(In reply to Zhixu Liu from comment #11)

> thanks, please help test w/ runit-2.1.2-r3:
> 
> 1. cp -ar /etc/runit /etc/runit.bak
> 2. sed -i.bak 's:/etc/runit/:/run/runit.:g' /etc/runit/{1,3,ctrlaltdel}
> 
> then pressing ctrl-alt-del

This powers off my machine, which could have to do with my modified system.
Unfortunately I haven't got the time to check right now, but here are my config files:


cat /etc/runit/1

#!/bin/sh 
PATH=/sbin:/usr/sbin:/bin:/usr/bin
         
mount -o nosuid,noexec,nodev -t proc proc /proc &
mount -o nosuid,noexec,nodev -t sysfs sys /sys &
mount -o mode=0755,noatime -t tmpfs tmpfs /run &
mount -o mode=0755,relatime -t devtmpfs dev /dev
wait

mkdir -p -m0755 /dev/pts /run/shm
ln -s /dev/sda2 /dev/root
ln -s /run/shm /dev/shm
ln -s /proc/self/fd /dev/fd
ln -s /proc/self/fd/0 /dev/stdin
mkdir -p -m1777 /dev/mqueue

mount -o noexec,nosuid,nodev -n -t mqueue mqueue /dev/mqueue &
mount -o mode=0620,gid=5,nosuid,noexec -n -t devpts devpts /dev/pts &
mount -o mode=1777,nosuid,nodev -n -t tmpfs shm /run/shm &
wait

/lib/systemd/systemd-udevd --daemon &
udevadm trigger --action=add --type=subsystems &
udevadm trigger --action=add --type=devices &
#udevadm settle
mount -o rw,relatime -t efivarfs efivarfs /sys/firmware/efi/efivars

echo myhost > /proc/sys/kernel/hostname &

sysctl -q --system &
wait

mount -o remount,rw /
mount -a -t nosysfs &
rm -rf /tmp/* /tmp/.* > /dev/null 2>&1
rm -fr /var/lock
rm -fr /run/lock
mkdir /run/lock
ln -s /run/lock /var/lock

touch /run/utmp
chown root:utmp /run/utmp; chmod g+w /run/utmp

touch /run/runit.stopit
chmod 100 /run/runit.stopit

loadkeys de-latin1
cat /var/lib/misc/random-seed > /dev/urandom >/dev/null 2>&1
/sbin/nft -f /etc/nftables.conf
#alsactl restore
ifconfig lo 127.0.0.1/8 netmask 255.255.255.0 broadcast 127.255.255.255

fallocate -l 16G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile



cat /etc/runit/3

#!/bin/sh 
exec >/dev/console 2>&1
PATH=/sbin:/usr/sbin:/bin:/usr/bin
        
chvt 1
{ stty sane ; echo ; } > /dev/console
        
hwclock --systohc
alsactl store

psz=$(( $(sysctl -n kernel.random.poolsize 2>/dev/null || echo 4096) / 4096 ))
(umask 077; dd if=/dev/urandom of=/var/lib/misc/random-seed count=$psz 2>/dev/null)

sv force-stop /etc/service/* & > /dev/null 2>&1 || :

pkill --inverse -s0,1 -TERM
sleep 1
pkill --inverse -s0,1 -KILL

sync; sync  > /dev/null 2>&1
rm -f /etc/mtab~* /etc/mtab.fuselock
rm -rf /tmp/* /tmp/.* > /dev/null 2>&1        
umount -r -l -a -t nosysfs,noproc,nodevtmpfs,notmpfs & > /dev/null 2>&1

echo > /etc/resolv.conf

[[ -f /swapfile ]] && swapoff -a && rm -f /swapfile
mount -o remount,ro /

test -x /run/runit.reboot && LAST=6    || LAST=0
test -x /run/runit.reboot && RC=reboot || RC=shutdown
RUNLEVEL=$LAST /sbin/rc $RC
Comment 13 Larry the Git Cow gentoo-dev 2024-08-23 07:28:09 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9be26a09a959cb567fbc0d9281727a8876ccbbea

commit 9be26a09a959cb567fbc0d9281727a8876ccbbea
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-08-23 07:23:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-08-23 07:27:48 +0000

    sys-process/runit: drop 2.1.2-r3 (broken at runtime)
    
    Bug: https://bugs.gentoo.org/938262
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-process/runit/Manifest              |   1 -
 sys-process/runit/runit-2.1.2-r3.ebuild | 149 --------------------------------
 2 files changed, 150 deletions(-)
Comment 14 Zhixu Liu 2024-08-23 08:45:25 UTC
(In reply to tberger2 from comment #12)
> (In reply to Zhixu Liu from comment #11)
> 
> 
> cat /etc/runit/1
> 
> cat /etc/runit/3

No file /etc/runit/ctrlaltdel ?
Comment 15 tberger2 2024-08-23 08:53:50 UTC
(In reply to Zhixu Liu from comment #14)
> (In reply to tberger2 from comment #12)
> > (In reply to Zhixu Liu from comment #11)
> > 
> > 
> > cat /etc/runit/1
> > 
> > cat /etc/runit/3
> 
> No file /etc/runit/ctrlaltdel ?

https://bugs.gentoo.org/938262#c9
Comment 16 Zhixu Liu 2024-08-23 09:24:07 UTC
(In reply to tberger2 from comment #15)
> (In reply to Zhixu Liu from comment #14)
> > (In reply to tberger2 from comment #12)
> > > (In reply to Zhixu Liu from comment #11)
> > > 
> > > 
> > > cat /etc/runit/1
> > > 
> > > cat /etc/runit/3
> > 
> > No file /etc/runit/ctrlaltdel ?
> 
> https://bugs.gentoo.org/938262#c9

ok, so did you replace /etc/runit/reboot to /run/runit.reboot in file /etc/runit/ctrlaltdel ?
Comment 17 tberger2 2024-08-24 06:24:02 UTC
(In reply to Zhixu Liu from comment #16)
> ok, so did you replace /etc/runit/reboot to /run/runit.reboot in file
> /etc/runit/ctrlaltdel ?

Sorry for the little confusion:

emerge -pv runit
[ebuild   R   #] sys-process/runit-2.1.2-r3::gentoo  USE="-static" 0 KiB

/etc/runit/1
...
touch /run//stopit
chmod 100 /run/stopit
...

/etc/runit/ctrlaltdel
...
touch /run/reboot
chmod 100 /run/reboot
...

/etc/runit/3
...
test -x /run/reboot && LAST=6    || LAST=0
test -x /run/reboot && RC=reboot || RC=shutdown
RUNLEVEL=$LAST /sbin/rc $RC

does NOT rebbot the machine.
Comment 18 Larry the Git Cow gentoo-dev 2024-09-05 14:42:51 UTC
The bug has been closed via the following commit(s):

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

commit f0506961c5d9a3edacdf0bfe041fc84753665e4f
Author:     Z. Liu <zhixu.liu@gmail.com>
AuthorDate: 2024-08-23 16:35:50 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2024-09-05 14:40:12 +0000

    sys-process/runit: fix errors & warnings with clang 18/gcc 15
    
    20 patches from https://github.com/clan/runit/tree/ftbfs.v4 , which are divided
    into the following categories:
    
    1. patch: 0001
       purpose: helpful for development & debug: make full command line & result
                available in build.log, otherwise extra directives are required
                when debug
    2. patch: 0002, 0003, 0004, 0005, 0006
       purpose: required, build will failed if not apply
                0005 & 0006 are warnings only for gcc < 14, errors if gcc >= 14
    3. patch: 0007
       purpose: patch from author w/ new feature provided, but don't change any
                "user-observable functionality"
    4. patch: 0008
       purpose: documentation change: w/ tiny (unlikely to cause problem)
                modification of source code
    5. patch: 0009 - 0019
       purpose: fix compilation warnings reported by gcc/clang, with -Wall,
                -Wextra
    6. patch: 0020
       purpose: usleep is obsoleted in POSIX.1-2001, handled this in compile
                time by feature test macro, replace w/ nanosleep if available
    
    Closes: https://bugs.gentoo.org/934410
    Closes: https://bugs.gentoo.org/938262
    Closes: https://bugs.gentoo.org/938282
    Closes: https://github.com/clan/runit/issues/2
    Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
    Tested-by: Alex Efros <powerman-asdf@yandex.ru>
    Closes: https://github.com/gentoo/gentoo/pull/38425
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-process/runit/Manifest                               |  1 +
 sys-process/runit/metadata.xml                           | 12 +++++++++++-
 .../{runit-2.1.2-r4.ebuild => runit-2.1.2-r5.ebuild}     | 16 +++++++++++++++-
 3 files changed, 27 insertions(+), 2 deletions(-)