IMD SolutionComputing LibraryShop main store

How-to

Disable pre-installed services with update-rc.d

Operating systems on the plant floor Published 5 min read

Short answer

Run update-rc.d with the disable option as root for each pre-installed init script, then reboot. That stops the native services from starting at boot without uninstalling them, so your container stack gets exclusive use of their RAM and ports.

On this page
  1. Why disable instead of uninstall
  2. Disable the autostart
  3. Verify the disable took effect
  4. If the controller runs systemd
  5. Safety note
  6. A worked example: freeing a memory-constrained controller
  7. One reported working deployment
  8. Questions asked

Run update-rc.d <script> disable as root for each pre-installed init script, then reboot the controller. On a Linux edge controller that ships with native Node-RED, InfluxDB, Kapacitor, Chronograf and Telegraf already wired into the boot sequence, this stops all of them from starting at boot while leaving the packages installed. Your container stack then has the RAM, CPU and — most importantly — the ports to itself.

Why disable instead of uninstall #

When you replace a controller's factory services with containers, the two stacks collide on the same interfaces: a native InfluxDB and a containerized InfluxDB both want port 8086, a native Node-RED and a containerized Node-RED both want port 1880. Whichever starts first binds the port; the other fails or, worse, you quietly write into the wrong database. Disabling the native autostart removes the collision without deleting anything, so you keep a rollback path.

The Debian update-rc.d documentation states the correct way to disable a service: configure it as stopped in every runlevel in which it is started by default. The disable option does exactly that, by rewriting the boot links so the script is called with stop instead of start. Nothing is removed from /etc/init.d.

One counterpoint worth knowing: an idle Node-RED or an idle InfluxDB that merely sits listening costs little CPU. If your controller has plenty of memory and you do not need the ports, leaving them running is survivable. Disabling is the right call when the containers need the ports or when the controller is memory-constrained.

Disable the autostart #

Work from a root shell, because the boot links live in system directories:

  1. Switch to root: su
  2. Disable each init script that a container will replace:
    • update-rc.d node-red-init.sh disable
    • update-rc.d influxdb-init.sh disable
    • update-rc.d kapacitor-init.sh disable
    • update-rc.d chronograf-init.sh disable
    • update-rc.d telegraf-init.sh disable
  3. Reboot: reboot

Disable only the scripts for services your container stack replaces. If your containers run Node-RED and InfluxDB 2 only, the first two lines are enough; leaving the native Telegraf or Chronograf active is a decision, not an oversight. The script names above match the init scripts shipped on this class of controller — check the names on your own image with ls /etc/init.d/ before running the commands, because a differently built firmware can name them differently.

For reference, the five factory services and their scripts:

Pre-installed service Init script Default interface
Node-RED node-red-init.sh TCP 1880
InfluxDB influxdb-init.sh TCP 8086
Kapacitor kapacitor-init.sh TCP 9092
Chronograf chronograf-init.sh TCP 8888
Telegraf telegraf-init.sh none (outbound writes)

Verify the disable took effect #

A disable you have not verified is not a disable. After the reboot:

  1. Confirm the native services are not running: ps aux | grep -E 'node-red|influxdb|kapacitor|chronograf|telegraf' returns nothing beyond the grep line itself.
  2. Confirm the ports are free: ss -tlnp | grep -E '1880|8086|8888|9092' returns nothing.
  3. Start your container engine and the replacement workloads, and confirm they bind those ports cleanly.

Then prove the data path end to end. Write one known tag value from the container stack and read it back with the correct timestamp — for a Node-RED writing to InfluxDB, that test is exactly what the article on connecting Node-RED to InfluxDB 2.6 with the v2 API walks through, and the missing-data checklist in troubleshooting a Node-RED InfluxDB Grafana stack with no data tells you what to check when the write never lands. If a native service still starts after a disable, the most common cause is a second startup mechanism: some vendor images launch services from rc.local or a custom startup script as well as from the runlevel links, and update-rc.d does not touch those.

If the controller runs systemd #

The same decision applies, but the tool differs. On a systemd controller, boot is driven by unit files, so the equivalent is:

systemctl disable influxdb.service
systemctl stop influxdb.service

Run disable for the boot behavior and stop if you want the service down without rebooting. ps and ss after a reboot are the verification either way. If you are building up a native stack instead of containers, the boot-autostart side of that is covered in installing Node-RED natively on a Linux edge computer.

