GrepUpgradeBreaksDevPts
From NAS-Central Buffalo - The Linkstation Wiki
(Difference between revisions)
(by the magic of google people will find this) |
m |
||
| (One intermediate revision not shown) | |||
| Line 1: | Line 1: | ||
| + | {{Template:Articles|Terastation}} | ||
If you upgrade from the firmware's grep to one of the newer packaged ones floating around, you might find that all of a sudden your telnetd and sshd services don't work. Typical symptoms of the error: | If you upgrade from the firmware's grep to one of the newer packaged ones floating around, you might find that all of a sudden your telnetd and sshd services don't work. Typical symptoms of the error: | ||
Latest revision as of 00:32, 11 November 2007
If you upgrade from the firmware's grep to one of the newer packaged ones floating around, you might find that all of a sudden your telnetd and sshd services don't work. Typical symptoms of the error:
$ telnet tera Trying 192.168.11.150... Connected to tera. Escape character is '^]'. telnetd: getpty: No such file or directory . Connection closed by foreign host.
or
Jul 1 17:35:49 HD-HTGLD03 sshd[8255]: error: openpty: No such file or directory Jul 1 17:35:49 HD-HTGLD03 sshd[8255]: error: session_pty_req: session 0 alloc failed Jul 1 17:35:49 HD-HTGLD03 sshd[8257]: error: setlogin failed: Function not implemented
This is most likely because devpts isn't being correctly mounted on /dev/pts any more. Let's take a close look at /etc/init.d/devpts.sh:
devpts_avail=$(grep -qci '[<[:space:]]devpts' /proc/filesystems || true) devpts_mounted=$(grep -qci '/dev/pts' /proc/mounts || true) devfs_mounted=$(grep -qci '[<[:space:]]/dev[>[:space:]].*devfs' /proc/mounts || true)
Look at the impact of upgrading grep:
root@HD-HTGLD03 ~ # grep devpts /proc/filesystems nodev devpts root@HD-HTGLD03 ~ # ./grep.old -qci devpts /proc/filesystems 1 root@HD-HTGLD03 ~ # grep -qci devpts /proc/filesystems root@HD-HTGLD03 ~ #
Oops! The new grep has different behaviour with respect to -qc: it assumes (correctly) that the user does not want any output. This devpts.sh script relies on the dodgy behaviour of the old grep which still issues a match count even when -q is specified.
The fix is to remove the -q switch from the script:
devpts_avail=$(grep -ci '[<[:space:]]devpts' /proc/filesystems || true) devpts_mounted=$(grep -ci '/dev/pts' /proc/mounts || true) devfs_mounted=$(grep -ci '[<[:space:]]/dev[>[:space:]].*devfs' /proc/mounts || true)
--Aspiers 19:21, 1 July 2007 (CEST)

