Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 140349 - lighttpd failed to start at first boot when using include_shell with (shell) script
Summary: lighttpd failed to start at first boot when using include_shell with (shell) ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Other
: High normal (vote)
Assignee: www-servers Herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-14 05:24 UTC by Phattanon Duangdara
Modified: 2007-08-26 16:31 UTC (History)
4 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 Phattanon Duangdara 2006-07-14 05:24:06 UTC
Lighttpd fail to start in first boot
if using include_shell in lighttpd.conf

Reproduce:
Just put some script that generate config for lighttpd in lighttpd.conf

include_shell "/usr/local/throot/bin/genlighttpdconfig"

I fail boot shell and perl script
When computer is restarted it says 'SHELL environment is not set' when starting lighttpd

---

Portage 2.0.54-r2 (default-linux/amd64/2006.0, gcc-3.4.5, glibc-2.3.6-r3, 2.6.15-gentoo-r7 x86_64)
=================================================================
System uname: 2.6.15-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3200+
Gentoo Base System version 1.6.14
dev-lang/python:     2.4.2
dev-python/pycrypto: [Not Present]
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon64 -O3"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://202.142.215.9/pub/mirrors/gentoo http://gentoo.osuosl.org"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://202.142.215.9/gentoo-portage"
USE="amd64 acpi alsa avi berkdb bitmap-fonts bzip2 cli crypt cups dri eds emboss encode expat foomaticdb fortran gd gif gpm gstreamer imap imlib ipv6 isdnlog jpeg lighttpd lzw lzw-tiff mp3 mpeg mysql ncurses nls nptl opengl pam pcre pdflib perl perlsuid php png pppd python quicktime readline reflection sasl sdl session snmp spell spl ssl tcpd threads tiff truetype-fonts type1-fonts udev unicode usb vhosts xml xml2 xorg xpm xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTAGE_RSYNC_OPTS
Comment 1 Alan Briolat 2006-08-05 13:45:19 UTC
Same problem here.  Full error for me:

---
env SHELL is required
(configfile.c.882) opening /bin/cat vhosts.d/*.conf failed: Success
source: /etc/lighttpd/lighttpd.conf line: 324 pos: 1 parser failed somehow near here: (EOL)
---

Last few lines of my lighttpd.conf:

---
320
321 include_shell "/bin/cat vhosts.d/*.conf"
322
323 # vim: set ft=conf foldmethod=marker et :
---

No problem if include_shell isn't used.

I tried having a look around, and I can't actually see where a SHELL env var is set anywhere in the boot process, as it doesn't seem to exist in /etc/env.d/ or /etc/rc.conf, yet it must come from somewhere for it to be able to start later.  I would have assumed possibly from the user's profile (whatever is specified as the user's shell in /etc/passwd) but it appears to be dying at this line in the initscript:

/usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null

which looks like its being run as root, which definitely has a shell set.

So...  I'm thoroughly confused as to why this isn't working.  Any ideas?
Comment 2 Phattanon Duangdara 2006-08-06 05:27:26 UTC
There is simple workaround.
Put SHELL="/bin/bash" in /etc/conf.d/lighttpd (until this get fixed)
Comment 3 Elvis Pranskevichus 2006-10-17 12:01:22 UTC
(In reply to comment #2)
> There is simple workaround.
> Put SHELL="/bin/bash" in /etc/conf.d/lighttpd (until this get fixed)
> 

Actually this should be 
export SHELL="/bin/bash"

--
El
Comment 4 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2006-10-18 11:55:22 UTC
hi El,

i have added SHELL=/bin/bash to /etc/conf.d/lighttpd.

does this not work for you?
thanks
Comment 5 Sam Jacobson 2007-03-24 04:59:25 UTC
Hi,

I also had to change /etc/conf.d/lighttpd to 'export SHELL=/bin/bash'. 'SHELL=/bin/bash' didn't work for me.

It does sorta make sense. The SHELL env variable is read by lighttpd itself (a child process). The other variables are read by /etc/init.d/lighttpd which is quite probably executed within the same process (therefore not needing 'export'). I say quite probably because I haven't read the source of /sbin/runscript.

Sam
Comment 6 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2007-08-26 16:31:15 UTC
# Location of a shell used by the 'include_shell' directive
# in the lighttpd's configuration file
#export SHELL="/bin/bash"

has been added to /etc/conf.d/lighttpd.
uncomment the 'export' line and specify the wanted shell if you use include_shell.

thanks for the report.