zram-config runs even after uninstalled, needs purge

Bug #1036339 reported by LeoRochael
46
This bug affects 10 people
Affects Status Importance Assigned to Milestone
zram-config (Ubuntu)
Confirmed
High
Unassigned

Bug Description

zram-config, even after uninstalled, leaves behind the /etc/init/zram-config.conf file, likely because it's marked as a conffile

This file, being the only actual functional file in zram-config, and the only thing needed by Upstart to configure zram swaps, doesn't check whether the zram-config package is installed before merrily continuing as if zram-config were actually in the system.

I suggest to move some of the /etc/init/zram-config.conf code into shell scripts that are tested for presence (or executability) before being run, exiting silently if they're not there.

If they're absent, this means package is uninstalled and zram-config should exit silently.

It'd be nice if, in the process, some configuration moved into /etc/default/zram-config, like the fraction of the ram that should be used for zram swap (in the line around "(1/2 of ram)" comment in "zram-config.conf").

Steps to reproduce:

 $ sudo apt-get install zram-config
 $ cat /proc/swaps
  (see zram swap(s))
 $ sudo apt-get remove zram-config
 $ sudo reboot
 (wait for reboot and open terminal again)
 $ cat /proc/swaps
  (see zram swap(s) still there when they shouldn't)

The workaround is to type

dpkg --purge zram-config

Which finally removes the upstart script and stops zram swaps from being configured at boot.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: zram-config 0.1
ProcVersionSignature: Ubuntu 3.2.0-29.46~ppa1-generic-tuxonice 3.2.24
Uname: Linux 3.2.0-29-generic-tuxonice x86_64
ApportVersion: 2.0.1-0ubuntu12
Architecture: amd64
Date: Mon Aug 13 20:06:46 2012
Dependencies:

InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=pt_BR:pt:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=pt_BR.UTF-8
 SHELL=/bin/bash
SourcePackage: zram-config
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Miguel Mendes Ruiz (migmruiz) wrote :

Confirmed on Quantal

Changed in zram-config (Ubuntu):
status: New → Confirmed
Revision history for this message
Kazuhiro NISHIYAMA (znz) wrote :

How about inserting `[ -d /usr/share/doc/zram-config ] || exit 0` into top of `pre-start script` in /etc/init/zram-config.conf ?

Changed in zram-config (Ubuntu):
importance: Undecided → High
Revision history for this message
stuart naylor (stuartiannaylor68) wrote :

#!/bin/sh
# preinst script for zram-config
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

case "$1" in
    install|upgrade)
        if [ -z "$2" ]; then
            if [ -f /etc/init/zram.conf ]; then
                rm -f /etc/init/zram.conf
            fi
        fi
    ;;

    abort-upgrade)
    ;;

    *)
        echo "preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

Revision history for this message
stuart naylor (stuartiannaylor68) wrote :

Not sure what has changed from Xenial in deb packaging and systemd service retention but its not a user conf file in anyway so |remove and delete file.

The package is practically completely broken and totally illogical and amazing it has managed to duck under the radar of so many releases.
https://answers.launchpad.net/ubuntu/+source/zram-config/+question/678905

Revision history for this message
stuart naylor (stuartiannaylor68) wrote :

#service on removal sym link to /dev/null
[Unit]
Description=Initializes zram swaping

[Service]
ExecStart=/usr/bin/init-zram-swapping
ExecStop=/usr/bin/end-zram-swapping
Type=oneshot
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

#description "Initializes zram swaping"
author "Adam Conrad <email address hidden>"

start on runlevel [2345]

pre-start exec /usr/bin/init-zram-swapping

pre-stop exec /usr/bin/end-zram-swapping

#upstart filename /etc/init/zram_conf.conf ! zram.conf

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

Other bug subscribers

Remote bug watches

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