postinst maintainer script stops systemd unit file from starting automatically on install

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm creating a small Debian package to install systemd unit files, specifically *.service files.
My package looks like:
myservice
|
|--debian
|- comapat
|- preinst
|- postinst
|- rules
|- myservice.service
When I install my package, the systemd services are automatically disabled and they do not start up.
Right after install, systemctl status myservice shows
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - My Service - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; disabled; vendor preset: enabled)
Active: inactive (dead)
However, when I install my package without a postinst script, the systemd services are automatically enabled and they do start up after install.
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - MyService - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-02-09 15:06:36 UTC; 10s ago
Main PID: 5024 (sh)
Tasks: 2
Memory: 172.0K
CPU: 1ms
CGroup: /system.slice/myservice.service
âÂÂâÂÂ5024 /bin/sh -c echo 'myservice.service started' && echo $(date +%s) && sleep infinity
âÂÂâÂÂ5026 sleep infinity
I'm confused because my postinst is "small and dumb":
#!/bin/sh -e
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
Why does the presence of a postinst overwrite the "automatic enabling and starting" of a systemd service?
What part of debhelper deals with this and what am I missing?
Or what should I add to my postinst maintainer script to get my services up and running on install?
NOTES: My environment is a small vagrant box with a virtualbox provider. I am using the ubuntu-xenial64 Vagrant box. Not sure if this environment affects this.
debian ubuntu systemd
add a comment |Â
up vote
1
down vote
favorite
I'm creating a small Debian package to install systemd unit files, specifically *.service files.
My package looks like:
myservice
|
|--debian
|- comapat
|- preinst
|- postinst
|- rules
|- myservice.service
When I install my package, the systemd services are automatically disabled and they do not start up.
Right after install, systemctl status myservice shows
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - My Service - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; disabled; vendor preset: enabled)
Active: inactive (dead)
However, when I install my package without a postinst script, the systemd services are automatically enabled and they do start up after install.
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - MyService - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-02-09 15:06:36 UTC; 10s ago
Main PID: 5024 (sh)
Tasks: 2
Memory: 172.0K
CPU: 1ms
CGroup: /system.slice/myservice.service
âÂÂâÂÂ5024 /bin/sh -c echo 'myservice.service started' && echo $(date +%s) && sleep infinity
âÂÂâÂÂ5026 sleep infinity
I'm confused because my postinst is "small and dumb":
#!/bin/sh -e
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
Why does the presence of a postinst overwrite the "automatic enabling and starting" of a systemd service?
What part of debhelper deals with this and what am I missing?
Or what should I add to my postinst maintainer script to get my services up and running on install?
NOTES: My environment is a small vagrant box with a virtualbox provider. I am using the ubuntu-xenial64 Vagrant box. Not sure if this environment affects this.
debian ubuntu systemd
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm creating a small Debian package to install systemd unit files, specifically *.service files.
My package looks like:
myservice
|
|--debian
|- comapat
|- preinst
|- postinst
|- rules
|- myservice.service
When I install my package, the systemd services are automatically disabled and they do not start up.
Right after install, systemctl status myservice shows
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - My Service - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; disabled; vendor preset: enabled)
Active: inactive (dead)
However, when I install my package without a postinst script, the systemd services are automatically enabled and they do start up after install.
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - MyService - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-02-09 15:06:36 UTC; 10s ago
Main PID: 5024 (sh)
Tasks: 2
Memory: 172.0K
CPU: 1ms
CGroup: /system.slice/myservice.service
âÂÂâÂÂ5024 /bin/sh -c echo 'myservice.service started' && echo $(date +%s) && sleep infinity
âÂÂâÂÂ5026 sleep infinity
I'm confused because my postinst is "small and dumb":
#!/bin/sh -e
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
Why does the presence of a postinst overwrite the "automatic enabling and starting" of a systemd service?
What part of debhelper deals with this and what am I missing?
Or what should I add to my postinst maintainer script to get my services up and running on install?
NOTES: My environment is a small vagrant box with a virtualbox provider. I am using the ubuntu-xenial64 Vagrant box. Not sure if this environment affects this.
debian ubuntu systemd
I'm creating a small Debian package to install systemd unit files, specifically *.service files.
My package looks like:
myservice
|
|--debian
|- comapat
|- preinst
|- postinst
|- rules
|- myservice.service
When I install my package, the systemd services are automatically disabled and they do not start up.
Right after install, systemctl status myservice shows
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - My Service - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; disabled; vendor preset: enabled)
Active: inactive (dead)
However, when I install my package without a postinst script, the systemd services are automatically enabled and they do start up after install.
root@ubuntu-xenial:~# systemctl status myservice
â myservice.service - MyService - echos output and says when it started
Loaded: loaded (/lib/systemd/system/myservice.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-02-09 15:06:36 UTC; 10s ago
Main PID: 5024 (sh)
Tasks: 2
Memory: 172.0K
CPU: 1ms
CGroup: /system.slice/myservice.service
âÂÂâÂÂ5024 /bin/sh -c echo 'myservice.service started' && echo $(date +%s) && sleep infinity
âÂÂâÂÂ5026 sleep infinity
I'm confused because my postinst is "small and dumb":
#!/bin/sh -e
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
Why does the presence of a postinst overwrite the "automatic enabling and starting" of a systemd service?
What part of debhelper deals with this and what am I missing?
Or what should I add to my postinst maintainer script to get my services up and running on install?
NOTES: My environment is a small vagrant box with a virtualbox provider. I am using the ubuntu-xenial64 Vagrant box. Not sure if this environment affects this.
debian ubuntu systemd
asked Feb 9 at 15:41
Wimateeka
1299
1299
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
You need to add the debhelper placeholder to your postinst:
#DEBHELPER#
So your postinst should look like
#!/bin/sh
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
#DEBHELPER#
exit 0
If you donâÂÂt include that, debhelper wonâÂÂt add its auto-generated postinst snippets to your maintainer script. When you donâÂÂt have a postinst at all, it just generates the entire script; but if you have your own version, it only changes the placeholder.
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
You need to add the debhelper placeholder to your postinst:
#DEBHELPER#
So your postinst should look like
#!/bin/sh
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
#DEBHELPER#
exit 0
If you donâÂÂt include that, debhelper wonâÂÂt add its auto-generated postinst snippets to your maintainer script. When you donâÂÂt have a postinst at all, it just generates the entire script; but if you have your own version, it only changes the placeholder.
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
add a comment |Â
up vote
4
down vote
accepted
You need to add the debhelper placeholder to your postinst:
#DEBHELPER#
So your postinst should look like
#!/bin/sh
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
#DEBHELPER#
exit 0
If you donâÂÂt include that, debhelper wonâÂÂt add its auto-generated postinst snippets to your maintainer script. When you donâÂÂt have a postinst at all, it just generates the entire script; but if you have your own version, it only changes the placeholder.
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
You need to add the debhelper placeholder to your postinst:
#DEBHELPER#
So your postinst should look like
#!/bin/sh
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
#DEBHELPER#
exit 0
If you donâÂÂt include that, debhelper wonâÂÂt add its auto-generated postinst snippets to your maintainer script. When you donâÂÂt have a postinst at all, it just generates the entire script; but if you have your own version, it only changes the placeholder.
You need to add the debhelper placeholder to your postinst:
#DEBHELPER#
So your postinst should look like
#!/bin/sh
# POSTINST script for intera
set -e
echo "33[36m HI I'M A POSTINST SCRIPT `date +"%s"` 33[39m"
#DEBHELPER#
exit 0
If you donâÂÂt include that, debhelper wonâÂÂt add its auto-generated postinst snippets to your maintainer script. When you donâÂÂt have a postinst at all, it just generates the entire script; but if you have your own version, it only changes the placeholder.
answered Feb 9 at 15:59
Stephen Kitt
142k22308369
142k22308369
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
add a comment |Â
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
Thanks! This solved my issue. It looks like I was "gotten" by the devil in the details of debhelper.
â Wimateeka
Feb 9 at 16:09
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f423069%2fpostinst-maintainer-script-stops-systemd-unit-file-from-starting-automatically-o%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password