Prompting for input before tty1 with systemd?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to understand systemd more and figure out how to modify the startup process. What I'm trying to do is prompt the user for an input before loading the login screen.
I went ahead and ran "systemctl list-dependencies getty@tty1.service" and got the below (not full output):
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂsysinit.target
From what I understand, everything in the tree is either a hard/soft dependency, so I created a basic service unit file as such:
[Unit]
Description=Something to do
[Service]
ExecStart=/root/script.sh
[Install]
RequiredBy=getty@tty1.service
I went and enabled the service and re-checked the dependencies for getty@tty1.service and saw:
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂwantedservice.service
âÂÂâÂÂsysinit.target
So I'm assuming now getty@tty1.service will not start until wantedservice is active (wantedservice is just a bash script asking for user input and then echoing it back out) due to the "RequiredBy" initiative, but it simply isn't the case; the login screen will still come up and when I check the status of wantedservice after login it just says inactive.
Here is "script.sh" just in case:
#!/bin/bash
echo "What is your name?"
read _name
echo "Hello $_name!"
So here are some questions I have:
1) How does systemd decide if a service is "active" (in my case, does it consider my service "active" after the script completes?"
2) I sometimes see my script pop up for a second before the login screen basically overtakes it, so it's loading, but its just not sticking around waiting for input, any idea what might be happening there?
I'm don't think it's relevant but all this is being done from a Debian 9 VM if it matters. Thanks all!
debian systemd
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
I'm trying to understand systemd more and figure out how to modify the startup process. What I'm trying to do is prompt the user for an input before loading the login screen.
I went ahead and ran "systemctl list-dependencies getty@tty1.service" and got the below (not full output):
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂsysinit.target
From what I understand, everything in the tree is either a hard/soft dependency, so I created a basic service unit file as such:
[Unit]
Description=Something to do
[Service]
ExecStart=/root/script.sh
[Install]
RequiredBy=getty@tty1.service
I went and enabled the service and re-checked the dependencies for getty@tty1.service and saw:
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂwantedservice.service
âÂÂâÂÂsysinit.target
So I'm assuming now getty@tty1.service will not start until wantedservice is active (wantedservice is just a bash script asking for user input and then echoing it back out) due to the "RequiredBy" initiative, but it simply isn't the case; the login screen will still come up and when I check the status of wantedservice after login it just says inactive.
Here is "script.sh" just in case:
#!/bin/bash
echo "What is your name?"
read _name
echo "Hello $_name!"
So here are some questions I have:
1) How does systemd decide if a service is "active" (in my case, does it consider my service "active" after the script completes?"
2) I sometimes see my script pop up for a second before the login screen basically overtakes it, so it's loading, but its just not sticking around waiting for input, any idea what might be happening there?
I'm don't think it's relevant but all this is being done from a Debian 9 VM if it matters. Thanks all!
debian systemd
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to understand systemd more and figure out how to modify the startup process. What I'm trying to do is prompt the user for an input before loading the login screen.
I went ahead and ran "systemctl list-dependencies getty@tty1.service" and got the below (not full output):
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂsysinit.target
From what I understand, everything in the tree is either a hard/soft dependency, so I created a basic service unit file as such:
[Unit]
Description=Something to do
[Service]
ExecStart=/root/script.sh
[Install]
RequiredBy=getty@tty1.service
I went and enabled the service and re-checked the dependencies for getty@tty1.service and saw:
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂwantedservice.service
âÂÂâÂÂsysinit.target
So I'm assuming now getty@tty1.service will not start until wantedservice is active (wantedservice is just a bash script asking for user input and then echoing it back out) due to the "RequiredBy" initiative, but it simply isn't the case; the login screen will still come up and when I check the status of wantedservice after login it just says inactive.
Here is "script.sh" just in case:
#!/bin/bash
echo "What is your name?"
read _name
echo "Hello $_name!"
So here are some questions I have:
1) How does systemd decide if a service is "active" (in my case, does it consider my service "active" after the script completes?"
2) I sometimes see my script pop up for a second before the login screen basically overtakes it, so it's loading, but its just not sticking around waiting for input, any idea what might be happening there?
I'm don't think it's relevant but all this is being done from a Debian 9 VM if it matters. Thanks all!
debian systemd
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm trying to understand systemd more and figure out how to modify the startup process. What I'm trying to do is prompt the user for an input before loading the login screen.
I went ahead and ran "systemctl list-dependencies getty@tty1.service" and got the below (not full output):
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂsysinit.target
From what I understand, everything in the tree is either a hard/soft dependency, so I created a basic service unit file as such:
[Unit]
Description=Something to do
[Service]
ExecStart=/root/script.sh
[Install]
RequiredBy=getty@tty1.service
I went and enabled the service and re-checked the dependencies for getty@tty1.service and saw:
getty@tty1.service
âÂÂâÂÂsystem-getty.slice
âÂÂâÂÂwantedservice.service
âÂÂâÂÂsysinit.target
So I'm assuming now getty@tty1.service will not start until wantedservice is active (wantedservice is just a bash script asking for user input and then echoing it back out) due to the "RequiredBy" initiative, but it simply isn't the case; the login screen will still come up and when I check the status of wantedservice after login it just says inactive.
Here is "script.sh" just in case:
#!/bin/bash
echo "What is your name?"
read _name
echo "Hello $_name!"
So here are some questions I have:
1) How does systemd decide if a service is "active" (in my case, does it consider my service "active" after the script completes?"
2) I sometimes see my script pop up for a second before the login screen basically overtakes it, so it's loading, but its just not sticking around waiting for input, any idea what might be happening there?
I'm don't think it's relevant but all this is being done from a Debian 9 VM if it matters. Thanks all!
debian systemd
debian systemd
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 5 mins ago
vng21092
11
11
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
vng21092 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
vng21092 is a new contributor. Be nice, and check out our Code of Conduct.
vng21092 is a new contributor. Be nice, and check out our Code of Conduct.
vng21092 is a new contributor. Be nice, and check out our Code of Conduct.
vng21092 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478128%2fprompting-for-input-before-tty1-with-systemd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password