Safety note #

If this controller sits on a network with PLCs or drives, do the disable-and-reboot in a maintenance window. A controller that reboots with services half-disabled can leave a SCADA client pointing at a dead historian port, and an operator acting on a stale screen is a process risk, not an IT inconvenience. As with any host change on an OT network, apply it in your change-management process and verify the process behaved normally after the reboot.

A worked example: freeing a memory-constrained controller #

Suppose your controller has 2 GB of RAM and you plan containers for Node-RED, Mosquitto, InfluxDB 2 and Grafana. Before disabling anything, free -m shows 1450 MB used with the native stack running. You disable the five init scripts, reboot, and free -m now shows 610 MB used — the native stack was holding 840 MB. The container stack's image budget for those four services is roughly 700 MB.

Before the disable, you had 2,048 − 1,450 ≈ 598 MB free, less than the containers need: the deployment would swap or be killed by the OOM handler. After, you have 2,048 − 610 ≈ 1,438 MB free, roughly twice the requirement, with headroom for Grafana rendering spikes. That is the decision arithmetic: measure the freed memory on your own controller and compare it to your container budget, not to anyone else's number. Monitoring for an OOM kill after deployment is covered in the article on watching for OOM kills in containerized Telegraf.

One reported working deployment #

One engineer replaced the full factory stack this way: after disabling the five scripts, they installed a container engine from the vendor's app store, moved the engine's var/lib directory to an SSD, and deployed Node-RED, Mosquitto, InfluxDB 2 and Grafana as containers. Treat that as a reported working arrangement, not a required layout. If a pre-installed Chronograf still misbehaves after the disable — for example a browser that keeps redirecting to its dashboard port — the connection-loop troubleshooting on that symptom has the likely cause.

The decision, in one line: if your containers need a port or the memory that an idle factory service holds, disable that service's init script with update-rc.d ... disable as root, reboot, and verify with ps and ss before you start the containers.

Questions asked

Does update-rc.d remove Node-RED or InfluxDB from the controller?

No. The disable option only rewrites the boot-time links so the init script is not called at startup. The applications stay installed under their original paths, so you can re-enable the autostart later with update-rc.d and its enable option plus a reboot if you abandon the container deployment.

How do I re-enable a service I disabled by mistake?

Run the same command with enable instead of disable: update-rc.d node-red-init.sh enable, then reboot. The enable option restores the boot links for the runlevels the package configured by default.

How much RAM do I save by disabling an idle Node-RED or InfluxDB?

Nobody can give one number: it depends on the versions and on whether the services hold history data. The reliable way is to measure before and after on your own controller with free -m, or read each process in top. On a memory-constrained controller, freeing a few hundred megabytes for your containers is a real gain even when CPU load is negligible.

Why use update-rc.d instead of systemctl disable?

Use whichever matches the init system the controller actually runs. On a SysV-style controller the boot links in /etc/rc*.d are what start the scripts, and update-rc.d is the tool that manages them. On a systemd controller, systemctl with the disable option and the unit name is the equivalent. Disabling with the wrong tool does nothing, which is why you verify after the reboot.

Keep reading

  • How-to

    Identify the Linux base before installing Node-RED natively

    Run cat /etc/os-release and uname -m on the running controller before copying anything. ID=debian opens a Debian package workflow; ID=ptxdist with PTXDIST_VERSION 2020.08.0 marks an embedded image where an ARMv7l Node.js tarball needs the hard-float libatomic1_13.2.0-4_armhf.deb staged by the image's own method. The product label never decides this.

    Operating systems on the plant floor

  • How-to

    Add a Linux desktop and browser to a Debian edge PC

    Install GNOME on the running system: run sudo apt update, then sudo apt upgrade, reboot, then sudo apt install gnome. The download is about 1-2 GB and the procedure needs 10 GB of free disk; GNOME Web comes with it. Reinstall Debian with the graphical installer only when you are rebuilding the box anyway.

    Operating systems on the plant floor

  • How-to

    Configure IP networking on an edge PC with no SSH access

    A new edge PC that leaves the factory with DHCP and static addressing disabled has no IP address, so SSH cannot connect to it. Do the first configuration at a keyboard and monitor: set X1 to DHCP and the plant-side port to the planned static address, restart networking, then confirm both addresses with nmcli device status and ip a before opening SSH or browser management on port 9090.

    Operating systems on the plant floor