Skip to content

Remove agetty services for missing devices#194

Closed
raindev wants to merge 1 commit intovoid-linux:masterfrom
raindev:agetty-services-clean-up
Closed

Remove agetty services for missing devices#194
raindev wants to merge 1 commit intovoid-linux:masterfrom
raindev:agetty-services-clean-up

Conversation

@raindev
Copy link
Copy Markdown

@raindev raindev commented Mar 3, 2021

The most common offenders are agetty-hvsi0 and agetty-hvc0. agetty
services started for devices that do not exist end up failing with

cannot open as standard input: No such file or directory

runit restarts such services resulting in syslog being flooded
with error messages.

Closes #193


A "test case":

$ ls /var/service | grep agetty
agetty-hvc0
agetty-hvsi0
agetty-tty1
agetty-tty2
agetty-tty3
agetty-tty4
agetty-tty5
agetty-tty6

$ cat /tmp/agetty
#!/bin/bash
set -euo pipefail

for service in /var/service/agetty-*; do
    if [ ! -e /dev/"$(cut -d'-' -f2 <<< "$service")" ]; then
        rm -v "$service"
    fi
done

$ sudo /tmp/agetty
removed '/var/service/agetty-hvc0'
removed '/var/service/agetty-hvsi0'

$ ls /var/service/ | grep agetty
agetty-tty1
agetty-tty2
agetty-tty3
agetty-tty4
agetty-tty5
agetty-tty6

Note that I only verified the snipped outside of the installer. If you think it makes sense to test it as a part of the installation process, I can do that too.

The most common offenders are agetty-hvsi0 and agetty-hvc0. agetty
services started for devices that do not exist end up failing with

cannot open as standard input: No such file or directory

runit restarts such services resulting in syslog being flooded
with error messages.

Closes #193
Comment thread installer.sh.in

# remove agetty services for devices that are not present
for service in /var/service/agetty-*; do
if [ ! -e /dev/"$(cut -d'-' -f2 <<< "$service")" ]; then
Copy link
Copy Markdown
Member

@Duncaen Duncaen Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for service in /var/service/agetty-*; do
    [ -e "/dev/${service#*agetty-}" ] || rm -v "$service"
done

But shouldn't this be done in $TARGETDIR?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should instead figure out why those services are getting auto-enabled in the first place, and then fix that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dracut hook enables all installed services on boot that are not excludes: https://github.com/void-linux/void-mklive/blob/master/dracut/vmklive/services.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, since this dracut hook includes ttyS* already, it would make sense to add hvc0 and hvsi0 in there as well

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, i have that already done here, along with proper enablement of serial console in live: void-ppc@8a3c5c0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see this fixed, albeit not the way I imagined.

How would the people that needs hvc0/hvsi consoles would enable them? Would that be specifying console on the command line (similarly as done for GCP images here), taken into account by dracut script of the live ISO (here)?

Copy link
Copy Markdown

@q66 q66 Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah just add the console= you want, e.g. console=hvc0 or console=ttyS0 and the new dracut hook will pick it up and enable the service

the only people who need hvc0 are users of openpower machines (ibm power8/power9) which expose the serial port through a firmware abstraction rather than directly, and some xen users; hvsi0 will have even fewer users

@q66 q66 closed this in 51d4a5f Mar 5, 2021
@raindev raindev deleted the agetty-services-clean-up branch March 5, 2021 14:36
the-maldridge pushed a commit to the-maldridge/void-mklive that referenced this pull request Oct 1, 2022
also blacklist more agettys to fix the hvc0/hvsi0 issue

Closes void-linux/void-mklive#194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agetty service enabled for non-existent devices

3 participants