How can I enable /dev/pty devices in 9.04?

Asked by Jon Martini

I'm trying to use graphical debugging of an Ada program in gnat-gps. Under Ubuntu 8.10 this works great. After upgrading to Ubuntu 9.04 I can't do graphical debugging anymore. After doing some digging I think this is because I don't have any /dev/pty's setup. I've got an 8.10 virtual machine installed and these exist there. I've tried to figure out how to add the /dev/pty's but most of what I find is in reference to MAKEDEV. What I really need is a way to add them with udev. A lot of udev stuff seems to have been rearranged in 9.04, and /dev/pty's seem to have been dropped.

I've added a bug report against gnat-gps, but I really don't think many people care about this package and technically speaking it isn't a problem with gnat-gps, but how jaunty interacts with it.

Here's the specific problem I'm experiencing:

I can start the debugger from Debug->Initialize-><name of program> and set breakpoints. When I try to start the program in the debugger I get the following:

(gdb) run
/dev/ptypd: No such file or directory.

Program exited with code 01.
You can't do that without a process to debug.

Here's the version of gdb I'm using:
(gdb) show version
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Steven Danna (ssd7) said :
#1

I think you can enable legacy pty support via a kernel option at boot. Try the following:

1) Open a terminal
2) run the command sudo nano /boot/grub/menu.lst
3) Scroll down to the bottom until you see something very similar to this

## ## End Default Options ##

title Ubuntu 9.04, kernel 2.6.28-13-generic
uuid 8d96f1c1-2234-4069-8701-1af5e0adf059d
kernel /boot/vmlinuz-2.6.28-13-generic root=UUID=8d96f1c1-2234-4069-8701-1af5e0asdf59d ro quiet splash
initrd /boot/initrd.img-2.6.28-13-generic

There will be a number of entries below this, but you might not want to mess with those, since they will be useful if you make a typo in the following steps.

4)Add the following to the very end of the line that starts with "kernel" (it may start with "boot")

pty.legacy_count=32

5) Save(Ctrl+O) and Exit (Ctrl+X)
6) Reboot
7) Try to run the command that was previously failing.

I hope this works for you!

Revision history for this message
Jon Martini (jon-martini) said :
#2

Thanks Steven!

Adding pty.legacy_count=32 was a bit too low. I just set it to the max of 256 and that got me half way there. I just needed to update permissions since initially it all the pty's were -rw------. I'll check when I get home and see if my chmod was persistent. If so I'll mark this as solved. When I get some time I'll update the bug report against gnat-gps. Since that is an ubuntu supported package it really needs to quit using the old school pty's. Also I understand this isn't ubuntu specific but is a result of a change in the defaults for the newer kernels.

The GNAT GPL 2009 tools don't have this problem, so I assume it isn't a technical feasibility issue to change gnat-gps to the newer tty model.

Thanks again for the prompt reply. I've been searching for an answer to this since I installed the 9.04 RC.

-Jonathan

Revision history for this message
Steven Danna (ssd7) said :
#3

I don't think those changes will be persistent, but I could be wrong.
The udev rules for permissions on the various pty's should be
in /lib/udev/rules.d/50-udev-default.rules

However, you don't want to edit that file, because it will be
overwritten by any updates.

You can copy that file from /lib/udev/rules.d/50--udev-default.rules
to /etc/udev/rules.d/ and then edit the lines for the devices that you
need different permissions on. Don't edit the other lines, since this
file will now take precedence over the file in /lib/udev/rules.d/

I'm guessing most of the changes you need to make will be at the very
beginning of the file:

> KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
> KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
> KERNEL=="ptmx", GROUP="tty", MODE="0666"
> KERNEL=="tty", GROUP="tty", MODE="0666"
> KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620"
> KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
> KERNEL=="console", MODE="0600"
>

For more information, you may want to check out "man udev"

Can you help with this problem?

Provide an answer of your own, or ask Jon Martini for more information if necessary.

To post a message you must log in.