Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 395209

Summary: net-misc/memcached-1.4.10 doesn't installs systemd service file
Product: Gentoo Linux Reporter: Maksim 'max_posedon' Melnikau <maxposedon>
Component: New packagesAssignee: Robin Johnson <robbat2>
Status: RESOLVED FIXED    
Severity: normal CC: systemd
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 448882    
Attachments: memcached.ebuild.patch
memcached.service
memcached.service

Description Maksim 'max_posedon' Melnikau 2011-12-18 21:14:22 UTC
memcached provides systemd service file:
memcached-1.4.10/scripts/memcached.service
which might be not fully gentoo compilant.

Anyway, I think memcached package should install systemd service file.

Reproducible: Always

Steps to Reproduce:
1. emerge memcached
2. systemctl -a | grep memcached

Actual Results:  
systemd service file not installed

Expected Results:  
systemd service file should be installed

m_melnikau-vaio kvms # emerge --info
Portage 2.1.10.41 (default/linux/amd64/10.0/desktop/kde, gcc-4.6.1, glibc-2.13-r4, 3.1.1-gentoo x86_64)
=================================================================
System uname: Linux-3.1.1-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_M_430_@_2.27GHz-with-gentoo-2.1
Timestamp of tree: Sun, 18 Dec 2011 20:30:01 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p10
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.6.7-r2, 2.7.2-r3, 3.1.4-r3, 3.2.2
dev-util/cmake:           2.8.6-r3
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.6.1-r1
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo sunrise systemd qting-edge local
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7 -Os -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=corei7 -Os -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ru"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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="/var/lib/layman/sunrise /var/lib/layman/systemd /var/lib/layman/qting-edge /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acpi alsa amd64 avahi berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups curl cxx dbus declarative djvu dri dts dv dvd dvdr emboss encode exif fam ffmpeg firefox flac ftp gdbm gdu gif gnome-keyring gnutls gpm gps gsm gstreamer iconv icu imagemagick ios ipod ipv6 jingle jpeg jpeg2k kde kipi lame latex lcms ldap libcaca libnotify lm_sensors lzma lzo mad mmx mng modules mp3 mp4 mpeg mplayer mtp mudflap multilib musicbrainz ncurses netboot networkmanager nls nptl nptlonly ogg openal opengl openmp oscar pam pango pcre pdf phonon plasma png policykit portaudio postgres ppds pppd pulseaudio qt3support qt4 rdesktop readline ruby samba sdl semantic-desktop session smp speex spell sqlite sqlite3 sse sse2 ssl startup-notification subversion svg sysfs taglib tcpd theora tiff truetype udev unicode usb v4l v4l2 vaapi vim-syntax vnc vorbis wifi x264 xcb xcomposite xine xinerama xml xorg xscreensaver xulrunner xv xvid zeroconf zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon dummy fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Maksim 'max_posedon' Melnikau 2013-07-04 19:21:03 UTC
How can I help to move it?
Comment 2 Pacho Ramos gentoo-dev 2013-07-20 14:27:01 UTC
(In reply to Maksim 'max_posedon' Melnikau from comment #1)
> How can I help to move it?

Providing an ebuild diff working for you would be nice
Comment 3 Maksim 'max_posedon' Melnikau 2013-07-21 21:39:23 UTC
Created attachment 353794 [details, diff]
memcached.ebuild.patch
Comment 4 Maksim 'max_posedon' Melnikau 2013-07-21 21:41:01 UTC
Created attachment 353796 [details]
memcached.service

memcached.service based on variant provided by fedora-19, but fixed a bit to fix /etc/conf.d/memcached variables (s/$USER/$MEMCACHED_RUNAS)
Comment 5 Maksim 'max_posedon' Melnikau 2013-07-21 21:42:38 UTC
(In reply to Pacho Ramos from comment #2)
Works for me with attached ebuild patch and service:
# systemctl status memcached.service                                                         
memcached.service - Memcached
   Loaded: loaded (/usr/lib64/systemd/system/memcached.service; disabled)
   Active: active (running) since Mon 2013-07-22 00:35:44 FET; 4min 16s ago
 Main PID: 20626 (memcached)
   CGroup: /system.slice/memcached.service
           └─20626 /usr/bin/memcached -u memcached -p 11211 -m -c 1024

Jul 22 00:35:44 m_melnikau-M11xR3 systemd[1]: Started Memcached.
Comment 6 Pacho Ramos gentoo-dev 2013-07-21 22:03:14 UTC
Will test and commit in a week if nobody disagrees. Thanks!
Comment 7 Maksim 'max_posedon' Melnikau 2013-07-22 07:04:11 UTC
There is one problem here: right now memcached.service will use /etc/conf.d/memcached, which is nice in compatibility reasons.

But systemd users may use INSTALL_MASK="/etc/init.d /etc/conf.d /etc/runlevels", like https://github.com/canek-pelaez/gentoo-systemd-only suggest for example (as many others gentoo systemd manualsa)

Should I provide another service, which don't use variables from /etc/conf.d/memcached? It will be more "systemdish", if we will put all this variables inside service.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-22 07:39:09 UTC
You should fix memcached to use config files.
Comment 9 Maksim 'max_posedon' Melnikau 2013-07-22 08:14:28 UTC
(In reply to Michał Górny from comment #8)
> You should fix memcached to use config files.
I'm sorry I didn't understand which config files you mean, attached service file uses /etc/conf.d/memcached, is it ok?
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-22 08:18:14 UTC
(In reply to Maksim 'max_posedon' Melnikau from comment #9)
> (In reply to Michał Górny from comment #8)
> > You should fix memcached to use config files.
> I'm sorry I didn't understand which config files you mean, attached service
> file uses /etc/conf.d/memcached, is it ok?

No. memcached should have its *own* config file which will be read by memcached. RC is supposed to *start* services, not *configure* them.
Comment 11 Maksim 'max_posedon' Melnikau 2013-07-22 08:29:10 UTC
> (In reply to Maksim 'max_posedon' Melnikau from comment #9)
> No. memcached should have its *own* config file which will be read by
> memcached. RC is supposed to *start* services, not *configure* them.
But memcached haven't such config files by design, and all configuration should be done by command line.

And frankly speaking it could work (with default configuration) without any options at all.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-22 08:36:08 UTC
(In reply to Maksim 'max_posedon' Melnikau from comment #11)
> > (In reply to Maksim 'max_posedon' Melnikau from comment #9)
> > No. memcached should have its *own* config file which will be read by
> > memcached. RC is supposed to *start* services, not *configure* them.
> But memcached haven't such config files by design, and all configuration
> should be done by command line.
> 
> And frankly speaking it could work (with default configuration) without any
> options at all.

And that's a major design flaw that needs to be fixed upstream. Otherwise, you end up with software that you can't properly move to another distro without converting configuration to a different format used by the local flavor of RC.

And if you really want to get it wrong, use the format used by Fedora. It's likely to end up being the most portable one even if it introduces /etc/sysconfig in Gentoo.
Comment 13 Maksim 'max_posedon' Melnikau 2013-07-22 09:40:54 UTC
(In reply to Michał Górny from comment #12)
> And that's a major design flaw that needs to be fixed upstream. Otherwise,
> you end up with software that you can't properly move to another distro
> without converting configuration to a different format used by the local
> flavor of RC.
As I understand, this is thing, which systemd trying to fix. There is no reason to have 2 separate config files - app's one, and service --- if its easy and possible to move all configuration to service file and unify many options.

> And if you really want to get it wrong, use the format used by Fedora. It's
> likely to end up being the most portable one even if it introduces
> /etc/sysconfig in Gentoo.
I expecting that fedora will deprecate /etc/sysconfig at least for systemd. 

So, I'm asking, which variant in the best for Gentoo?

As for me - move all configuration in nice service file, and configure systemd via Environment and EnvironmentFile or even via simple Exec=. And expecting from user to changing configuration via standard systemd way - service inheritance.
Comment 14 Pacho Ramos gentoo-dev 2013-07-27 07:01:34 UTC
We also have some units relying on cond.f files, I see no gain on having a new file in a new subdirectory providing exact same functionality (and I don't see /etc/sysconfig any better than conf.d)
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-20 09:50:55 UTC
Also, this specific .service file is broken and won't work for me (I use UNIX sockets only).

If we're to provide a file for this, I suggest providing one with sane defaults and possibly a /etc/systemd/system/memcached.service.d/gentoo.conf with commented out sample how to specify more options.

However, we should not at all think about providing configuration wrapper variables. Let's just let people pass command-line options directly, e.g. via overriding ExecStart=.
Comment 16 Maksim 'max_posedon' Melnikau 2013-08-25 08:14:45 UTC
Created attachment 356956 [details]
memcached.service

"systeming" memcached.service
Comment 17 Maksim 'max_posedon' Melnikau 2013-08-25 09:29:03 UTC
(In reply to Michał Górny from comment #15)
> ... and possibly a /etc/systemd/system/memcached.service.d/gentoo.conf
> with commented out sample how to specify more options.
I think its not required, because overriding settings via /etc/systemd/system/<service>.service.d/ is the standard way for systemd's services.
Comment 18 Pacho Ramos gentoo-dev 2013-08-25 09:41:45 UTC
I don't think providing a commented file as example to edit and tweak will hurt, and will surely help to people making configuration easier
Comment 19 Pacho Ramos gentoo-dev 2013-08-31 12:26:59 UTC
+*memcached-1.4.13-r1 (31 Aug 2013)
+
+  31 Aug 2013; Pacho Ramos <pacho@gentoo.org> +files/memcached.service,
+  +memcached-1.4.13-r1.ebuild:
+  Add unit file (#395209 by Maksim 'max_posedon' Melnikau)
+

OK, I have seen neither Arch people let people play so much with memcached starting