"scp-dbus-service" creates 100s of thousands symlinks to the ppd-file in "/tmp" untill the root filesystem runs out of inodes everytime I print something

Bug #1156398 reported by nomike
48
This bug affects 9 people
Affects Status Importance Assigned to Milestone
system-config-printer (Debian)
Fix Released
Unknown
system-config-printer (Ubuntu)
Fix Released
High
Unassigned
Utopic
Fix Released
High
Unassigned

Bug Description

When I print e.g. a webpage in Firefox, shortly after the printing finished, the root filesystem is running out of available inodes.
"/tmp/" is populated with hundreds of thousands of symlinks to "/etc/cups/ppd/Hewlett-Packard-hp-LaserJet-4350.ppd" which are all named like "51465xxxxxxxx" (where x is a hexadecimal digit) and are created at a rate of aprox. 1500 new symlinks per second. The filenames are not counted up but seem to appear in random order.

During this time the process "/usr/bin/python /usr/share/system-config-printer/scp-dbus-service.py" is using ~130% CPU.

As soon as I kill this process, no more symlinks are created.
When I wait for the inodes to run out, this process's CPU usage drops to ~7% for a few seconds before the process suddenly disapears from the process list. This indicates that all the symlinks are created by this one process.

If I delete the symlinks now and print another document, things start over again.

---+ Furher notes
This does not happen when printing with
lpr
gv

It does happen when printing with
Firefox
Chromium
LibreOffice

An unpriviledged user could break down the system by filling up all free inodes on the root fs, so this might be security relevant.

[Impact]

On an attempt to print out of an application like for example Firefox a process runs crazy and does nothing than creating links in /tmp until the file system runs out of inodes. If the /tmp directory is on the root partition (and not a RAM disk) the system cannot create files any more and on the next boot it can take hours for the system to clean up, making the impression that the system is not able to boot any more.

[Test Case]

WARNING: To get your system easily back into a usable state by a siumple reboot, at first configure /tmp to be on a RAM disk.

Modify the permissions of the PPD file of your print queue to remove the world-readable bit:

