I'm not sure exactly how the device nodes are created (i.e. the exact sequence of events that lead to their creation), but I'm pretty sure the kernel creates the underlying devices for the 63 /dev/ttyN
devices (plus /dev/tty
) internally, and udev
does the work of making them available inside /dev
(except for /dev/tty
and /dev/tty1
which are created by /etc/init.d/udev-mount
with mknod
).
I don't think you can limit the number of kernel devices via configuration.
Here is a workaround if you want to limit the number of devices that appear in your /dev
though. Create a /etc/udev/rules.d/99-my-tty-rules.rules
file and put something like the following in it:
KERNEL=="tty[2-9][0-9]", RUN="/bin/rm /dev/%k", OPTIONS+="ignore_device"
This will get rid of tty
device files numbered 20 and above.
Notes:
- Using
rm
in there looks really strange, but I can't find a way to not create the node in the first place
- Playing with these entries a bit too enthusiastically can lead to interesting problems - use with caution.
ignore_device
prevent future rules? If so, I could just put a rule without therm
in a file named 01-my-tty-rules.rules to prevent further processing (and node creation). – David Pfeffer Nov 20 '11 at 15:28