Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
34
rated 0 times [  34] [ 0]  / answers: 1 / hits: 33201  / 1 Year ago, wed, march 15, 2023, 9:35:25

Sometimes installing some applications will start a process or service from the application being run automatically on installation. How do I install without starting them?


More From » apt

 Answers
5

There's a slightly hackish, but quite reliable way to do this which I've been using for a while in an automated installation script.



First create a directory, for example /root/fake, which contains symlinks to /bin/true called:



initctl
invoke-rc.d
restart
start
stop
start-stop-daemon
service
deb-systemd-helper


You could also make them bash scripts that do nothing and return success.



Then include that directory at the front of $PATH when installing packages:



PATH=/root/fake:$PATH apt-get install whatever


This only prevents daemons from starting/restarting, while things like creating an initramfs are still being done.



Explanation



The scripts which are being executed at package installation and removal execute invoke-rc.d or others of the mentioned commands to start and stop services. They don't however call them with absolute paths (at least I haven't encountered one that does).



So by inserting the faked "no operation" commands at the beginning of $PATH, the real commands never get called.



Since only the commands used to start/stop services are being faked, everything else, in particular important tasks like updating/creating initramfs-images still work.


[#42408] Friday, March 17, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eighethod

Total Points: 358
Total Questions: 112
Total Answers: 119

Location: Cayman Islands
Member since Fri, Mar 4, 2022
2 Years ago
eighethod questions
;