FooDeas / raspberrypi-ua-netinst

RaspberryPi (minimal) unattended netinstaller
ISC License
220 stars 46 forks source link

`syslog-ng` doesn't want to install during post-install #153

Closed Mausy5043 closed 6 years ago

Mausy5043 commented 6 years ago

I have this piece of code in my post-install.txt:

echo "Removing rsyslog..."
eval chroot /rootfs /usr/bin/apt-get -y purge rsyslog 2>&1 | output_filter
if [ "${PIPESTATUS[0]}" -eq 0 ]; then
    echo "OK"
else
    echo "FAILED !"
fi
echo "Installing syslog-ng..."
eval chroot /rootfs /usr/bin/apt-get -y install syslog-ng 2>&1 | output_filter
if [ "${PIPESTATUS[0]}" -eq 0 ]; then
    echo "OK"
else
    echo "FAILED !"
fi

The relevant part of the log shows this:

Removing rsyslog...
  Reading package lists...
  Building dependency tree...
  Reading state information...
  The following packages were automatically installed and are no longer required:
    libestr0 libfastjson4 liblogging-stdlog0 liblognorm5
  Use 'apt autoremove' to remove them.
  The following packages will be REMOVED:
    rsyslog*
  0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
  After this operation, 1363 kB disk space will be freed.
  Removing rsyslog (8.24.0-1) ...
  Running in chroot, ignoring request.
[ ok ..] Stopping enhanced syslogd: rsyslogd already stopped.
  Processing triggers for man-db (2.7.6.1-2) ...
  Purging configuration files for rsyslog (8.24.0-1) ...
  Processing triggers for systemd (232-25+deb9u2) ...
OK
Installing syslog-ng...
  Reading package lists...
  Building dependency tree...
  Reading state information...
  E: Unable to locate package syslog-ng
FAILED !

After the reboot I can install syslog-ng with no problems.

$ sudo apt install syslog-ng
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libestr0 libfastjson4 liblogging-stdlog0 liblognorm5
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  geoip-database libbson-1.0-0 libdbi1 libesmtp6 libevtlog0 libgeoip1 libhiredis0.13 libivykis0 libjson-c3 libmongoc-1.0-0 libnet1 libprotobuf-c1 libpython2.7
  librabbitmq4 libriemann-client0 libyajl2 syslog-ng-core syslog-ng-mod-add-contextual-data syslog-ng-mod-amqp syslog-ng-mod-geoip syslog-ng-mod-graphite
Preparing to unpack .../28-syslog-ng-mod-riemann_3.8.1-10_armhf.deb ...
[blablabla]

Any ideas as to what might be causing this? Should I rather replace rsyslog by syslog-ng after the reboot or is there a fix that I am overlooking?

Mausy5043 commented 6 years ago

💡 I'm re-running the install now with eval chroot /rootfs /usr/bin/apt-get -y update 2>&1 | output_filter ahead of the install.

Mausy5043 commented 6 years ago

It seems this was caused by apt-get not having an up-to-date cache. Using apt-get update before trying to install the package works.