How to disable boot scripts?

Hi there,

on my roc-rk3328-cc with Debian at every boot I see some initial scripts that try do something and let the booting delaying drammatically:

  • The first is the script that should expand the filesystem which is already expanded.
  • The second is a script that should raises up the network interfaces but instead is causing trouble with my manual setup

I couldn’t find them and I can’t figure out where they are and how to disable them.

Thanks in advance!

For Debian:

  • Network policy is controlled by systemd in /etc/systemd/network/.
  • Disk growth is controlled by systemd growfs in /etc/fstab.
  • Unique Disk ID generation is done by /etc/init.d/diskid_once.

I replaced systemd with runit, where else might be those scripts but fstab?

Those are the only entry points we customize. Everything else is standard. Since you replaced systemd, then it’s your own init doing something else as /etc/init.d and /etc/systemd are the only init customization points.

1 Like

I checked where you suggested but I did not find them:

Those aren’t even mentioned on the bootlog:

cat /var/log/boot
Wed Oct 25 04:00:47 2023: IP-Config: no response after 25 secs - giving up
Wed Oct 25 04:00:47 2023: /scripts/init-premount/dropbear: line 366: ipconfig: not found
Wed Oct 25 04:00:47 2023: /scripts/init-premount/dropbear: line 366: ipconfig: not found
Wed Oct 25 04:00:47 2023: /scripts/init-premount/dropbear: line 366: ipconfig: not found
Wed Oct 25 04:00:47 2023: /scripts/init-premount/dropbear: .: line 384: can't open '/run/net-*.conf': No such file or directory
Wed Oct 25 04:00:47 2023: Starting early crypto disks...done.
Wed Oct 25 04:00:47 2023: Cleaning up temporary files... /tmp.
Wed Oct 25 04:00:47 2023: Starting remaining crypto disks...done.
Wed Oct 25 04:00:47 2023: Checking file systems...fsck.fat 4.2 (2021-01-31)
Wed Oct 25 04:00:47 2023: /dev/mmcblk1p1: 8 files, 2135/65206 clusters
Wed Oct 25 04:00:47 2023: done.
Wed Oct 25 04:00:47 2023: Mounting local filesystems...done.
Wed Oct 25 04:00:47 2023: Activating swapfile swap, if any...done.
Wed Oct 25 04:00:48 2023: Cleaning up temporary files....
Wed Oct 25 04:00:48 2023: Starting Setting kernel variables: sysctl.
Wed Oct 25 04:00:48 2023: Configuring network interfaces...done.
Wed Oct 25 04:00:48 2023: Cleaning up temporary files....
Wed Oct 25 04:00:48 2023: Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix.
Wed Oct 25 04:00:48 2023: - runit: leave stage: /etc/runit/1
Wed Oct 25 04:00:48 2023: - runit: enter stage: /etc/runit/2
Wed Oct 25 04:00:48 2023: runsvchdir: default: current.
Wed Oct 25 04:00:49 2023: Setting up console font and keymap...done.
Wed Oct 25 04:00:49 2023: Starting diskid_once:.
Wed Oct 25 04:00:49 2023: Starting Dropbear SSH server: dropbear.
Wed Oct 25 04:00:51 2023: Configuring Hardware RNG entropy gatherer daemon: no hardware RNG device found! failed!
Wed Oct 25 04:00:51 2023: Starting seatd: seatd.
Wed Oct 25 04:00:51 2023: Starting uuid generator: uuidd.
Wed Oct 25 04:00:51 2023: Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon failed!

Nor I can find them on the disk:

find / -iname scripts
/usr/src/linux-headers-6.1.54-10001-gd517e36a604d/scripts
/usr/lib/python3.11/venv/scripts
/usr/lib/cryptsetup/scripts
/usr/share/initramfs-tools/scripts
/usr/share/lintian/data/scripts
/usr/share/devscripts/scripts
/etc/initramfs-tools/scripts

In the last entry it looks like there is something but directories are empties:

