services started with eatmydata should remove eatmydata by default

Bug #1257036 reported by Scott Moser on 2013-12-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)
Medium
Scott Moser

Bug Description

when services are started from sysvinit (/etc/init.d/$SERVICE start), LD_PRELOAD will pass through to the started service. That is fine, and even expected/desired in most cases.

One explicit case where it is not expected (most of the time) is eatmydata is used.

The use case that I want to "do the right thing" is:
 sudo eatmydata apt-get install mysql

Here, I want apt-get to run with eatmydata (in order to improve performance), but do not want the mysql daemon to start with fsync() disabled.

My solution to this problem is to simply have something clean libeatmydata.so from LD_PRELOAD prior to starting services. I'd support an environment variable NEVER_DISABLE_LIBEATMYDATA=1 that would enable the user who wanted eatmydata to pass through to the service.

It seems the common place for this to be done would be either:
 a.) /usr/sbin/service (sysvinit-utils)
 b.) invoke-rc.d

Doing this in invoke-rc.d fixes it for the 'dpkg install' path, and is the least invasive path. (fixing 'service' would not actually fix the dpkg install path as invoke-rc.d does not call service).

so, I'd suggest we fix this in invoke-rc.d.

Related bugs:
 * bug 1236531: cloud-init support package install with eatmydata

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: sysv-rc 2.88dsf-41ubuntu4
ProcVersionSignature: Ubuntu 3.12.0-4.12-generic 3.12.1
Uname: Linux 3.12.0-4-generic x86_64
ApportVersion: 2.12.7-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Mon Dec 2 14:26:17 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2011-10-19 (775 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
PackageArchitecture: all
SourcePackage: sysvinit
UpgradeStatus: Upgraded to trusty on 2013-05-20 (196 days ago)

Related branches

Scott Moser (smoser) wrote :
Changed in sysvinit (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
Scott Moser (smoser) wrote :

In trying to test my fix for this, i went through a few packages before I found one that was actually broken. It seems that many packages (apache2, postgres, anacron) end up cleaning their own environment.

One package that *is* affected is 'backuppc' as demonstrated here:

$ sudo apt-get install --quiet --assume-yes eatmydata
$ sudo eatmydata apt-get install --assume-yes backuppc
$ sudo service backuppc status
 * backuppc is running
$ sudo cat /proc/$pid/environ | tr '\0' '\n' | grep ^LD_PRELOAD
LD_PRELOAD=/usr/lib/libeatmydata/libeatmydata.so /usr/lib/libeatmydata/libeatmydata.so

After the fix is applied, we see:

$ sudo cat /proc/$pid/environ | tr '\0' '\n' | grep ^LD_PRELOAD
LD_PRELOAD=

Scott Moser (smoser) wrote :

better recreate instructions (which set 'pid')
$ sudo apt-get install --quiet --assume-yes eatmydata
$ sudo eatmydata apt-get install --assume-yes backuppc
$ sudo service backuppc status
 * backuppc is running
$ pid=$(ps axw | awk '$6 ~ /BackupPC$/ { print $1 }')
$ sudo cat /proc/$pid/environ | tr '\0' '\n' | grep ^LD_PRELOAD
LD_PRELOAD=/usr/lib/libeatmydata/libeatmydata.so /usr/lib/libeatmydata/libeatmydata.so

After the fix is applied, we see:

$ sudo cat /proc/$pid/environ | tr '\0' '\n' | grep ^LD_PRELOAD
LD_PRELOAD=

Scott Moser (smoser) wrote :

I failed to put a bug number in the debian/changelog, but:

This bug was fixed in the package sysvinit - 2.88dsf-41ubuntu5.

----------------------
sysvinit (2.88dsf-41ubuntu5) trusty; urgency=low

  * debian/src/sysv-rc/sbin/invoke-rc.d: clean eatmydata from environment
    unless INVOKE_RCD_ALLOW_EATMYDATA is set to value other than '0'.

 -- Scott Moser <email address hidden> Mon, 02 Dec 2013 17:12:03 -0500

Changed in sysvinit (Ubuntu):
assignee: nobody → Scott Moser (smoser)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers