proftpd and mysql: Protocol violation by server: blank line on control.

Discussion in 'HOWTO-Related Questions' started by marsvin, Jan 29, 2007.

  1. marsvin

    marsvin New Member

    Hi guys,

    I've just finished the proftpd howto but I haven't managed to get it working.

    When I try to log in I get the following error message:
    Code:
    Protocol violation by server: blank line on control.
    Remote host has closed the connection.
    On the server side only one line shows up in the log: (I've hidden the ip and hostnames :p)
    Code:
    Jan 29 20:36:22 <hostname> proftpd[10031] <hostname> (::ffff:<ip>[::ffff:<ip>]): FTP session closed.
    The only real difference between my setup and the howto's is the mysql server is not on the same server as the ftp but I've made sure the mysql server is reachable from the ftp server. mysql.log and mysql.err don't show anything at all.

    Not sure what else I can check.. Any ideas would be much appreciated! :)

    -- marsvin
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Did you use the correct hostname (without ftp:// in the beginning)?
     
  3. marsvin

    marsvin New Member

    After some more digging I came up with another error while debugging proftpd (using "proftpd -nd6").
    Code:
    localhost (123.123.123.123[123.123.123.123]) - FTP session requested from unknown class
    Also it reports the following line in the configuration as deprecated:
    Code:
    SQLAuthenticate         users* groups*
    Finally proftpd -l is supposed to show up mod_sql I think but in my case all it shows is
    Code:
    # proftpd -l
    Compiled-in modules:
      mod_core.c
      mod_xfer.c
      mod_auth_unix.c
      mod_auth_file.c
      mod_auth.c
      mod_ls.c
      mod_log.c
      mod_site.c
      mod_delay.c
      mod_dso.c
      mod_auth_pam.c
      mod_readme.c
      mod_cap.c
      mod_ctrls.c
    
     
    Last edited: Jan 30, 2007
  4. marsvin

    marsvin New Member

    Hi Falko,

    I just missed your reply, yes I'm using ncftp -u <user> localhost to test the connection. I'm thinking I should try moving mysql to the same server as the ftp just to see if it has to do with the remote connection. I'll let you know what happens.

    update: Installing mysql locally shows the exact same errors so it seems that's not the problem.

    -- marsvin
     
    Last edited: Jan 30, 2007
  5. marsvin

    marsvin New Member

    I just found a way to get a more detailed error readout by adding the following line to proftpd.conf:
    Code:
    SQLLogFile /var/log/proftpd/mod_sql.log
    
    Very surprisingly I got the following readout:
    Code:
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: defaulting to 'postgres' backend
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: backend module 'mod_sql_postgres/4.02'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: backend api    'mod_sql_api_v2'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: >>> sql_sess_init
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: entering   postgres cmd_defineconnection
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:  name: 'default'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:  user: 'proftpd'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:  host: 'localhost'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:    db: 'ftp'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:  port: '5432'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]:   ttl: '0'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: exiting    postgres cmd_defineconnection
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: entering   postgres cmd_open
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: exiting    postgres cmd_open
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: unrecoverable backend error
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: error: 'mod_sql_postgres/4.02'
    Jan 30 15:49:03 mod_sql/4.2.1[7358]: message: 'could not connect to server: Connection refused
            Is the server running on host "localhost" and accepting
            TCP/IP connections on port 5432?
    
    I was expecting a connect error or some misnamed table or something but it appears it's trying to connect using postgresql instead of mysql?

    I double checked:
    Code:
    # aptitude show proftpd-pgsql
    Package: proftpd-pgsql
    New: yes
    State: not installed
    ...
    
    # aptitude show proftpd-mysql
    Package: proftpd-mysql
    New: yes
    State: installed
    ...
    
    Why would it be trying to connect using PostgreSQL?
     
  6. marsvin

    marsvin New Member

    Ok I found a "fix".. This isn't probably the best way to do it but I found editing the file /etc/proftpd/modules.conf and commenting out this line:
    Code:
    #LoadModule mod_sql_postgres.c
    
    Makes proftpd default to mysql rather than postgres. I don't know why that line is even in there since I haven't installed the proftpd-pgsql package but at least it works now!

    If anyone knows of a "cleaner" way to do this please feel free to clue me in ;)
     

Share This Page