Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
9
rated 0 times [  9] [ 0]  / answers: 1 / hits: 3225  / 2 Years ago, fri, august 19, 2022, 9:07:52

I currently have the uwsgi Install uwsgi package installed. I would like to remove the package but leave the current uWSGI instances running. Is this possible?



(Yes, I do realize the service will only continue running until it is stopped or the server restarts.)


More From » uninstall

 Answers
2

The prerm of uwsgi script contains this:


#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/uwsgi" ] || [ -e "/etc/init/uwsgi.conf" ]; then
invoke-rc.d uwsgi stop || exit $?
fi
# End automatically added section


You have a few options:


Edit the prerm script.


The script is usually located at /var/lib/dpkg/uwsgi.prerm.
Do:


sudo sed -i '/invoke-rc.d/ s/^/#/' /var/lib/dpkg/uwsgi.prerm

to comment out the command that stops the service.


Use the conditions in the script to your advantage


Either:


sudo chmod -x /etc/init.d/uwsgi

since the script checks for execute permissions of this script,


Or:


mv /etc/init/uwsgi.conf /etc/init/uwsgi.conf.bak

since the script checks for existence of this Upstart service file.


According to the list of files, the package has /etc/init.d/uwsgi and not the Upstart script.


(Mis)Use policy-rc.d


invoke-rc.d is controlled by policy-rc.d. However, using it directly has a problem. The prerm script is has exit $?, and dpkg doesn't like non-zero exit codes. Hence, this will still require changing the prerm script:


echo 'exit 101' > /usr/sbin/invoke-rc.d
chmod +x /usr/sbin/invoke-rc.d
sed 's/exit/echo/' -i /var/lib/dpkg/uwsgi.prerm

Why did I even answer?


There are some brilliant answers already available: Install packages without starting background processes and services (possibly with some slight adaptation required).


[#23841] Saturday, August 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
oatglori

Total Points: 313
Total Questions: 102
Total Answers: 111

Location: Guam
Member since Thu, May 18, 2023
1 Year ago
oatglori questions
;