The Lemon's Userbars

Music Tastes Blender User

Lemon Mail!

Email:
Text-only emails

Friday, 2 November 2007

Slow print dialog - CUPS configuration fix!

Well, I thought I'd post something useful on here for once. I finally fixed the reeeally slow print dialog that pops up in KDE! (+other places) Basically, I found out long ago that if you set it to print through the 'Generic LPD printing system' it would load spiffingly fast, but if it was set to CUPS (which I prefer, due to the better drivers) it would take several minutes. Well, I left it on 'Generic LPD printing system' for a while, but I recently ordered a duplex unit to plug into my printer, unfortunately, only afterwards realising that CUPS was the only system that supported drivers that did duplexing (HPIJS), so I finally decided to get off my bum and do something about it... Two hours later (maybe even three), after some unsuccesful searching on the internet, I decided to go and have a look at the configuration myself. (I'm a bit of a linux guru, but I'm lazy, and I thought I might be able to find a quick fix ;) I used the KDE print configuration system, but for the purposes of this how-to, you can just open /etc/cups/cupsd.conf in a text editor, providing you have the correct permissions. Anyway, getting back to the point, I found the following under the 'Network' tab/'Listen':


*:631

Bear in mind that this was the default configuration. (I restored it earlier as part of a supposed fix I found on the internet! Basically, its been listening to my entire network all the time, leading to some VERY long startup times as it scans the whole lot!! I changed it to:

localhost:631

This means that it will only listen to requests from the computer it is running on, not so useful if you run a print server on your local network, but in my case, I don't want it listening to the whole network anyway!!

The result - Instant loading times! I also found that the KDE print manager was trying to start jobs as root, but without a password, which caused some errors to be printed when cups was in debug mode. I changed this to the user, lp, though I'm not sure whether it will make any difference, but I did find a bug that lets KDE steal the username and password you type in when clicking on it's print server configuration button/menu entry and use it instead of whatever user you have entered into the print manager configuration - A BAD BAD BAD security flaw!!! But I can't be bothered to report it right now... Just be careful about it if you do what I did and use the KDE print palava to set everything up. Alternatively, you can use the quick and simple how-to below: (I wrote it for dummies!!)

1) Make sure your computer is running. (hehehe)

2) Enough humour, now concentrate!

3) Go to a terminal and type:

>su
(enter root password)

3.5) Optionally, if you're nervous, you can make a backup of your cups configuration at this stage by typing:

>cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.mybackup

Then, if anything goes wrong, (unlikely, but you're on your own if you don't make a backup first and it does... :P ) you can restore the backup with the following:

>mv /etc/cups/cupsd.conf.mybackup /etc/cups/cupsd.conf
(type 'y' and press enter)

3.75) Now open your configuration file in a text editor like so:

>vi /etc/cups/cupsd.conf (you can use any text editor, but most people have vi so
that's what I've written this for!)

4) Then type the following, exactly as written:

:/\*:631

and press return. This should give you a line that reads something like "Listen *:631", if it does not, keep typing:

//

and pressing return, until you do get to it.

5) Press the insert key on your keyboard.

6) Now remove the offending '*', using the cursor keys and backspace.

7) Instead type 'localhost' in its place.

8) Press ESC. (don't forget this step lol)

9) Now type:

:wq

to save the current file and quit vi.

10) That's vi out of the way! If you used a different text editor, it was probably a whole lot simpler, but I prefer to use vi when I'm in superuser mode as fancy-pants graphical text editors clutter up your root logs and waste space! Now, in the terminal again, type:

>killall cupsd -HUP

OR:

>/etc/init.d/cups restart

The second method is probably to be preferred, but use the first one if you have to!

11) That's it folks, the problem should now be sorted!!

12) Don't forget to exit superuser mode (and close your terminal session if desired), to do this, type:

>exit

or press CTRL-D.

Hope that helps anybody with the same problem!! (I know there are countless numbers of people from my web searches - but whether they will find my blog or not!...) Feel free to comment on my use of vi over emacs hehehe...

And the moral of the story? Don't spend three hours searching for a 'quick fix' on the net when you could sort the problem in (under) two minutes yourself!!

~lemon. :)

0 comments: