LightDM fails to start after removing nvidia-prime

Bug #1287507 reported by Rohan Dhruva
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
nvidia-prime (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I installed nvidia-prime to try it, but later decided to stick to bumblebee. I removed (apt-get remove nvidia-prime). On the next reboot, lightdm failed to start: I was dropped to a blank screen with no error messages.

On investigating, I found this line in lightdm.log:

[+1.18s] DEBUG: Launching process 1486: /sbin/prime-switch
[+1.18s] CRITICAL: g_setenv: assertion 'value != NULL' failed
[+1.18s] CRITICAL: g_setenv: assertion 'value != NULL' failed
[+1.18s] WARNING: Error executing child process /sbin/prime-switch: No such file or directory

I did "apt-get remove --purge nvidia-prime", and things worked fine next reboot. Attaching complete lightdm.log.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: nvidia-prime (not installed)
ProcVersionSignature: Ubuntu 3.13.0-14.34-generic 3.13.5
Uname: Linux 3.13.0-14-generic x86_64
ApportVersion: 2.13.2-0ubuntu5
Architecture: amd64
CurrentDesktop: KDE
Date: Mon Mar 3 19:56:54 2014
InstallationDate: Installed on 2014-01-24 (38 days ago)
InstallationMedia: Kubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140121.1)
SourcePackage: nvidia-prime
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Rohan Dhruva (rohandhruva) wrote :
Revision history for this message
Andrew DeMarsh (andrewdemarsh) wrote :

you need to purge to revove the configuration files not just remove. This is incredibly important when dealing with drivers and kernels. (in short use "apt-get purge" not "apt-get remove" to deal with lower level packages)

Revision history for this message
Rohan Dhruva (rohandhruva) wrote :

I understand, and that is eventually what worked for me. Even so, IMHO there should have been a warning on remove, explicitly saying that not purging will make things go bad.

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

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

Changed in nvidia-prime (Ubuntu):
status: New → Confirmed
Revision history for this message
Margarita Manterola (marga-9) wrote :

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.

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.