Skip to content
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

Influx service fails to start on boot in RHEL6 #800

Closed
chrisedebo opened this issue Aug 5, 2014 · 5 comments
Closed

Influx service fails to start on boot in RHEL6 #800

chrisedebo opened this issue Aug 5, 2014 · 5 comments

Comments

@chrisedebo
Copy link

Hi All,

After installing influxdb on a RHEL6 vm I noticed the service didn't start on boot. I ran chkconfig, runlevel 3 was set to on. Nothing in /opt/influxdb/shared/log.txt to indicate any issues. Starting the service on the command line worked as expected with sudo service influxdb start. I then checked /var/log/boot.log and found the following lines:

Starting the process influxdb [ OK ]
sudo: sorry, you must have a tty to run sudo
influxdb process was started [ OK ]

I checked the /etc/init.d/influxdb startup script and sure enough there was a sudo command right in the middle of it:

sudo -u influxdb -g influxdb ${daemon}-daemon -pidfile $pidfile -config $config

After a little digging I discovered a line in my /etc/sudoers file which was the cause of the message in my boot.log:

Defaults    requiretty

Once this line was commented out a reboot of the server confirmed influx was able to start correctly and the "sorry, you must have a tty..." line disappeared from the boot.log. I expect this issue will occur on many distributions that have this line in their sudoers file by default. I have checked Centos 7.0 and Fedora 20 both of which have this line.

I have checked various sources online and "requiretty" is there as a security feature although, as any user can create a tty, it doesn't provide much benefit.

An alternative fix would be to use su instead of sudo. But conventions say to use sudo instead of su.

I'm not sure what the best fix for everyone out there is, I've commented out the requiretty line in my sudoers file in order to get this working.

Hopefully someone will find this information useful until a resolution is found.

Cheers

Chris

@spuder
Copy link
Contributor

spuder commented Oct 10, 2014

This may explain why when I attempt to start influxdb with puppet it fails.
jdowning/puppet-influxdb#10

Update
Thank you soo much, I've spent hours researching why puppet was unable to start this service. As soon as I commented that out of the sudeors file and rebooted, influx started working properly.

The influxdb script should defintly use su (instead of sudo) for those users running Cent

@jvshahid
Copy link
Contributor

which version of Centos are you using ?

@spuder
Copy link
Contributor

spuder commented Oct 10, 2014

Cent 6.5

@jvshahid
Copy link
Contributor

I'm guessing you have to install lsb functions manually on Centos. the only reason the script is using sudo is because it failed to find the lsb functions. I'm okay with changing sudo to su if this will fix the problem

@spuder
Copy link
Contributor

spuder commented Oct 10, 2014

Yes, could we change this to su?

I'm not an expert in init scripts, but changing it to the following works for me sudo -s /bin/sh -c

I'll open a pull request so somone else can code review my change.

On reboots influxdb now starts properly, and also if influxdb is stopped, puppet is able to start the process, even if requiretty is enabled. (Make sure you reboot after editing the sudoers file).

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

No branches or pull requests

3 participants