pleaserun icon indicating copy to clipboard operation
pleaserun copied to clipboard

chroot --userspec not supported on RedHat/CentOS EL 5

Open deverton opened this issue 10 years ago • 11 comments

RedHat/CentOS EL 5 ship with coreutils-5.97 which doesn't include the --userspec command line option. This causes the generated init scripts to not be usable on these systems.

deverton avatar May 08 '14 04:05 deverton

(╯°□°)╯︵ ┻━┻

I'll take a look.

jordansissel avatar May 08 '14 05:05 jordansissel

Something horrible like this works. There is runuser/daemon in the /etc/init.d/functions file but they don't really help with forking.

  touch $pidfile
  chown ${LS_USER} $pidfile
  nice -n ${LS_NICE} su -s /bin/sh ${LS_USER} -c "
    cd $LS_HOME
    ulimit -n ${LS_OPEN_FILES}
    \"$program\" $args < /dev/null > \"${LS_LOG_DIR}/$name.stdout\" 2> \"${LS_LOG_DIR}/$name.err\" &
    echo \$! > $pidfile
    disown \$!
  "

deverton avatar May 08 '14 05:05 deverton

I'm open to switching to su but that has the same problems as chroot by behaving differently across platforms.. hmm.

The 'su' and 'bin/sh' aren't being run interactively, so there shouldn't be any job control, right? Disown shouldn't be necessary, should it?

jordansissel avatar May 30 '14 16:05 jordansissel

I think @deverton's approach works well enough. I'll try integrating it once I have the test suite working again (I seem to have broken all of my docker images somehow, so no tests run anymore)

jordansissel avatar Oct 07 '14 06:10 jordansissel

Hi, How can I fix this issue with RedHat 5.6? I'm running few production instances?

Do you've work around solution?

I look forward to hear from you.

Many Thanks, Madhu

madhuneal avatar Apr 23 '15 14:04 madhuneal

I've also just run foul of this issue, I've installed 0.4.0 rpm via spacewalk and none of my servers are sending logs. I get the chroot error in my log files... I attempted using an old init script I had from 0.3.1 which seemed to work with one machine, but I had no luck with a second... For now I have turned LSF off

Does anyone have a work around for this issue? Or just a working init script for CentOS 5.x would be nice

Rumbles avatar Jun 12 '15 14:06 Rumbles

@Rumbles see the thread referenced above your post. ( https://github.com/elastic/logstash-forwarder/issues/425#issuecomment-107380293 ) I replaced the line as hrchu suggested in there and this works for me on centos5.6 with logstash 1.5.1

I'm sure logstash will soon mature beyond this.

fninja avatar Jun 23 '15 17:06 fninja

As per the above related issue it may be that the line here can be edited

https://github.com/jordansissel/pleaserun/blob/master/templates/sysv/lsb-3.1/init.sh#L63

I'm not familiar enough with pleaserun to understand what further impact this may have further down the line.

thanks, Luke

lmorfitt avatar Jul 16 '15 08:07 lmorfitt

@jordansissel If this is blocked on something specific give me a ping, I'd be glad to resolve blockers for you

combatpoodle avatar Jul 18 '15 03:07 combatpoodle

I'm slow to incorporate changes into pleaserun lately because the test suite busted (I used to be able to verify all supported platforms quickly). Sorry about the delays.

If folks are happy with the su patch proposal, I can try and test it manually on a few platforms and we can move forward with that.

jordansissel avatar Jul 18 '15 03:07 jordansissel

Please see the above suggested solution. Not sure what else it will break.

@jordansissel - What needs to be done to fix the test suite?

lmorfitt avatar Jul 20 '15 13:07 lmorfitt