[FreeNX-kNX] printing

Martin Steigerwald ms at teamix.de
Thu Jan 26 10:18:55 UTC 2006


Am Dienstag, 24. Januar 2006 20:49 schrieb Alastair Johnson:

> The first problem is in the freenx nxnode script in function
> cmd_node_addprinter() which handles the addprinter request from the client.
> This has to determine the printer driver to use, so calls a script
> confusingly called nxclient. This is NOT a client! It is meant to replicate
> certain functions of the nomachine nxclient as used by the nxserver though,
> such as allowing you to select a printer driver. For me this printer driver
> selection never displayed however, so for testing I modified
> cmd_node_addprinter() to bypass this for testing, hardwiring it to the
> driver for my printer. Another option may be to install the nomachine
> client on the server, since it seems the freenx nxclient script checks for
> the presence of the nomachine client, and calls it if present. I've not
> tried that yet though...

Hello,

yes that worked.  After applied the patch I described in my "freenx problems 
with smb printing setup" post I got dialogs to configure my printer driver. 
It needs NoMachine's nxclient on the server which is generally a good idea, 
cause it provides some other features:

1) nice dialog window for Terminate / Suspend instead of ugly xdialog stuff

2) Suspend / Terminate buttons when you move the mouse to the title bar of the 
window that displays the FreeNX session.

Well, I paste the relevant snippet here:

-----------------------------------------------------------------------
- nxnode uses "-noautokill" as option to nxclient, but nxclient 1.5.0-138 does 
not seem to support this options and displays an error dialog instead of the 
intended dialog -> I removed that option (see diff below)

- nxnode uses lpadmin as a the user of the session, but a user doesn't have 
lpadmin in its path -> I expicitely specified the path

- $KDEHOME does not appear to be set in KDE 3.3 and thus the default value for 
$KDEPRINTRC does not work anymore (/etc/nxserver/node.conf) --> I changed it 
to KDE_PRINTRC="/home/$USER/.kde/share/config/kdeprintrc" cause 
KDE_PRINTRC="~/.kde/share/config/kdeprintrc" didn't work

Okay, thats it. I can do bug reports sometimes but I wanted to post it right 
now so that people who come across the same problems can Google it.

appserver:/# diff -u /usr/lib/nx/nxnode.dist  /usr/lib/nx/nxnode
--- /usr/lib/nx/nxnode.dist     2005-10-08 19:36:07.000000000 +0200
+++ /usr/lib/nx/nxnode  2005-12-21 18:30:42.529485000 +0100
@@ -797,10 +797,10 @@
        ERROR=$(PASSWD="$password" "$COMMAND_SMBMOUNT" "//$computername/$rdir" 
"$HOME/$dir" -o username="$username,ip=127.0.0.1,port=$port" 2>&1)
        if [ $? -eq 0 ]
        then
-               $PATH_BIN/nxclient -dialog ok -caption "NXServer Message" 
-message "Info: Share: '//$computername/$rdir' mounted on: '$HOME/$dir'" 
-noautokill -display :$display &
+               $PATH_BIN/nxclient -dialog ok -caption "NXServer Message" 
-message "Info: Share: '//$computername/$rdir' mounted on: '$HOME/$dir'" 
-display :$display &
                echo "$HOME/$dir" >> 
"$USER_FAKE_HOME/.nx/C-$SERVER_NAME-$display-$sessionid/scripts/mpoint"
        else
-               $PATH_BIN/nxclient -dialog ok -caption "NXServer Message" 
-message "Info: Share: '//$computername/$rdir' failed to mount: $ERROR" 
-noautokill -display :$display &
+               $PATH_BIN/nxclient -dialog ok -caption "NXServer Message" 
-message "Info: Share: '//$computername/$rdir' failed to mount: $ERROR" 
-display :$display &
        fi
 }

@@ -830,12 +830,13 @@
                DEVICE_URI="ipp://localhost:$port/printers/$printer"
                NAME="$printer"
        fi
-       MODEL=$($PATH_BIN/nxclient -printer "$NAME" -noautokill -display :
$display)
+       MODEL=$($PATH_BIN/nxclient -printer "$NAME" -display :$display)
        [ -z "$MODEL" -o "$MODEL" = "cancel: aborted" ] && return

        PUBLIC="-u allow:$USER"
        [ "$public" == "1" ] && PUBLIC=""
-       lpadmin -p "$NAME" -E -v "$DEVICE_URI" -m "$MODEL" $PUBLIC
+# Teamix: User doesn't have lpadmin in his path
+        /usr/sbin/lpadmin -p "$NAME" -E -v "$DEVICE_URI" -m "$MODEL" $PUBLIC
        [ "$defaultPrinter" = "1" ] && lpadmin -d "$NAME"
 }
-----------------------------------------------------------------------

> So far so good(?) except that the kde print manager appears unable to
> authenticate using AuthType Digest. I've tried in from both Gentoo and
> knoppix, and it fails every time. You can work around this by reconfiguring
> the client userspace cupsd to use AuthType BasicDigest in
> ~/.nx/cups/cupsd.conf _while_the_session_is_active_ then getting the cupsd
> to reread its config by using kill -hup on it. This MUST be while the
> session is active because the client rewrites it at the start of  every
> session, ad the authtype appears hardcoded into the nxclient binary.

Well you can change the way the CUPS config by altering a script on the server 
side. This should be the nxnode script I noted above, but I am not completely 
sure. It builds a config for the user-space CUPS and starts it.

> All except this last bit should be reasonably easy to fix on the server,
> and I can't see how the authentication can be a universal problem. If it
> was the nomachine nxclient would never be able to print. I haven't had the
> chance to do any more than this yet. I hope this helps someone to get the
> printing going.

Well as said it should be possible to let the FreeNX server create a different 
CUPS config with "AuthType BasicDigest" as a work-around.

Would be interesting to know tough why KDE-Print doesn't work with "AuthType 
Digest". Maybe it works in a newer version of KDE-Print like the one from KDE 
3.5? 

I like to get that CUPS client side printing to work someday.

Other solution would be a central CUPS server somewhere which talks to all 
networked printers in all rooms (maybe using a special printer VLAN) and 
having the appserver simply talk to that central CUPS server. This could 
reduce the complexity and resource consumption quite a bit:

1) no user-space CUPS has to be started, imagine 100 users with 100 CUPS 
servers

2) the user does not have to choose a printer driver

Regards,
-- 
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de



More information about the FreeNX-kNX mailing list