Friday, June 09, 2006

Service commands

Commands for the service:
# service ntpd start|stop|restart

Set it to start on boot:
# chkconfig ntpd on

Check if it's running (returns process #)
# pgrep chkconfig

All about SELinux

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/selinux-guide/rhlcommon-section-0068.html

Check it:
# sestatus (output tells what config file says, and the current status too)
Enable it:
# setenforce 1
Disable it:
# setenforce 0

See /etc/selinux directory for config file.

Why does this process crash?

See http://www.redhat.com/archives/rhl-devel-list/2005-May/msg00026.html

Example: ntpd, crashes immediately:
Install gdb and the debug symbols for the executable:
# yum install gdb
# yum install ntp-debuginfo
# yum install which (I needed that utility to use the execstack specifically)

# gdb
(gdb) set args -n -u ntp:ntp -p /var/run/ntpd.pid
(gdb) run

(gdb) run
Starting program: /usr/sbin/ntpd -n -u ntp:ntp -p /var/run/ntpd.pid


Program received signal SIGSEGV, Segmentation fault.
0x00cbed30 in vfprintf () from /lib/tls/libc.so.6
(gdb) bt


I used the execstack workaround.

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=145258
on 2005-04-25 03:47 EST

I can confirm that whis bug exists in up2dated FC3. I think it can have
something in common with bug #151262 (duplicate or depend).

There's a workaround for this issue. If an ntpd is started with:
setarch i386 -L ntpd -u ntp:ntp -p /var/run/ntpd.pid
it doesn't crash.

on 2005-04-25 11:17 EST
Another workaround:
Disable exec-shield-randomize by
echo 0 > /proc/sys/kernel/exec-shield-randomize
or
echo kernel.exec-shield-randomize = 1 >> /etc/sysctl.conf

on 2005-04-26 07:05 EST

Yet another workaround:

execstack -s /usr/sbin/ntpd

As I understand it, it alters the binary:

rpm -V ntp
..5...... /usr/sbin/ntpd

but the rest of the system is unaffected.

Also, you can undo the change with:

execstack -c /usr/sbin/ntpd

which restores the old binary (rpm -V won't report it as changed).

What package provides this file?

# rpm -qf /usr/bin/which
which-2.14-5