Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #12253] /usr/lib/icinga2/prepare-dirs does not create /var/cache/icinga2 #4414

Closed
icinga-migration opened this issue Jul 28, 2016 · 7 comments
Labels
area/setup Installation, systemd, sample files bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/12253

Created by haasn on 2016-07-28 15:40:48 +00:00

Assignee: (none)
Status: Assigned
Target Version: (none)
Last Update: 2016-08-03 08:26:12 +00:00 (in Redmine)

Icinga Version: r2.4.10-1
Backport?: Not yet backported
Include in Changelog: 1

The /usr/lib/icinga2/prepare-dirs script does not seem to ensure /var/cache/icinga2 is present and writable. This causes a freshly installed icinga2 to crash out of the box on my end:

-- Unit icinga2.service has begun starting up.
Jul 28 17:10:04 nanodesu icinga2[8534]: [2016-07-28 17:10:04 +0200] information/cli: Icinga application loader (version: r2.4.10-1)
Jul 28 17:10:04 nanodesu icinga2[8534]: [2016-07-28 17:10:04 +0200] critical/Application: Error: Function call 'mkstemp' for file '/var/cache/icinga2/icinga2.debug.XXXXXX' failed with error code 2, 'No such file or directory
Jul 28 17:10:04 nanodesu icinga2[8534]: Additional information is available in '/var/log/icinga2/crash/report.1469718604.3545589'
Jul 28 17:10:04 nanodesu icinga2[8534]: [2016-07-28 17:10:04 +0200] information/cli: Icinga application loader (version: r2.4.10-1)
Jul 28 17:10:04 nanodesu icinga2[8534]: [2016-07-28 17:10:04 +0200] critical/Application: Error: Function call 'mkstemp' for file '/var/cache/icinga2/icinga2.debug.XXXXXX' failed with error code 2, 'No such file or directory
Jul 28 17:10:04 nanodesu icinga2[8534]: Additional information is available in '/var/log/icinga2/crash/report.1469718604.3545589'
Jul 28 17:10:04 nanodesu systemd[1]: icinga2.service: Control process exited, code=killed status=6
Jul 28 17:10:04 nanodesu systemd[1]: Failed to start Icinga host/service/network monitoring system.
-- Subject: Unit icinga2.service has failed

I have fixed the issue by appending the following lines to prepare-dirs:

ICINGA2_CACHE_DIR=$ICINGA2_STATE_DIR/cache/icinga2
mkdir -p $ICINGA2_CACHE_DIR
chown $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_CACHE_DIR
chmod 750 $ICINGA2_CACHE_DIR

Icinga2 works correctly on my end with these changes present.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-07-28 15:45:56 +00:00

  • Category set to Installation
  • Status changed from New to Feedback
  • Assigned to set to haasn

How and where did you install icinga2?

Please also show the output of "icinga2 --version".

@icinga-migration
Copy link
Author

Updated by haasn on 2016-07-29 14:52:58 +00:00

λ icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.4.10-1)

