Code review comment for lp:~jamesodhunt/upstart/bug-980917-reworked

Revision history for this message
James Hunt (jamesodhunt) wrote :

Hi Steve,

> This is a completely unnecessary check. These three device nodes are
> guaranteed to *always* be present at boot time.

On Ubuntu we run MAKEDEV when the devtmpfs /tmp is mounted is mounted, but although these devices are expected to exist on a normal working system, I don't see that we can guarantee that for non-Ubuntu systems, particularly those using a static /dev. Hence, the defensive programming to try to recover in the case where 'the impossible' happens.

> Either they're set up by the initramfs, or they're required to be part
> of /dev on the root filesystem, or the system must be configured for the
> kernel to automount devtmpfs at boot time.
> It is therefore *wrong* for upstart to take action when these device nodes
> are missing, as that means the system is badly broken and requiring admin
> intervention

Ok, so unlikely though it is, if an admin _does_ inadvertently remove a crucial device node on a system running Upstart with no initramfs and a static /dev, assuming they have access to another working system, they'll need to do something akin to the following to recover:

- boot with "init=/bin/sh root=/dev/sda1 rootfstype=ext4"
  (remove "quiet" and "splash" if present too).

- run the following to mount disk read-write:

  # mount -oremount,rw /

- recreate any missing device nodes using mknod(1), or better, just run:

  # MAKEDEV std

- either call "sync", remount disks read-only, halt and power-cycle ("sync && mount
  -oremount,ro / && halt"), or just start Upstart:

  # exec /sbin/init </dev/console >/dev/console 2>&1

> This (/dev/kmsg) is a device that could possibly be missing (it's not
> included in the "std" set from MAKEDEV), but it also seems optional...
> if missing, you just don't get messages logged, right?

That's right - Upstarts switches the NIH logger to use /dev/kmsg to make
use of the kernel ring buffer for logging all output. This allows early
Upstart output to appear in the system log when a syslog daemon
eventually starts.

« Back to merge proposal