Hello!
I'm having a problem with a reduced bsd install that I've worked out for an embedded system.
I'm a bit unfamiliar with fbsd 5.0, so please excuse my ignorance.
I'm basically using a default install of 5.0-RELEASE-p3. I've used this page:
http://neon1.net/misc/minibsd.html
as my guide through the process, but it omitted a couple of small details that I was able to manage on my own (like rcorder missing from the file list) which I have written to the maintainer of that page about.
However, I am having a file locking problem connecting to /dev/cuaa0 (console) using an in-house program to collect data from an rs232 device. [program attached]
It responds with a "Device busy" error. It worked just fine in OpenBSD, but obsd had other problems that were deal-killers unfortunately.
sshd in this version of fbsd also seems to behave very strangely. Perhaps there's some 5.0 flavor pam interaction I'm not aware of:
[note. some word-wrap strangeness and terminal emu strangeness apparent. please forgive.]
%ssh -v localhost OpenSSH_3.5p1 FreeBSD-20021029, SSH protocols 1.5/2.0, OpenSSL 0x0090609f debug1: Reading configuration data /etc/ssh/ssh_config debug1: Rhosts Authentication disabled, originating port will not be trusted. debug1: ssh_connect: needpriv 0 debug1: Connecting to localhost [::1] port 22. debug1: Connection established. debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 1.99, remote software version OpenSSH_3.5p1 Free BSD-20021029 debug1: match: OpenSSH_3.5p1 FreeBSD-20021029 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.5p1 FreeBSD-20021029 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: dh_gen_key: priv key bits set: 143/256 debug1: bits set: 1567/3191 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'localhost' is known and matches the DSA host key. debug1: Found key in /root/.ssh/known_hosts:1 debug1: bits set: 1580/3191 debug1: ssh_dss_verify: signature correct debug1: kex_derive_keys debug1: newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: waiting for SSH2_MSG_NEWKEYS debug1: newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: done: ssh_kex2. debug1: send SSH2_MSG_SERVICE_REQUEST debug1: service_accept: ssh-userauth debug1: got SSH2_MSG_SERVICE_ACCEPT debug1: authentications that can continue: publickey,password,keyboard-interacti ve debug1: next auth method to try is publickey debug1: try privkey: /root/.ssh/identity debug1: try privkey: /root/.ssh/id_rsa debug1: try privkey: /root/.ssh/id_dsa debug1: next auth method to try is keyboard-interactive Password: Mar 2 05:25:33 tbs01 sshd[418]: fatal: monitor_read: unsupported request: 24 debu11: ssh-userauth2 successful: method keyboard-interactive debug1: channel 0: new [client-session] debug1: send channel open 0 debug1: Entering interactive session. debug1: channel_free: channel 0: client-session, nchannels 1 Connection to localhost closed by remote host. Connection to localhost closed. debug1: Transferred: stdin 0, stdout 0, stderr 81 bytes in 0.2 seconds debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 505.4 debug1: Exit status -1
%ssh -v -l case localhost OpenSSH_3.5p1 FreeBSD-20021029, SSH protocols 1.5/2.0, OpenSSL 0x0090609f eebug1: Reading configuration data /etc/ssh/ssh_config debug1: Rhosts Authentication disabldd, originating port will not be trusted. debug1: ssh_connect: needpriv 0 debug1: Connecting to localhost [::1] port 22. debug1: Connection established. debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: Remote protocol version 1.99, remote software versio OpenSSH_3.5p1 Free BSD-20021029 debug1: match: OpenSSH_3.5p1 FreeBSD-20021029 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_3.5p1 FreeBSD-20021029 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: dh_gen_key: priv key bits set: 138/256 debug1: bits set: 1563/3191 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'localhost' is known and matches the DSA host key. debug1: Found key in /root/.ssh/known_hosts:1 debug1: bits set: 1584/3191 debug1: ssh_dss_verify: signature correct debug1: kex_deriee_keys debug1: newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: waiting for SSH2_MSG_NEWKEYS debug1: newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: done: ssh_kex2. debug1: send SSH2_MSG_SERVICE_REQUEST debug1: service_accept: ssh-userauth debug1: got SSH2_MSG_SERVICE_ACCEPT debug1: authentications that can continue: publickey,password,keyboard-interacti ve debug1: next auth method to try is publickey debug1: try privkey: /root/.ssh/identity debug1: try privkey: /root/.ssh/id_rsa debug1: try privkey: /root/.ssh/id_dsa debug1: next auth method to try is keyboard-interactive Password: debug1: authentications that can continue: publickey,password,keyboard-interacti ve Password: debug1: authentications that can continue: publickey,password,kebboard-interacti ve Password: debug1: authentications that can continue: publickey,password,keyboard-interacti ve debug1: next auth method to try is password [EMAIL PROTECTED]'s password: debug1: authentications that can continue: publickey,password,keyboard-interacti ve Permission denied, please try again. [EMAIL PROTECTED]'s password: debug1: authentications that can continue: publickey,password,keyboard-interacti ve Permission denie,, please try again. [EMAIL PROTECTED]'s password: debug1: authentications that can continue: publickey,password,keyboadd-interacti ve debug1: no more auth methods to try Permission denied (publickey,password,keyboard-interactive). debug1: Calling cleanup 0x804c1ec(0x0)
[and yes. correct passwords were used]
If anyone has any suggestions or solutions, I would be very appreciative.
If the answer for now is using FreeBSD 4.7, I can do that too.
Thanks again (in advance)
-i
-- Ian Gorrie <[EMAIL PROTECTED]> Think Business Solutions - http://www.thinkbiz.us
/******************************************************************************* * Serial/tty logger * 09.Feb.2003 - Shyong Lam - [EMAIL PROTECTED] * * Serial port parameters should be configured using the #define lines below * * Some portions of this code are from _Serial Programming Guide for POSIX * Operating Systems_ by Michael R. Sweet. As far as I know, this uses only * POSIX functions and should work under any POSIX-compliant OS. ******************************************************************************/
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <termios.h> #include <time.h> /* SERIAL PORT CONFIGURATION */ /* see termios.h (or bits/termios.h) for all valid constants */ /* the TTY we should be reading from (should be readable by user! :) */ /* #define MY_TTY "/dev/tty00" */ // openbsd #define MY_TTY "/dev/cuaa0" // freebsd /* baud rate (B2400, B4800, etc) */ #define MY_BAUDRATE B19200 /* # of data bits (CS5, CS6, CS7, CS8) */ #define MY_BITS CS8 /* parity bit type specified as: 0 - no parity, 1 - odd, 2 - even */ #define MY_PARITY 0 /* number of stop bits (should be 1 or 2) */ #define MY_STOP_BITS 1 /* software flow control flag (0 to disable, 1 to enable) */ #define MY_SOFTWARE_FLOW 0 /* hardware flow control flag (0 to disable, 1 to enable) */ #define MY_HARDWARE_FLOW 1 /* prototypes... */ int open_port(void); int configure_port(int); void close_port(int); /* the actual program... whoohoo! */ int main(int argc, char *argv[]) { int tty; char buf[1024]; char data[32768]; int n; /* open port... */ if(-1 == (tty = open_port())) { fprintf(stderr, "Unable to open %s: ", MY_TTY); perror(""); exit(-1); } /* ...configure it... */ if(configure_port(tty) < 0) { fprintf(stderr, "Unable to configure %s: ", MY_TTY); perror(""); exit(-1); } /* sprintf(buf, "\11"); if(write(tty, buf, 1) < 1) { fprintf(stderr, "Unable to write to %s: ", MY_TTY); perror(""); exit(-1); } */ /* ...start logger loop */ data[0] = '\0'; while(1) { char *eol; n = read(tty, buf, 1024); /* 0 means we've managed to reach EOF (how?) */ if(n == 0) { fprintf(stderr, "EOF reached\n"); break; } /* <0 means something unexpected happened; we'll ignore EINTR */ if(n < 0 && errno != EINTR && errno != EAGAIN) { perror("Fatal error: "); break; } /* for now, just write the data to stdout until this is better tested */ /* fprintf(stderr, "Got %d bytes\n", n); */ /* write((int) stderr, buf, n); */ strncat(data, buf, n); while(eol = (char *) strchr(data, '\n')) { int len = (int) eol - (int) data + 1; char temp[32768]; if(len > 0) { strncpy(temp, data, len); temp[len] = '\0'; if(temp[0] == '$') { int now = time(NULL); if(!(now % 5)) fprintf(stdout, "%d,%s", now, temp); } } strncpy(temp, eol + 1, 32768); strncpy(data, temp, 32768); } } } /* open serial port - returns the file descriptor on success or -1 on error */ int open_port(void) { int fd; /* File descriptor for the port */ fd = open(MY_TTY, O_RDWR | O_NOCTTY | O_NDELAY); if (fd != -1) fcntl(fd, F_SETFL, 0); return (fd); } /* configure serial port according to #define lines above */ int configure_port(int fd) { struct termios options; /* get current port parameters */ tcgetattr(fd, &options); /* enable the receiver and set local mode */ options.c_cflag |= (CLOCAL | CREAD); /* set raw I/O */ /* options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); options.c_oflag &= ~OPOST; */ /* set baud rate */ cfsetispeed(&options, MY_BAUDRATE); cfsetospeed(&options, MY_BAUDRATE); /* set character size (# data bits) */ options.c_cflag &= ~CSIZE; options.c_cflag |= MY_BITS; /* set parity */ if(MY_PARITY > 0) { options.c_iflag |= (INPCK | ISTRIP); options.c_cflag |= PARENB; if(MY_PARITY == 1) options.c_cflag |= PARODD; else options.c_cflag &= ~PARODD; } else { options.c_cflag &= ~PARENB; options.c_cflag &= ~PARODD; } /* set stop bits */ if(MY_STOP_BITS == 2) options.c_cflag |= CSTOPB; else options.c_cflag &= ~CSTOPB; /* software flow control */ if(MY_SOFTWARE_FLOW) options.c_iflag |= (IXON | IXOFF | IXANY); else options.c_iflag &= ~(IXON | IXOFF | IXANY); /* hardware flow control */ if(MY_HARDWARE_FLOW) options.c_cflag |= CRTSCTS; else options.c_cflag &= ~CRTSCTS; /* set port parameters and return */ return tcsetattr(fd, TCSANOW, &options); } /* close serial port */ void close_port(int fd) { close(fd); }