Purging is not the answer here.

First, given that the package auto-added its binaries  to lightdm.conf,
it should make sure that those binaries that are not present anymore in
lightdm.conf when removing them from disk. This is not a config file
that is harmless if left over, this is a config that is broken because
the binaries are no longer present.

Second, even after purging, lighdm.conf still contains the reference to
the wrong binaries, so, purging doesn't help AT ALL.

This is a piece of code from the postrm script, which should do the
right thing:

lightdm_orig_conf=/etc/lightdm/lightdm.conf
remove_hybrid_script () {
    # Precise only!
    if [ -s "$lightdm_orig_conf" ]; then
        # Get the file
        lightdm_orig="$(cat $lightdm_orig_conf)"
        echo "$lightdm_orig" | \
        sed "/.*display-setup-script.*/d" \
        > "$lightdm_orig_conf"

        lightdm_orig="$(cat $lightdm_orig_conf)"
        echo "$lightdm_orig" | \
        sed "/.*display-stopped-script.*/d" \
        > "$lightdm_orig_conf"
    fi
}

The problem is that this script is limited to Precise:
        os_release="$(lsb_release -cs)"
        if [ ! "$1" = "upgrade" ]; then
            if [ "$os_release" = "precise" ]; then
                # Remove the display-setup-script line
                remove_hybrid_script
            fi

This has two problems:

1 - on the preinst (!) script this check is done differently:

add_hybrid_script () {
    if [ "`lsb_release -r -s`" = "12.04" ]; then
        # Precise does not support separate config files
        if [ -s "$lightdm_orig_conf" ]; then

This means that if for some reason lsb_release is 12.04 but the name is
not precise, then the undo doesn't really work.

2 - People can upgrade from precise to something else. So, if they were
running 12.04 when they installed nvidia-prime and then upgraded to
trusty or whatever and remove nvidia-prime, the lightdm.conf file is
left broken.

Please make sure that you undo whatever was done, regardless of the
currently running distribution.  Also, if you are going to check for a
specific fact for doing and undoing, it should be a the same fact, not a
"it should be equivalent" fact.

Finally, the code in the preinst should actually be in the postinst,
otherwise there's the risk that something might fail while unpacking and
the lightdm.conf fiel will be left in a broken state.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1287507

Title:
  LightDM fails to start after removing nvidia-prime

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1287507/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to