Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 86562 - svscan should start setsid()'ed
Summary: svscan should start setsid()'ed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-24 11:33 UTC by Michal Januszewski (RETIRED)
Modified: 2008-12-07 06:59 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Januszewski (RETIRED) gentoo-dev 2005-03-24 11:33:18 UTC
When /sbin/init from sysvinit is started with a kernel command line argument such as CONSOLE=/dev/tty1, the specified tty is used for text output instead of the foreground tty. Init forces this tty to be the controlling tty for all programs listed in inittab. When a program does not detach from this tty, it's killed at the end of the boot process. 

svscan doesn't detach itself from the it's controlling tty, and thus doesn't work properly when ttys other than /dev/tty are used by init. The problem can be easily fixed by making svscan run in its own session -- ie. by changing: 

start-stop-daemon --start --quiet --pidfile /var/run/svscan.pid --exec /usr/bin/svscan -- /service &

to:

setsid start-stop-daemon --start --quiet --pidfile /var/run/svscan.pid --exec /usr/bin/svscan -- /service &
Comment 1 SpanKY gentoo-dev 2005-03-24 11:48:49 UTC
why not patch svscan to detach from the controlling tty ?
Comment 2 Michal Januszewski (RETIRED) gentoo-dev 2005-03-24 12:13:34 UTC
svscan could be patched, but it would require adding a new daemon mode, parsing command line arguments, etc. I guess it's easier, faster and cleaner to add the 7 characters that 'setsid ' is composed of to /etc/init.d/svscan.
Comment 3 Stian Skjelstad 2005-06-26 16:24:09 UTC
you would also need to redirect stdout and stderr to a file like
/var/log/svscan.log. All in all svscan should be patched to iterate doit() once
before closing stdout and stderr, reopen them from logfiles and fork() + setsid() 
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-12-07 06:59:36 UTC
Fixed in CVS.