tree -a /etc/initramfs-tools/scripts/
/etc/initramfs-tools/scripts/
|-- init-bottom
|-- init-premount
|-- init-top
|-- local-bottom
|-- local-premount
|-- local-top
|-- nfs-bottom
|-- nfs-premount
|-- nfs-top
`-- panic

11 directories, 0 files

I don’t see Runit handling the services highlighted in red on the screenshot:

sv status /etc/service/*
run: /etc/service/chrony: (pid 1656) 1814s; run: log: (pid 1654) 1814s
run: /etc/service/cron: (pid 1655) 1814s
run: /etc/service/dbus: (pid 1660) 1814s; run: log: (pid 1659) 1814s
down: /etc/service/dbus.dep-fixer: 1813s, normally up
run: /etc/service/default-syslog: (pid 1639) 1815s
run: /etc/service/dhclient: (pid 1685) 1814s; run: log: (pid 1680) 1814s
run: /etc/service/elogind: (pid 1673) 1814s
run: /etc/service/exim4: (pid 19218) 0s; run: log: (pid 1670) 1814s
run: /etc/service/getty-tty1: (pid 1638) 1815s
run: /etc/service/getty-tty2: (pid 1640) 1815s
run: /etc/service/getty-tty3: (pid 1646) 1815s
run: /etc/service/getty-tty4: (pid 1645) 1815s
run: /etc/service/getty-tty5: (pid 1642) 1815s
run: /etc/service/getty-tty6: (pid 1667) 1814s
run: /etc/service/getty-ttyS0: (pid 19188) 3s

I am very confused… :dizzy_face:

You are looking at initramfs. Your changes to the images are not supported. We already indicated where the changes were in systemd and systemd rc emulation.

In the places you suggested I couldn’t find anything that is related with those red boxes:

/etc/init.d# ls
README			cron		  hostname.sh		 mountnfs.sh	   single
avahi-daemon		cryptdisks	  hwclock.sh		 networking	   stop-bootlogd
bootlogd		cryptdisks-early  keyboard-setup.sh	 procps		   stop-bootlogd-single
bootlogs		dbus		  killprocs		 rc		   sudo
bootmisc.sh		diskid_once	  kmod			 rc.local	   umountfs
brightness		dropbear	  mount-configfs	 rcS		   umountnfs.sh
checkfs.sh		elogind		  mountall-bootclean.sh  reboot		   umountroot
checkroot-bootclean.sh	eudev		  mountall.sh		 rmnologin	   urandom
checkroot.sh		exim4		  mountdevsubfs.sh	 rng-tools-debian  uuidd
chrony			fake-hwclock	  mountkernfs.sh	 seatd		   x11-common
console-setup.sh	halt		  mountnfs-bootclean.sh  sendsigs

And I removed any former systemd configuration directories.

Please Google initramfs and how it works. You cannot “disable” initramfs without leaving your system in a possibly unbootable state. initramfs is responsible for integrating modules that were not built-in the kernel in a package that gets loaded before the filesystem is up.

1 Like

Oh there you go…

lsinitramfs /boot/initrd.img-6.1.54-10001-gd517e36a604d | grep scripts
scripts
scripts/functions
scripts/init-bottom
scripts/init-bottom/ORDER
scripts/init-bottom/dropbear
scripts/init-bottom/udev
scripts/init-premount
scripts/init-premount/ORDER
scripts/init-premount/dropbear
scripts/init-top
scripts/init-top/ORDER
scripts/init-top/all_generic_ide
scripts/init-top/blacklist
scripts/init-top/keymap
scripts/init-top/udev
scripts/local
scripts/local-block
scripts/local-block/ORDER
scripts/local-block/cryptroot
scripts/local-bottom
scripts/local-bottom/ORDER
scripts/local-bottom/cryptgnupg-sc
scripts/local-bottom/cryptopensc
scripts/local-bottom/cryptroot
scripts/local-bottom/growroot
scripts/local-bottom/ntfs_3g
scripts/local-premount
scripts/local-premount/ORDER
scripts/local-premount/btrfs
scripts/local-premount/ntfs_3g
scripts/local-premount/resume
scripts/local-top
scripts/local-top/ORDER
scripts/local-top/cryptopensc
scripts/local-top/cryptroot
scripts/nfs

I found one!
scripts/local-bottom/growroot

And possible locations:

/usr/share/initramfs-tools/scripts/local-bottom/growroot
/usr/share/initramfs-tools/hooks/growroot

Almost there…

And this is the portion that makes eth0 discovery endless:

configure_networking()
{
	local netdev_desc

	# The order of precedence here is:
	# 1. Device specified by ip= kernel parameter
	# 2. Device matching MAC specified by BOOTIF= kernel parameter
	# 3. Build-time DEVICE variable
	# In case 2 we only discover the device name while waiting
	# for a device.
	if _set_netdev_from_ip_param; then
		netdev_desc="${DEVICE}"
	elif [ -n "${BOOTIF}" ]; then
		# pxelinux sets BOOTIF to a value based on the mac address of the
		# network card used to PXE boot
		# pxelinux sets BOOTIF to 01-$mac_address

		# strip off the leading "01-", which isn't part of the mac
		# address
		temp_mac=${BOOTIF#*-}

		# convert to typical mac address format by replacing "-" with ":"
		bootif_mac=""
		IFS='-'
		for x in $temp_mac ; do
			if [ -z "$bootif_mac" ]; then
				bootif_mac="$x"
			else
				bootif_mac="$bootif_mac:$x"
			fi
		done
		unset IFS

		_set_netdev_from_hw_address "${bootif_mac}"
		netdev_desc="device with address ${bootif_mac}"
	elif [ -n "${DEVICE}" ]; then
		netdev_desc="${DEVICE}"
	else
		netdev_desc="any network device"
	fi

	# networking already configured thus bail out
	[ -n "${DEVICE}" ] && [ -e /run/net-"${DEVICE}".conf ] && return 0

	local netdevwait=180
	log_begin_msg "Waiting up to ${netdevwait} secs for ${netdev_desc} to become available"
	while true; do
		if [ "$(time_elapsed)" -ge "$netdevwait" ]; then
			log_failure_msg "Network device did not appear in time"
			break
		fi
		if [ -n "${DEVICE}" ]; then
			[ -e "/sys/class/net/${DEVICE}" ] && break
		elif [ -n "${bootif_mac}" ]; then
			_set_netdev_from_hw_address "${bootif_mac}" && break
		else
			_usable_netdev_exists && break
		fi
		sleep 1
	done
	log_end_msg

	_update_ip_param

	wait_for_udev 10

	# support ip options see linux sources
	# Documentation/filesystems/nfs/nfsroot.txt
	# Documentation/frv/booting.txt

	for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do

		# The NIC is to be configured if this file does not exist.
		# Ip-Config tries to create this file and when it succeds
		# creating the file, ipconfig is not run again.
		for x in /run/net-"${DEVICE}".conf /run/net-*.conf ; do
			[ -e "$x" ] && break 2
		done

		case ${IP} in
		none|off)
			# Do nothing
			;;
		""|on|any)
			# Bring up device
			ipconfig -t ${ROUNDTTT} "${DEVICE}"
			;;
		dhcp|bootp|rarp|both)
			ipconfig -t ${ROUNDTTT} -c "${IP}" -d "${DEVICE}"
			;;
		*)
			ipconfig -t ${ROUNDTTT} -d "$IP"
			;;
		esac
	done

	# source ipconfig output
	if [ -n "${DEVICE}" ]; then
		# source specific bootdevice
		. "/run/net-${DEVICE}.conf"
	else
		# source any interface...
		# ipconfig should have quit after first response
		. /run/net-*.conf
	fi
}

These are stock distro scripts. Modify with caution.

1 Like