Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 222433 - media-tv/mythtv-0.20.2_p15634: init script of mythbackend doesn't set the HOME correctly
Summary: media-tv/mythtv-0.20.2_p15634: init script of mythbackend doesn't set the HOM...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Television related Applications in Gentoo's Portage
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-16 20:28 UTC by glowwormy
Modified: 2008-05-19 15:59 UTC (History)
0 users

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 glowwormy 2008-05-16 20:28:53 UTC
Today I tried mythtv after a long time (I probably updated in between). But starting the backend via the init script gave me the following error in mythbackend.log:
2008-05-16 21:02:13.174 Using runtime prefix = /usr
2008-05-16 21:02:13.741 Unable to read configuration file mysql.txt
2008-05-16 21:02:14.136 Trying to create a basic mysql.txt file
2008-05-16 21:02:14.138 Could not create /dev/null/.mythtv
2008-05-16 21:02:14.140 Failed to init MythContext, exiting.

After some searching around, I found the reason:
In the init script of mythbackend, /etc/init.d/mythbackend, we have the following:
    export HOME=/etc/mythtv
which should do the right thing.
But then 
    start-stop-daemon --start --quiet --chuid mythtv \
        --exec /usr/bin/mythbackend \
        --make-pidfile --pidfile /var/run/mythbackend.pid \
        --background -- --verbose ${MYTH_VERBOSE} \
        --logfile /var/log/mythtv/mythbackend.log

which starts the daemon changing the user to mythtv. But in /etc/passwd:
mythtv:x:108:27:added by portage for mythtv:/dev/null:/usr/sbin/nologin
This means by start-stop-daemon HOME is reset to /dev/null!!

Solution:
Change to
    start-stop-daemon --start --quiet --chuid mythtv \
        --env HOME=/etc/mythtv \
        --exec /usr/bin/mythbackend \
        --make-pidfile --pidfile /var/run/mythbackend.pid \
        --background -- --verbose ${MYTH_VERBOSE} \
        --logfile /var/log/mythtv/mythbackend.log


Reproducible: Always

Steps to Reproduce:
/etc/init.d/mythbackend start

(returns no error, but in the logfile of mythbackend there is)


Expected Results:  
mythbackend connecting to database and running.

emerge --info
Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-tuxonice-r4 i686)
=================================================================
System uname: 2.6.24-tuxonice-r4 i686 AMD Sempron(TM) 2300+
Timestamp of tree: Fri, 16 May 2008 17:03:01 +0000
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.4-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_US.utf8"
LINGUAS="de es bg en_GB sr"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/sunrise /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac aalib acl acpi alsa apache2 asf audiofile bash-completion berkdb blas bluetooth bonobo boost branding bzip2 cairo calendar caps cdr cli cracklib crypt cscope css cups curl dbus dillo djvu doc dri dts dv dvb dvd dvdread emboss encode evo exif expat faad fam ffmpeg firefox flac fontconfig fortran fuse gd gdbm gif gimp ginac glut gmp gnome gnutls gphoto2 gpm gtk gtk2 gtkhtml guile hal hbci htmlhandbook iconv idn imagemagick imap imlib ipv6 isdnlog jabber java joystick jpeg jpeg2k kde kdehiddenvisibility kerberos lapack lcms ldap libnotify lirc lm_sensors logrotate mad maildir mailwrapper midi mikmod mmx mng mozilla mp3 mpeg mudflap musicbrainz mysql nas ncurses nfs nls nptl nptlonly nsplugin offensive ogg openal openexr opengl openmp oss pam pcre pdf perl php plotutils png postgres pppd python qt3 qt3support qt4 qtmt quicktime readline reflection samba sasl scanner sdl session slang speex spell spl sqlite sse ssl svg tcl tcpd tetex theora threads tiff timidity tk truetype unicode usb v4l v4l2 vcd vim-syntax vorbis win32codecs x86 xcomposite xine xml xml2 xorg xosd xprint xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="access auth auth_dbm auth_anon auth_digest authz_host alias filter file-cache echo charset-lite cache disk-cache mem-cache ext-filter case_filter case-filter-in deflate mime-magic cern-meta expires headers usertrack unique-id proxy proxy-connect proxy-ftp proxy-http info include cgi cgid dav dav-fs vhost-alias speling rewrite log_config logio env setenvif mime status autoindex asis negotiation dir imap actions userdir so unique_id" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de es bg en_GB sr" LIRC_DEVICES="serial" USERLAND="GNU" VIDEO_CARDS="nvidia vesa v4l"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Doug Goldstein (RETIRED) gentoo-dev 2008-05-19 14:32:01 UTC
That's something you changed on your own.

enewuser mythtv -1 /bin/bash /home/mythtv ${MYTHTV_GROUPS} || die "Problem adding mythtv user"

Is how each user is added in MythTV, it's been that way for a few years based on CVS history. And yes, /home/mythtv is right with an export setting it to /etc/mythtv.
Comment 2 glowwormy 2008-05-19 15:44:10 UTC
I am sure I didn't change it on my own, I just run Gentoo without any reinstall for like 6 years now. So if the user already existed it didn't get changed. The strange thing is, it worked before and stopped working now. 

The thing is, that the export doesn't change it, since it is overwritten by start-stop-daemon -u mythtv by /home/mythtv then. This means the /etc/mythtv directory is obsolete and I should put my configuration in /home/mythtv? The export in the init script at least is useless!
Comment 3 Doug Goldstein (RETIRED) gentoo-dev 2008-05-19 15:59:51 UTC
There's been many bugs over the years about this topic. I'm not going to revisit it again in another bug. I'll leave the searching as a user exercise.