-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debian init script cannot be remotely started with a tty #3053
Comments
@blbradley I think the issue from Discuss was fixed with this: fiorix/go-daemon#7 Note that the last reports on the forums except yours are several months old. If you still see this issue, can you post the steps to reproduce? |
@tsg I've seen that issue and thought the problem would be fixed by now as well. I'm using filebeat-formula to install filebeat and still observing that issue in filebeat 1.3.1 on Ubuntu Trusty (14.04). Here is another reason I filed this issue:
I'll get you a test case very soon. You'll need a few dependencies (Docker, Ruby, and Python). Let me know if that is a problem. |
Assuming Docker, Ruby (with bundler), and Python (with pip) is installed:
This will setup an Ubuntu Trusty Docker container, install filebeat, run/enable the service, and run some tests to confirm all of that happens. The tests fail because filebeat is not running. I'm pretty sure that SaltStack does not start a tty to execute commands. In addition, if you try to start the service without a tty (and without SaltStack), the service is not started:
Starting the service using a terminal works as expected. I can probably prove similar overall behavior for metricbeat since it's init script is generated from the same Jinja template. |
I also ran this on a Trusty VM for good measure. Same issue. |
I was hoping for a more minimal test case :) Just to make sure, the filebeat formula uses the packages from the elastic repos, right?
This sounds promising for reproducing. Do you know of a way I can do that without kitchen? |
I tried, based on this:
But it looks good, daemon starts and it doesn't have a tty:
Can you try the same in your environment, please? |
Also, please double check the logs for errors. Maybe it fails to start due to some missing path permission or similar. |
I tried your exact command in the Trusty VM (as root with filebeat service not running).
Same thing when I replace Is your environment RedHat based? |
Yes. Only the 1.x series right now. |
The empty log is probably because i used 5.0 for testing, which logs at info level by default. Probably if you add |
That does produce some logs in the case you provided. I'm exploring further. Thanks for your speedy responses! |
I'm able to run |
Aha! I was able to reproduce over SSH. The problem is actually the opposite of the issue title. Allocating a tty and starting the service via SSH will stop the service after logout. Logs are due to
|
|
Test Kitchen uses SSH by default to run commands and allocates a TTY to do so.
|
Do I need to provide an easier way to reproduce? Or should one of us try to fix the init script? |
I can reproduce it now as well, many thanks for digging into this. So this works:
But this doesn't:
Same can be reproduced with go-daemon only. This doesn't work as expected:
It's probably because go-daemon doesn't call |
Great! I'm going to dig into the second Elastic Discuss link to see if I can daemonize on Debian without go-daemon. |
Yeah, I'm sure it's possible with |
I understand that requirement. Aren't the init scripts for Debian and RedHat managed separately in this repo? If so, would that alleviate your concern? |
They are handled separately, yes. I have two concerns:
What is your concern about keeping using go-daemon? More issues like this one? |
My issue is that the shipped init scripts can't be used with systems that allocate a tty for remote command execution. While my case is limited to Test Kitchen, it seems like SaltStack and Puppet have issues (on Debian) with these init scripts as well. So, I don't have a problem with go-daemon per se. I agree that debugging init scripts (and Bash in general) can be difficult. Keeping them very similar between platforms may be advantageous (and ideal) but not work in practice. One way of implementing cgroups usage would be to require users to use systemd. If this overall issue is due to another bug in go-daemon, then it that would be another way to handle this. |
I was trying to figure this out in go-daemon, but so far I didn't find a solution to make it work with
This doesn't work. If you remove the So I'm no longer sure that the |
👀 Sure! I'll do that soon and probably go ahead with managing the |
I was able to get the init script working using the instructions in the second linked Elastic Discuss post. I'll need to do more testing to see if the PID file works appropriately. |
Closing. Issue stalled for 2+ years, plus no new reports. Assuming it is fixed with go-daemon update. |
Some discussion says that Debian doesn't need the
go-daemon
process as a supervisor. I agree. It will be better to fix this upstream than manage changes to the init script per package.The second link describes how to fix the init script. Does that seem acceptable?
The text was updated successfully, but these errors were encountered: