Timeline for Difference between systemd and terminal starting program
Current License: CC BY-SA 4.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 12, 2018 at 18:20 | history | edited | Mark Stosberg | CC BY-SA 4.0 |
Add restricted command line syntax to this FAQ.
|
| May 4, 2018 at 17:59 | comment | added | Mark Stosberg | @JoshKelley Thanks for the tip. That's not a difference between systemd and the CLI but between systemd and sysVinit init.d scripts. | |
| May 4, 2018 at 17:11 | comment | added | Josh Kelley | One other difference, which may be obvious but which bit me today, is that systemd tries to track the status of a service and won't start it if it thinks it's already active, so it may not even launch an init.d script if it thinks the service is running. By contrast, init.d scripts are typically written to always check and try to start the service as appropriate. | |
| Apr 20, 2018 at 13:41 | history | edited | Mark Stosberg | CC BY-SA 3.0 |
Improve environment variables section, add more hyperlinked docs.
|
| Apr 16, 2018 at 23:56 | history | edited | Mark Stosberg | CC BY-SA 3.0 |
Add note about relative vs absolute paths.
|
| Apr 13, 2017 at 12:36 | history | edited | CommunityBot |
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
|
|
| Apr 13, 2017 at 12:22 | history | edited | CommunityBot |
replaced http://askubuntu.com/ with https://askubuntu.com/
|
|
| Jan 24, 2017 at 16:37 | vote | accept | Brett Reinhard | ||
| Jan 24, 2017 at 16:37 | comment | added | Brett Reinhard |
I solved my issue multiple ways in my attempt to understand what was happening. Ultimately, what I ended up doing was changing my kill command to /usr/bin/echo "mypassword" | /usr/bin/sudo /bin/pkill arecord. Later on today, I will try removing the sudo and echo commands to my kill command and see if that yields the same results. My guess is that will work, as it seems that the error was caused by no password being sent with the sudo command. Thank you for the help in understanding as to why there is a difference between systemd and the CLI
|
|
| Jan 24, 2017 at 16:26 | comment | added | Mark Stosberg |
Normally using sudo with the root user doesn't prompt for a password, but something is clearly attempting to use a TTY and there is no TTY in the systemd context. Figure out what's trying to use a TTY and make it stop, or see if there's an option force a pseudo-tty allocation that you can script passing something to. Both sudo and ssh have pseudo-tty options.
|
|
| Jan 24, 2017 at 16:24 | comment | added | Michael D. |
@BrettReinhard Do not call sudo in a shell script better run sudo shairportstart.sh from terminal, since systemd is running the script as root, no need to sudo as root.
|
|
| Jan 24, 2017 at 16:19 | history | edited | Mark Stosberg | CC BY-SA 3.0 |
Add new "No TTY" bullet point.
|
| Jan 24, 2017 at 16:14 | comment | added | Brett Reinhard |
So the error that is happening is : sudo: no tty present and no askpass program specified. Which to me begs the question when a script run as root uses sudo will it require a password input? Or is this error more specifically due to no tty present? Thank you for your patience in answering my questions.
|
|
| Jan 24, 2017 at 15:56 | comment | added | Mark Stosberg | Correct. Any sub process would inherit the ownership and privileges of the parent. | |
| Jan 24, 2017 at 15:39 | comment | added | Brett Reinhard |
given that shairport-sync is a system unit. Say for example shairport-sync were to run some script named deviceconnectionhandler which would be in control of running the scripts that are executed when a device connects or disconnects. Would the scripts run by deviceconnectionhandler also have the root privilege and not need sudo?
|
|
| Jan 24, 2017 at 15:07 | comment | added | Mark Stosberg |
systemd system units run as root by default, so sudo would not be needed.
|
|
| Jan 24, 2017 at 14:39 | comment | added | Brett Reinhard |
I believe the error that I seemed to encountered is somehow related to when /etc/sudoers gets loaded to the system. It is my understanding that when systemd starts a given program, such as shairport-sync sudo rules have not been loaded. Given that you suggested that system runs in a consistent environment and shairport-sync was run in that environment, it will require a password for using sudo. Where if it were run in /etc/rc.local sudoers would be loaded and not need the password
|
|
| Jan 24, 2017 at 12:11 | history | edited | Mark Stosberg | CC BY-SA 3.0 |
Add new point re: login shells.
|
| Jan 24, 2017 at 8:26 | comment | added | Bigon | Also need to take into account MAC context (SELinux,...), capabilities, namespaces... | |
| Jan 23, 2017 at 21:54 | history | answered | Mark Stosberg | CC BY-SA 3.0 |