パスワードを忘れた? アカウント作成
478738 journal

ribbonの日記: Unable to connect to CUPS server localhost

日記 by ribbon

最近Sambaでプリンタを使う機会は少なくなった。そのため、printers の
指定やprintersセクションを省略することが多い。しかし、そのままでは
起動時にCUPSのエラーが出る。この現象は printing = bsd にすれば直る
のだが、それもなんか変な話。調べてみると下記のような原因だった。

pcapはCUPS/SYSV/AIX用のprintcap解析ルーチン。コンパイル時にCUPSを
使えるようにしていると、このルーチンに入った場合、必ずCUPSに接続
しにいく。

理由は、include/includes.h 内で

  811 #ifndef DEFAULT_PRINTING
  812 #ifdef HAVE_CUPS
  813 #define DEFAULT_PRINTING PRINT_CUPS
  814 #define PRINTCAP_NAME "cups"
  815 #elif defined(SYSV)
  816 #define DEFAULT_PRINTING PRINT_SYSV
  817 #define PRINTCAP_NAME "lpstat"
  818 #else
  819 #define DEFAULT_PRINTING PRINT_BSD
  820 #define PRINTCAP_NAME "/etc/printcap"
  821 #endif
  822 #endif

と定義されていて、既定値のPRINTCAP_NAME が cups になっている。
この状態において、param/loadparm.c のlp_princapname() 内で、
グローバルパラメータの、printcap name が未定義か、空っぽの場合、
かつ、printing が bsd以外の場合、既定値のprintcap 名を返す。
これは、pcap_cache_reload の冒頭部分で、

      const char *pcap_name = lp_printcapname();

として設定されるため、cupsサーバがあろうがなかろうが、printer
パラメータで、bsdを指定しない以外、必ず、caps_cache_reload() ⇒
caps_connect() を呼び、cups サーバに繋ぎにいく。そのため、

[2007/11/29 11:08:33, 3] printing/pcap.c:pcap_cache_reload(117)
    reloading printcap cache
[2007/11/29 11:08:33, 5] printing/print_cups.c:cups_cache_reload(71)
    reloading cups printcap cache
[2007/11/29 11:08:33, 10] printing/print_cups.c:cups_server(51)
    cups server left to default localhost
    Unable to connect to CUPS server localhost - 接続を拒否されました

というようなエラーが出る。

後おまけ。

[2007/11/29 11:08:33, 7] param/loadparm.c:lp_servicenumber(5121)
    lp_servicenumber: couldn't find printers

これは、[printers]セクションがない時に出力される。
param/loadparm.c:lp_survicenumber()において、すべてのサービスを
検索し、見付からないとこのエラーが出る。

この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

物事のやり方は一つではない -- Perlな人

読み込み中...