Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Jonathan de Boyne Pollardwrote: > Sven Hartge: >> systemd happily runs "legacy" LSB init scripts >> > ... except when its one-size-fits-all approach does not work, of > course. Example: > * https://unix.stackexchange.com/questions/386846/ > This is the problem with even Mewburn rc scripts (as I can attest from > personal experience of writing replacements for an entire Mewburn rc > system) let alone with van Smoorenburg rc scripts (which are far messier > than Mewburn rc ones). One size does not fit all. One really is not > going to ever get a backwards-compatibility mechanism that copes with > all such scripts in the general case "happily". The problem here lies in most cases in the init-scripts, which where subtly broken to begin with. I myself had written such init-scripts, which worked well enough while used by SysV-init, but where technically not correct or did things in a way that worked on my system but would fail (or create a race condition) on other systems. After the switch to systemd those scripts failed on numerous ways and I cursed at first, but upon closer inspection I saw that they where broken to begin with and the faulty behavior could also happen with SysV-init. Fixing those scripts, or, where possible, converting them to native systemd.units was then the correct solution. Grüße, Sven. -- Sigmentation fault. Core dumped.
Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Sven Hartge: systemd happily runs "legacy" LSB init scripts ... except when its one-size-fits-all approach does not work, of course. Example: * https://unix.stackexchange.com/questions/386846/ This is the problem with even Mewburn rc scripts (as I can attest from personal experience of writing replacements for an entire Mewburn rc system) let alone with van Smoorenburg rc scripts (which are far messier than Mewburn rc ones). One size does not fit all. One really is not going to ever get a backwards-compatibility mechanism that copes with all such scripts in the general case "happily".
Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Tom Browder: # systemctl enable postfix # systemctl daemon-reload Minor note: enable incorporates a daemon-reload.
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Christian Seilerwrote: > Now, that doesn't mean that you should still write _new_ init scripts > for custom services if you're going to use systemd anyway. There it > will be a good idea to learn how to do that with native systemd > service units. Exactly. I was able to create much simpler and much more resilient systemd units for my local services running on servers than I was ever able to do with shell scripts. And I was also able to get rid of external supervisors (like monit) to restart said services upon errors. As an added bonus those units now work on Debian, Ubuntu and SLES12, where before that a mess of different shell scripts were needed. Grüße, Sven. -- Sigmentation fault. Core dumped.
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Am 2017-08-21 11:52, schrieb Tom Browder: On Mon, Aug 21, 2017 at 02:36 Sven Hartgewrote: Question: Why do you want to manually replace the init-script from postfix in Jessie with a systemd.unit? What do you want to accomplish by doing so (other than creating a possible broken system)? I thought I needed to be able to create service files since the init.d system is going away. Maybe in 20 years or so, but not in the foreseeable future. And especially not during the lifetime of a Debian release. There will be no point release or security update for Jessie that will drop support for init scripts. Same goes for Stretch. So even _if_ Debian should decide to drop init script support in Debian 10 (Buster) - which won't happen, not even systemd upstream has dropped init script support yet, and they're much less conservative than Debian when it comes to these things - you'd still be able to use Stretch for 5 years before support runs out. And as I said: support is not going to go away anytime soon. Now, that doesn't mean that you should still write _new_ init scripts for custom services if you're going to use systemd anyway. There it will be a good idea to learn how to do that with native systemd service units. But I don't think it's a productive use of your time to go around and start replacing all init scripts that are currently present on your system by systemd services. Those that are included with Debian are going to be taken care of by the maintainers in Debian in subsequent releases. And any old custom scripts that you still use I'd transition whenever you need to change something in them anyway. Postfix seems simple enough that its service file would also be simple. Well, other than the fact that postfix isn't simple (as you've noticed), the main issue here is that Debian 9 comes with Postfix 3, while Debian 8 comes with Postfix 2. Furthermore the Postfix packaging in Debian 9 has started to make use of advanced systemd features for their own units, so it's not just a port of a simple init script, but something rather more complicated. You had the misfortune of picking one of the worst examples here. Regards, Christian
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Tom Browderwrote: > On Mon, Aug 21, 2017 at 02:36 Sven Hartge wrote: >> Tom Browder wrote: >>> On Sun, Aug 20, 2017 at 12:30 Sven Hartge wrote: >>> So the question I have is how does it all work? There is no init.d, >>> but there seems to be some convoluted handling that I haven't >>> figured out yet. Surely some expert can write a postfix.service >>> file that drives postfix commands. >> Question: Why do you want to manually replace the init-script from >> postfix in Jessie with a systemd.unit? What do you want to accomplish >> by doing so (other than creating a possible broken system)? > I thought I needed to be able to create service files since the init.d > system is going away. Postfix seems simple enough that its service > file would also be simple. I see I am wrong and I will let sleeping > dogs lie. No, you don't need to create service files yourself. systemd happily runs "legacy" LSB init scripts and will do so for the foreseable future. And even if sometime in the far future this feature may get removed, it is the job of the package maintainers to providde services files for their packages and not you. Grüße, Sven. -- Sigmentation fault. Core dumped.
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Mon, Aug 21, 2017 at 02:36 Sven Hartgewrote: > Tom Browder wrote: > > On Sun, Aug 20, 2017 at 12:30 Sven Hartge wrote: > > > So the question I have is how does it all work? There is no init.d, > > but there seems to be some convoluted handling that I haven't figured > > out yet. Surely some expert can write a postfix.service file that > > drives postfix commands. ... > Question: Why do you want to manually replace the init-script from > postfix in Jessie with a systemd.unit? What do you want to accomplish by > doing so (other than creating a possible broken system)? I thought I needed to be able to create service files since the init.d system is going away. Postfix seems simple enough that its service file would also be simple. I see I am wrong and I will let sleeping dogs lie. Thanks, Sven. -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Tom Browderwrote: > On Sun, Aug 20, 2017 at 12:30 Sven Hartge wrote: >> That unit file does effectivly nothing. It just starts "/bin/true" and >> exits. >> >> What it *not* does is starting postfix in any way. >> >> This looks like there should be some other unit files which start the >> other daemons belonging to postfix which depend on this unit file, so >> you could easily start and stop everything with one command. >> >> Are you sure you only got this one unit file from the postfix developer? > No, I got it from a package installation of postfix on Debian 9. > So the question I have is how does it all work? There is no init.d, > but there seems to be some convoluted handling that I haven't figured > out yet. Surely some expert can write a postfix.service file that > drives postfix commands. As I suspected: postfix contains an instanced service file. The one you posted is just for convenience, to be able to start and stop all instances at the same time. The real "meat" is done via postfix@.service, which is a template. This is coupled with a generator, "postfix-instance-generator" which creates new instances on the fly, based on the output of "postmulti -l -a". I don't know if you could transplant this mechanism from postfix3 (version in Stretch) to postfix2 (version in Jessie). Question: Why do you want to manually replace the init-script from postfix in Jessie with a systemd.unit? What do you want to accomplish by doing so (other than creating a possible broken system)? Grüße, Sven. -- Sigmentation fault. Core dumped.
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 12:30 Sven Hartgewrote: > Tom Browder wrote: > > > The contents of the postfix.service file are; > ... > That unit file does effectivly nothing. It just starts "/bin/true" and > exits. > > What it *not* does is starting postfix in any way. > > This looks like there should be some other unit files which start the > other daemons belonging to postfix which depend on this unit file, so > you could easily start and stop everything with one command. > > Are you sure you only got this one unit file from the postfix developer? No, I got it from a package installation of postfix on Debian 9. So the question I have is how does it all work? There is no init.d, but there seems to be some convoluted handling that I haven't figured out yet. Surely some expert can write a postfix.service file that drives postfix commands. Any clues? Thanks. -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 12:30 Sven Hartgewrote: > Tom Browder wrote: > > > The contents of the postfix.service file are; > ... > > That unit file does effectivly nothing. It just starts "/bin/true" and > exits. > > What it *not* does is starting postfix in any way. ... > . > Are you sure you only got this one unit file from the postfix developer? I thought I did, but I'm still searching for the source. Back when I get more info. -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Tom Browderwrote: > The contents of the postfix.service file are; > [Unit] > Description=Postfix Mail Transport Agent > Conflicts=sendmail.service exim4.service > ConditionPathExists=/etc/postfix/main.cf > [Service] > Type=oneshot > RemainAfterExit=yes > ExecStart=/bin/true > ExecReload=/bin/true > [Install] > WantedBy=multi-user.target That unit file does effectivly nothing. It just starts "/bin/true" and exits. What it *not* does is starting postfix in any way. This looks like there should be some other unit files which start the other daemons belonging to postfix which depend on this unit file, so you could easily start and stop everything with one command. Are you sure you only got this one unit file from the postfix developer? Grüße, Sven. -- Sigmentation fault. Core dumped.
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 11:41 AM, Nicolas Georgewrote: > Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : >> So "disabled" is normal? > > Indeed. See: > > https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/ch-Services_and_Daemons.html#s3-services-configuration-enabling I do see, this systemctl world is new to me, but I am learning thanks to your help. Best, -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : > So "disabled" is normal? Indeed. See: https://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/ch-Services_and_Daemons.html#s3-services-configuration-enabling Regards, -- Nicolas George signature.asc Description: Digital signature
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 10:17 AM, Nicolas Georgewrote: > Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : >> > # systemctl start postfix >> > # systemctl status postfix >> > >> > and got several lines basically saying posfix.service was disabled. > >> The exact message is: >> >> * postfix.service - Postfix Mail Transport Agent >>Loaded: loaded (/etc/systemd/system/postfix.service; disabled) >>Active: active (running) since Fri 2017-08-18 04:51:33 CDT; 2 days ago >>CGroup: /system.slice/postfix.service >>|- 1505 /usr/lib/postfix/master >>|- 9515 pickup -l -t unix -u -c >>`-19868 qmgr -l -t unix -u > > Looks like Postfix is running correctly. > > Note that "systemctl start" is transient. If you want to make it start > automatically at boot, you have to use "systemctl enable". Okay, I did: # mv /etc/init.d/postfix /etc/init.d/postfix.orig # cp postfix.service /etc/systemd # systemctl enable postfix # systemctl daemon-reload # systemctl stop postfix # systemctl start postfix # systemctl status postfix * postfix.service - Postfix Mail Transport Agent Loaded: loaded (/etc/systemd/system/postfix.service; enabled) Active: active (exited) since Sun 2017-08-20 11:25:02 CDT; 1min 37s ago Process: 524 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 524 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postfix.service And all looks good! Thanks, Nicolas. Best regards, -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 10:17 Nicolas Georgewrote: > Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : > > > # systemctl start postfix > > > # systemctl status postfix > > > > > > and got several lines basically saying posfix.service was disabled. > > > The exact message is: > > > > * postfix.service - Postfix Mail Transport Agent > >Loaded: loaded (/etc/systemd/system/postfix.service; disabled) ... > Looks like Postfix is running correctly. So "disabled" is normal? Note that "systemctl start" is transient. If you want to make it start > automatically at boot, you have to use "systemctl enable". Thanks, Nicolas. Best, -Tom
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : > > # systemctl start postfix > > # systemctl status postfix > > > > and got several lines basically saying posfix.service was disabled. > The exact message is: > > * postfix.service - Postfix Mail Transport Agent >Loaded: loaded (/etc/systemd/system/postfix.service; disabled) >Active: active (running) since Fri 2017-08-18 04:51:33 CDT; 2 days ago >CGroup: /system.slice/postfix.service >|- 1505 /usr/lib/postfix/master >|- 9515 pickup -l -t unix -u -c >`-19868 qmgr -l -t unix -u Looks like Postfix is running correctly. Note that "systemctl start" is transient. If you want to make it start automatically at boot, you have to use "systemctl enable". Regards, -- Nicolas George
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
Le tridi 3 fructidor, an CCXXV, Tom Browder a écrit : > I got a postfix.service file from a postfix developer and installed it in > /etc/systemd/system as the docs mention. > > I then moved the /etc/init.d/postfix file away, reloaded the systemd > daemon, and did: > > # systemctl start postfix > # systemctl status postfix > > and got several lines basically saying posfix.service was disabled. Maybe reading these several lines in details rather than stopping at the "basic" meaning would give more information. Regards, -- Nicolas George
Re: Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
On Sun, Aug 20, 2017 at 9:42 AM, Tom Browderwrote: > I got a postfix.service file from a postfix developer and installed it in > /etc/systemd/system as the docs mention. > > I then moved the /etc/init.d/postfix file away, reloaded the systemd daemon, > and did: > > # systemctl start postfix > # systemctl status postfix > > and got several lines basically saying posfix.service was disabled. The exact message is: * postfix.service - Postfix Mail Transport Agent Loaded: loaded (/etc/systemd/system/postfix.service; disabled) Active: active (running) since Fri 2017-08-18 04:51:33 CDT; 2 days ago CGroup: /system.slice/postfix.service |- 1505 /usr/lib/postfix/master |- 9515 pickup -l -t unix -u -c `-19868 qmgr -l -t unix -u The contents of the postfix.service file are; [Unit] Description=Postfix Mail Transport Agent Conflicts=sendmail.service exim4.service ConditionPathExists=/etc/postfix/main.cf [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/true ExecReload=/bin/true [Install] WantedBy=multi-user.target Thanks. -Tom ju
Systemd: Error when replacing postfix LSB init with postfix.service on Debian 8 (jessie)
I got a postfix.service file from a postfix developer and installed it in /etc/systemd/system as the docs mention. I then moved the /etc/init.d/postfix file away, reloaded the systemd daemon, and did: # systemctl start postfix # systemctl status postfix and got several lines basically saying posfix.service was disabled. I have looked for instructions on replacing init.d scripts with systemd scripts and found the ones about writing service files, converting inin.d scripts, placing the new service files, but haven't yet found how to turn the old lsb system off for one service. Thanks for any help. With warmest regards, -Tom