Copyright (c) 2012-2016 Icinga Development Team (https://www.icinga.org/)
License GPLv2+: GNU GPL version 2 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Application information:
  Installation root: /usr
  Sysconf directory: /etc
  Run directory: /var/run
  Local state directory: /var
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /var/run/icinga2/icinga2.pid

System information:
  Platform: Gentoo
  Platform version: Unknown
  Kernel: Linux
  Kernel version: 4.6.4-hardened-r2-gnu
  Architecture: x86_64

λ emerge --info icinga2
Portage 2.3.0 (python 2.7.11-final-0, hardened/linux/amd64, gcc-5.4.0, glibc-2.23-r2, 4.6.4-hardened-r2-gnu x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.6.4-hardened-r2-gnu-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16390104 total,    440564 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 23 Jul 2016 21:15:01 +0000
sh dash 0.5.8.2
ld GNU ld (Gentoo 2.26.1 p1.0) 2.26.1
app-shells/bash:          4.3_p46::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.4::gentoo, 3.5.1-r3::gentoo
dev-util/cmake:           3.6.0::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2-r1::gentoo
sys-apps/openrc:          0.21.2::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.26.1::gentoo
sys-devel/gcc:            5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage
    priority: -1000

local_overlay
    location: /usr/local/portage
    masters: gentoo
    priority: 0

deter
    location: /var/lib/layman/deter
    masters: gentoo
    priority: 50

dotnet
    location: /var/lib/layman/dotnet
    masters: gentoo
    priority: 50

emery
    location: /var/lib/layman/emery
    masters: gentoo
    priority: 50

haskell
    location: /var/lib/layman/haskell
    masters: gentoo
    priority: 50

kde
    location: /var/lib/layman/kde
    masters: gentoo
    priority: 50

sunrise
    location: /var/lib/layman/sunrise
    masters: gentoo
    priority: 50

vapoursynth
    location: /var/lib/layman/vapoursynth
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/i18n/locales"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /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=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--ask --ask-enter-invalid --keep-going=y --quiet-unmerge-warn --quiet-build=y --quiet-fail=y --ignore-built-slot-operator-deps=y --jobs=5 --load-average=3 --tree"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://de-mirror.org/gentoo/ http://gentoo.mneisen.org/ http://mirror.netcologne.de/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi amd64 aspell avx bash-completion bazaar berkdb branding btrfs bzip2 cairo caps cdr cjk clang cli color-management cracklib crypt cuda cvs cxx darcs dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fontconfig gdbm gif git glamor gpg gpm gtk guile hardened http2 iconv idn ipv6 jbig jpeg jpeg2k justify lcms ldap libnotify littlecms llvm lua lzma lzo mad mem-scramble mercurial mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opencl openexr opengl openmp otr pam pango pax_kernel pcre pdf perl pie png polarssl ppds python qt qt3support qt5 readline ruby sasl savedconfig sdl seccomp session socks socks5 spell sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 subversion svg systemd tcpd theora threads tiff truetype tta udev unicode urandom usb vim vim-syntax vorbis wavpack wxwidgets x264 xattr xcb xetex xfs xft xml xtpax xvid xz zlib zsh zsh-completion" ABI_X86="64 32" 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" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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="krita" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2 sse3 ssse3 mmxext sse4 sse4_1 sse4_2 avx avx2" DRACUT_MODULES="btrfs" 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 ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21 ruby22 ruby23" USERLAND="GNU" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

net-analyzer/icinga2-2.4.10-r1::gentoo was built with the following:
USE="mail plugins postgres vim-syntax -apache2 -classicui -console -libressl -lto -minimal -mysql -nano-syntax (-studio)" ABI_X86="64"

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-07-29 14:56:57 +00:00

  • Subject changed from /usr/lib/icinga2/prepare-dirs does not create /var/cache/icinga2 to Gentoo: /var/cache/icinga2 not created upon package install
  • Category changed from Installation to Packages
  • Status changed from Feedback to Assigned
  • Assigned to changed from haasn to mthode

Ah, Gentoo. That clears it up a little. I suspected that the RPM/Debian packages weren't properly preparing those directories.

@mthode
Can you please fix the Gentoo package in order to provide those dirs upon "package install" already similar to how the other distributions behave. Thanks.

@icinga-migration
Copy link
Author

Updated by mthode on 2016-07-29 15:12:34 +00:00

I could do that, but that directory is supposed to be able to be deleted. Everything in /var/cache is.

http://www.pathname.com/fhs/2.2/fhs-5.5.html

/var/cache is intended for cached data from applications. Such data is locally generated as a result of time-consuming I/O or calculation. The application must be able to regenerate or restore the data. Unlike /var/spool, the cached files can be deleted without data loss. The data must remain valid between invocations of the application and rebooting the system.

This is something that should be done at service start.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2016-08-03 08:26:12 +00:00

  • Subject changed from Gentoo: /var/cache/icinga2 not created upon package install to _/usr/lib/icinga2/prepare-dirs does not create /var/cache/icinga2 _
  • Assigned to deleted mthode

This is probably something which should be done in the prepare-dirs script.

@icinga-migration icinga-migration added bug Something isn't working area/setup Installation, systemd, sample files labels Jan 17, 2017
@ekohl
Copy link
Contributor

ekohl commented Jul 1, 2017

The best solution would be to ship a tmpfiles.d file. Locally I've created /etc/tmpfiles.d/icinga2.conf with d /var/cache/icinga2 0750 icinga icinga as content to ensure the directory exists.

ekohl added a commit to ekohl/icinga2 that referenced this issue Jul 1, 2017
@ekohl
Copy link
Contributor

ekohl commented Jul 1, 2017

I implemented the simple fix in the references PR by extending the current method using the code suggested by the author.

dnsmichi pushed a commit that referenced this issue Sep 5, 2017
@dnsmichi dnsmichi added this to the 2.7.1 milestone Sep 5, 2017
@dnsmichi dnsmichi changed the title [dev.icinga.com #12253] /usr/lib/icinga2/prepare-dirs does not create /var/cache/icinga2 [dev.icinga.com #12253] /usr/lib/icinga2/prepare-dirs does not create /var/cache/icinga2 Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/setup Installation, systemd, sample files bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants