plex failed upgrade fix

I have a media center PC running mythbuntu with plexmediaserver. This is only because it was originally mythbuntu, but I have since come to prefer plex and I'm too lazy to reinstall it as straight ubuntu. Recently I tried to upgrade it, but ran into a problem:

Preparing to replace plexmediaserver 0.9.9.7.429-f80a8d6-debian (using .../plexmediaserver_0.9.9.10.458-008ea34-debian_amd64.deb) ...
Killing Plex Media Server: done
update-rc.d: /etc/init.d/plexmediaserver exists during rc.d purge (use -f to force)
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Killing Plex Media Server: done
update-rc.d: /etc/init.d/plexmediaserver exists during rc.d purge (use -f to force)
dpkg: error processing /var/cache/apt/archives/plexmediaserver_0.9.9.10.458-008ea34-debian_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/plexmediaserver_0.9.9.10.458-008ea34-debian_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Notice the first line of the barf:

update-rc.d: /etc/init.d/plexmediaserver exists during rc.d purge

I don't know what's wrong with their package that causes this error during upgrade, but to fix this, we need to remove the init script:

update-rc.d -f plexmediaserver remove
mv /etc/init.d/plexmediaserver /root/plexmediaserver.init

Now we can do the upgrade:

apt-get upgrade plexmediaserver

And finally, some housekeeping. Obviously you could simply remove the file above, but we chose to illustrate a more conservative approach. Assuming your upgrade is now successful, run:

rm /root/plexmediaserver.init