Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm building an embedded Linux system, based on Gentoo. Using udev, all tty devices are probed with a PROGRAM stanza to determine if they are a modem.

Right now the system boots up with 64 /dev/tty*. When udev probes the tty devices, the system runs out of memory.

How can I reduce the number of produced tty devices to 4? Is this an OS setting or a kernel setting?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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.
share|improve this answer
    
Does ignore_device prevent future rules? If so, I could just put a rule without the rm in a file named 01-my-tty-rules.rules to prevent further processing (and node creation). –  David Pfeffer Nov 20 '11 at 15:28
    
I'm not sure actually, I thought it was more of an "ignore future events related to this device" thing. Worth a shot though. Edit: that doesn't seem to work, I get the ttyXX devices recreated when trying that and restarting udev. –  Mat Nov 20 '11 at 15:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.