scylladb/scylla-machine-image

[Images]: remove services which we don't need during image creation

Closed this issue · 1 comments

Following https://github.com/scylladb/scylla-enterprise/issues/2501, we noticed that at least one service is running in our images (seen in AMI) which is not needed - fwupdmgr.

Running systemctl on our latest ami image we have got the following list:

scyllaadm@ip-10-0-4-249:~$ systemctl | grep "running\|waiting"
  proc-sys-fs-binfmt_misc.automount                             loaded active running   Arbitrary Executable File Formats File System Automount Point
  acpid.path                                                    loaded active running   ACPI Events Check
  systemd-ask-password-console.path                             loaded active waiting   Dispatch Password Requests to Console Directory Watch
  systemd-ask-password-wall.path                                loaded active waiting   Forward Password Requests to Wall Directory Watch
  init.scope                                                    loaded active running   System and Service Manager
  session-1.scope                                               loaded active running   Session 1 of User scyllaadm
  acpid.service                                                 loaded active running   ACPI event daemon
  amazon-ssm-agent.service                                      loaded active running   amazon-ssm-agent
  chrony.service                                                loaded active running   chrony, an NTP client/server
  cron.service                                                  loaded active running   Regular background program processing daemon
  dbus.service                                                  loaded active running   D-Bus System Message Bus
  fwupd.service                                                 loaded active running   Firmware update daemon
  getty@tty1.service                                            loaded active running   Getty on tty1
  irqbalance.service                                            loaded active running   irqbalance daemon
  multipathd.service                                            loaded active running   Device-Mapper Multipath Device Controller
  networkd-dispatcher.service                                   loaded active running   Dispatcher daemon for systemd-networkd
  polkit.service                                                loaded active running   Authorization Manager
  rsyslog.service                                               loaded active running   System Logging Service
  scylla-jmx.service                                            loaded active running   Scylla JMX
  scylla-node-exporter.service                                  loaded active running   Prometheus exporter for machine metrics
  scylla-server.service                                         loaded active running   Scylla Server
  serial-getty@ttyS0.service                                    loaded active running   Serial Getty on ttyS0
  ssh.service                                                   loaded active running   OpenBSD Secure Shell server
  systemd-journald.service                                      loaded active running   Journal Service
  systemd-logind.service                                        loaded active running   User Login Management
  systemd-networkd.service                                      loaded active running   Network Configuration
  systemd-resolved.service                                      loaded active running   Network Name Resolution
  systemd-udevd.service                                         loaded active running   Rule-based Manager for Device Events and Files
  user@1000.service                                             loaded active running   User Manager for UID 1000
  uuidd.service                                                 loaded active running   Daemon for generating UUIDs
  acpid.socket                                                  loaded active running   ACPID Listen Socket
  dbus.socket                                                   loaded active running   D-Bus System Message Bus Socket
  multipathd.socket                                             loaded active running   multipathd control socket
  syslog.socket                                                 loaded active running   Syslog Socket
  systemd-journald-audit.socket                                 loaded active running   Journal Audit Socket
  systemd-journald-dev-log.socket                               loaded active running   Journal Socket (/dev/log)
  systemd-journald.socket                                       loaded active running   Journal Socket
  systemd-networkd.socket                                       loaded active running   Network Service Netlink Socket
  systemd-udevd-control.socket                                  loaded active running   udev Control Socket
  systemd-udevd-kernel.socket                                   loaded active running   udev Kernel Socket
  uuidd.socket                                                  loaded active running   UUID daemon activation socket
  apt-daily-upgrade.timer                                       loaded active waiting   Daily apt upgrade and clean activities
  apt-daily.timer                                               loaded active waiting   Daily apt download activities
  dpkg-db-backup.timer                                          loaded active waiting   Daily dpkg database backup timer
  e2scrub_all.timer                                             loaded active waiting   Periodic ext4 Online Metadata Check for All Filesystems
  fstrim.timer                                                  loaded active waiting   Discard unused blocks once a week
  fwupd-refresh.timer                                           loaded active waiting   Refresh fwupd metadata regularly
  logrotate.timer                                               loaded active waiting   Daily rotation of log files
  man-db.timer                                                  loaded active waiting   Daily man-db regeneration
  motd-news.timer                                               loaded active waiting   Message of the Day
  scylla-housekeeping-daily.timer                               loaded active waiting   Run Scylla Housekeeping daily mode
  systemd-tmpfiles-clean.timer                                  loaded active waiting   Daily Cleanup of Temporary Directories
  ua-timer.timer                                                loaded active waiting   Ubuntu Advantage Timer for running repeated jobs

Let's review this list and make sure what can be removed

In no particular order:

  1. Don't know if we need acpid.socket and acpid.service - I don't think so.
  2. We don't need man-db.timer
  3. Don't know if we need motd-news.timer
  4. Don't know if we need ua-timer.timer
    Assuming we don't do regular in-place updates of packages, we probably don't need:
  5. apt-daily-upgrade.timer
  6. apt-daily.timer
  7. Don't know if we need dpkg-db-backup.timer - probably safe to keep though.
  8. We should disable/mask fwupd-refresh.timer and fwupd.service
  9. Don't know if we need multipathd.socket - doubt that.