sudo chmod o-r /etc/cups/ppd/*.ppd

Then try to print from Firefox (or another desktop application). Run the "top" command and observe, scp-dbus-service will pick up 100% CPU. /tmp will fill up with links quickly.

Kill the scp-dbus-service process to stop this. A quick workaround is removing the executable bit of scp-dbus-service.py but this will disable functionality of system-config-printer and other printer setup tools.

With the proposed package this will not happen any more. No mass creation of symlinks in /tmp and no CPU hogging by scp-dbus-service.

[Regression Potential]

Lo, the patch is rather simple, erroring out correctly when the PPD file is not readable to avoid an infinite loop.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: system-config-printer-common 1.3.11+20120807-0ubuntu10
ProcVersionSignature: Ubuntu 3.5.0-25.39-generic 3.5.7.4
Uname: Linux 3.5.0-25-generic x86_64
NonfreeKernelModules: openafs fglrx
ApportVersion: 2.6.1-0ubuntu10
Architecture: amd64
Date: Mon Mar 18 00:45:56 2013
Lpstat: Error: command ['lpstat', '-v'] failed with exit code 1: lpstat: Transport endpoint is not connected
MachineType: Gigabyte Technology Co., Ltd. GA-A75M-UD2H
MarkForUpload: True
PackageArchitecture: all
Papersize: letter
PpdFiles: Hewlett-Packard-hp-LaserJet-4350: HP LaserJet 4350 pcl3, hpcups 3.12.2
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.5.0-25-generic root=/dev/mapper/hostname-root ro splash quiet vt.handoff=7
SourcePackage: system-config-printer
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 11/03/2011
dmi.bios.vendor: Award Software International, Inc.
dmi.bios.version: F5
dmi.board.name: GA-A75M-UD2H
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.chassis.type: 3
dmi.chassis.vendor: Gigabyte Technology Co., Ltd.
dmi.modalias: dmi:bvnAwardSoftwareInternational,Inc.:bvrF5:bd11/03/2011:svnGigabyteTechnologyCo.,Ltd.:pnGA-A75M-UD2H:pvr:rvnGigabyteTechnologyCo.,Ltd.:rnGA-A75M-UD2H:rvr:cvnGigabyteTechnologyCo.,Ltd.:ct3:cvr:
dmi.product.name: GA-A75M-UD2H
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Revision history for this message
nomike (michael-postmann) wrote :
information type: Private Security → Public Security
summary: - "scp-debus-service" creates 100s of thousands symlinks to the ppd-file
- in "/tmp" untill the root filesystem runs out of inodes everytime I
- print something
+ "scp-dbus-service" creates 100s of thousands symlinks to the ppd-file in
+ "/tmp" untill the root filesystem runs out of inodes everytime I print
+ something
information type: Public Security → Public
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in system-config-printer (Ubuntu):
status: New → Confirmed
Revision history for this message
Blake Griffith (blake-a-griffith) wrote :

To make matters worse, this bug caused my machine to hang for around 24 hours during the boot up process at the "Cleaning up temporary files" step.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, do you have any idea what is going on here?

I never observed this problem on my machines and in the linked Debian bug report the user suffers the problem until he uninstalls Adobe Reader and the problem does not reoccur when he installed Adobe Reader again.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

nomike, do you have Adobe Reader installed on your system?

Changed in system-config-printer (Debian):
status: Unknown → New
Revision history for this message
Tim Waugh (twaugh) wrote :

The clue is "every time I print something". scp-dbus-service is not involved in the print path, and is only used when configuring queues.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, thanks for the confirmation that scp-dbus-service is not involved in print jobs, I also assumed that and found it strange that it gets somehow triggered for some users.

I think CUPS reates temporary copies (or symlinks to) PPDs in /tmp but removes them after use.

Is there perhap something incorrectly implemented in the GTK print dialog so that printing a job triggers scp-dbus-service somehow?

Revision history for this message
Tim Waugh (twaugh) wrote :

cupsGetPPD3() and related calls create symlinks to /etc/cups/ppd/* but it is the caller's responsibility to remove them.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

This would mean that some process falls into an infinite loop hammering cupsGetPPD3() calls.

Does scp-dbus-service use cupsGetPPD3()?

Changed in system-config-printer (Debian):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.3+20141027-0ubuntu1

---------------
system-config-printer (1.5.3+20141027-0ubuntu1) vivid; urgency=medium

  * New upstream release
     o GIT 1.5.x snapshot from 27 October 2014
     o Document retrieval is fixed
     o Openprinting requests are performed from the main loop, no inner loop
       required
     o Nested classes are not allowed
     o gpk-install-package-name is no longer used, direct D-Bus PackageKit
       access instead.
     o With PackageKit-based utility installation working again, fixed some
       additional, overlooked bugs to get it actually working
     o The manufacturer name for Kyocera has been fixed
     o Fixed infinite loop generating millions of links in /tmp when PPD file
       requested from a print queue is not readable (LP: #1156398,
       Closes: #764253).
     o Translation update and clean-up
     o Various other bug-fixes
     o Some Python 3 fixes
  * debian/patches/25_install-smbclient-if-smb-backend-is-missing.patch: When
    the "smb" CUPS backend is missing, do not try to install "samba-client"
    but "smbclient". The PackageKit which comes with Ubuntu is not able to
    install packages via "Provides:" entries.
  * debian/patches/30_scp-dbus-service-driver-download-hang-fixes.patch:
    Removed, fixed upstream in another form.
  * debian/patches/33_ipp-over-usb-support.patch: Updated patch to apply
    to new upstream code.
  * debian/patches/35_more-debugging-output.patch,
    debian/patches/37_debugging-tidy-ups.patch
    debian/patches/40_monitor-only-run-one-timer-at-a-time.patch,
    debian/patches/43_dont-ask-packagekit-to-look-for-drivers-for-empty-device-ids.patch,
    debian/patches/45_use-items-instead-of-iteritems-in-groupphysicaldevicesrequests-group.patch,
    debian/patches/47_fix-for-automatically-adding-bluetooth-printers.patch,
    debian/patches/50_dont-run-gpk-install-package-name-directly-use-installpackage-module.patch,
    debian/patches/53_make-installpackage-a-stub-only.patch: Removed the
    patches backported from upstream.
  * debian/patches/35_fix-hp-fax-type-parsing.patch: Fix parsing of the HPLIP
    fax type (LP: #1369789).
  * debian/system-config-printer-gnome.install: Added new module
    "OpenPrintingRequest".
 -- Till Kamppeter <email address hidden> Mon, 27 Oct 2014 20:13:28 +0100

Changed in system-config-printer (Ubuntu):
status: Confirmed → Fix Released
Changed in system-config-printer (Ubuntu):
importance: Undecided → High
Changed in system-config-printer (Ubuntu Utopic):
importance: Undecided → High
status: New → Triaged
description: updated
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded a package fixing bug 1366756, bug 1156398, bug 1380514, and bug 1369789 to utopic-proposed. As soon as the package is approved it will be available for download and testing and instructions will get posted here. Please test the package and give your feedback here, otherwise it will not get available as official update.

To the SRU team: debdiff attached.

Changed in system-config-printer (Ubuntu Utopic):
status: Triaged → In Progress
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello nomike, or anyone else affected,

Accepted system-config-printer into utopic-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/system-config-printer/1.5.1+20141010-0ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in system-config-printer (Ubuntu Utopic):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Leoaloha (lpheobus) wrote :

The proposed package did NOT fix this bug for me.

dpkg - s

Source: system-config-printer
Version: 1.5.1+20141010-0ubuntu2.1

tags: added: verification-failed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, can you help Leoaloha debugging here? I backported the patch to prevent the infinite loop on unreadable PPD files to the s-c-p of Trusty and he still has the problem.

Revision history for this message
Leoaloha (lpheobus) wrote :

Hey guys
Im sorry. I did not reboot the system after applying the new package. after installing and them rebooting, the package fixed the problem

I am changing the tag back to verified

L

tags: added: verification-done
tags: removed: verification-failed verification-needed
Revision history for this message
Reinaert Albrecht (reinaert-albrecht) wrote :

For those that need to clean up after this bug, I found this command to delete files quickly quite useful. Don't run this as root though, you could wreck your installation if you do. In this case most of the files can be deleted from the user account:

 ionice perl -e 'for(<*>){((stat)[9]<(unlink))}'

You can, as usual, interrupt the process with ctrl-z and restart it with the command 'fg'.

Cheers

Revision history for this message
Reinaert Albrecht (reinaert-albrecht) wrote :

I installed system-config-printer-udev_1.5.1+20141010-0ubuntu2.1_amd64.deb and rebooted the system but I still have this bug. For me it's not solved.

Revision history for this message
Reinaert Albrecht (reinaert-albrecht) wrote :

Unfortunately launchpad doesn't allow you to reedit messages. I should add that the perl command stated above should be executed in the /tmp directory NOT in any other directory unless you're willing to lose a lot of files.

Revision history for this message
Scott Carr (kscarr73) wrote :

Another way to delete quick:

ls -U | xargs rm

I have been seeing this problem pretty heavily over the last couple days.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.1+20141010-0ubuntu2.1

---------------
system-config-printer (1.5.1+20141010-0ubuntu2.1) utopic-proposed; urgency=medium

  * debian/patches/60_newprinter-fix-package-installation.patch: Fixed several
    bugs in system-config-printers's facility to install missing packages of
    the printing stack (currently smbclient and libsane-hpaio. LP: #1366756).
  * debian/patches/63_ppdcache-return-exception-rather-than-looping.patch:
    Fixed infinite loop generating millions of links in /tmp when PPD file
    requested from a print queue is not readable (LP: #1156398).
  * debian/patches/65_fix-hp-fax-type-parsing.patch: Fix parsing of the HPLIP
    fax type (LP: #1369789).
  * debian/patches/67_jobviewer-always-fetch-auth-info-required-attribute.patch:
    jobviewer: Always fetch auth-info-required attribute (LP: #1380514).
 -- Till Kamppeter <email address hidden> Thu, 30 Oct 2014 18:21:36 +0100

Changed in system-config-printer (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for system-config-printer has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.