Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-25 Thread Sergey Ponomarev
Thank you, Neils,

> Ubuntu has patched debhelper

Sounds weird. I thought you guys had some communication with each other.

I changed the compact to 13 and indeed the scripts were generated and
included into the resulting package.
When changed to 14 scripts remains the same, no prerm script and nothing
about starting/stopping.

But when changed to 15 then the build failed:

dh_missing: warning: root/.ssh/sshtunnel.config.sh exists in debian/tmp but
is not installed to anywhere
dh_missing: error: missing files, aborting
The following debhelper tools have reported what they installed
(with files per package)
 * dh_installdocs: sshtunnel (0)

The debuild created /debian/tmp/ folder and copied all files there.
Previously it copied files to /debian/sshtunnel


I pushed the compact 14 version to a separate branch:
https://github.com/yurt-page/sshtunnel/tree/1.3.x

I'll use the old compact level for now because I want to support old
releases.
I wish to send the ssh tunnel script to the OpenSSH client itself and am
not sure what to do: require the compact 14 or again add scripts manually.

Thank you for the quick response.


On Mon, Mar 25, 2024 at 7:25 PM Niels Thykier  wrote:

> Sergey Ponomarev:
> > Hi Niels,
> >
> > I upgraded to Ubuntu 24.04 and now have debhelper 13.14.1ubuntu1.
>
>
> Hi,
>
> In case you are using Ubuntu, you should be filing the bug against
> Ubuntu for future reference. Notably, Ubuntu has patched debhelper and
> even monkey-patch(ed?) debhelper in their official builds on top that.
> Therefore, they have to screen incoming bug reports first to ensure the
> bug is not introduced by their patches.
>
> > Once executed the debuild nothing was generated.
> > When executed the dh_installsystemduser manually also nothing was
> generated.
> >  From it's sources I found that it looks for some dependency and I added
> to
> > the /debian/control:
> >
> >  Depends: ${misc:Depends}
> >
> > Now this helped and two install/uninstall scripts were generated
> > /debian/sshtunnel.postinst.debhelper
> > /debian/sshtunnel.postrm.debhelper
> >
> > I manually included the scripts to /debian/postinst and /debian/postrm
> and
> > built the deb.
>
>
> If you had to "manually" include those snippets into the deb in a clean
> build, then I think there is something seriously wrong with the
> packaging. Normally, `dh_installdeb` would do that for you if the
> commands are run in the correct sequence.
>
> Now, you mention you ran it manually. So it is possible you did that
> manually after building the deb, in which case you would see this
> behavior. This would also fit that your `debian/rules` likes quite
> standard without any room for mistakes of this kind when I checked it.
>
>
> > It was installed successfully but didn't start the service.
> > I started manually. During uninstall it has not been stopped. There is no
> > prerm script that will do that.
> >
>
> No, this feature is first added in compat 14 apparently (which is not
> stable yet). Sadly, this is not documented in the upgrade checklist for
> reasons I do not understand. The commit that introduced the feature
> recorded it in the wrong place and the remark seems to be completely gone.
>
> I will follow up on this part.
>
> > So the issues are:
> > 1. The debhelper did not execute the dh_installsystemduser. I guess I
> must
> > add it manually to /debian/rules
>
> Either that or you could use the proper debhelper-compat level.  That is
> compat 12 or later would do. The package you linked to used compat 11 as
> I recall.
>
> Remember to check the debhelper compat upgrade checklist before you
> update the compat level.
>
> It is in `man 7 debhelper-compat-upgrade-checklist` or `man 7 debhelper`
> (depending on the debhelper version).
>
> > 2. The generated scripts do not start the service after installation.
> > 3. Missing prerm script to stop the service.
>
> As mentioned above, this is compat 14 stuff.
>
> > 4. Surprising need for for ${misc:Depends}
> >
>
> There is no such need in the Debian version of debhelper for
> dh_installsystemduser to generate the snippets. However,
> dh_installsystemduser must either install the services files *or* be run
> after they are installed at the correct location.
>My best guess is that you ran dh_installsystemduser to "early" the
> first time, then the files were in place, followed by you tweaking
> debian/control and then running dh_installsystemduser without clean
> first. That is basically the one way I can make sense of what happened.
>
> That said, you ought have that dependency anyway for other reasons (at
> least up to compat 14, where it will be applied automatically).
>
> > So far I will anyway continue to use the manual scripts because I wish to
> > support old distros.
> > Anyway I wanted to have good and proper "official" scripts to install the
> > user service.
> >
> > You can play with my simple package here:
> > http://github.com/yurt-page/sshtunnel
> >
> > It can be a good 

Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-25 Thread Niels Thykier

Sergey Ponomarev:

Hi Niels,

I upgraded to Ubuntu 24.04 and now have debhelper 13.14.1ubuntu1.



Hi,

In case you are using Ubuntu, you should be filing the bug against 
Ubuntu for future reference. Notably, Ubuntu has patched debhelper and 
even monkey-patch(ed?) debhelper in their official builds on top that.
Therefore, they have to screen incoming bug reports first to ensure the 
bug is not introduced by their patches.



Once executed the debuild nothing was generated.
When executed the dh_installsystemduser manually also nothing was generated.
 From it's sources I found that it looks for some dependency and I added to
the /debian/control:

 Depends: ${misc:Depends}

Now this helped and two install/uninstall scripts were generated
/debian/sshtunnel.postinst.debhelper
/debian/sshtunnel.postrm.debhelper

I manually included the scripts to /debian/postinst and /debian/postrm and
built the deb.



If you had to "manually" include those snippets into the deb in a clean 
build, then I think there is something seriously wrong with the 
packaging. Normally, `dh_installdeb` would do that for you if the 
commands are run in the correct sequence.


Now, you mention you ran it manually. So it is possible you did that 
manually after building the deb, in which case you would see this 
behavior. This would also fit that your `debian/rules` likes quite 
standard without any room for mistakes of this kind when I checked it.




It was installed successfully but didn't start the service.
I started manually. During uninstall it has not been stopped. There is no
prerm script that will do that.



No, this feature is first added in compat 14 apparently (which is not 
stable yet). Sadly, this is not documented in the upgrade checklist for 
reasons I do not understand. The commit that introduced the feature 
recorded it in the wrong place and the remark seems to be completely gone.


I will follow up on this part.


So the issues are:
1. The debhelper did not execute the dh_installsystemduser. I guess I must
add it manually to /debian/rules


Either that or you could use the proper debhelper-compat level.  That is 
compat 12 or later would do. The package you linked to used compat 11 as 
I recall.


Remember to check the debhelper compat upgrade checklist before you 
update the compat level.


It is in `man 7 debhelper-compat-upgrade-checklist` or `man 7 debhelper` 
(depending on the debhelper version).



2. The generated scripts do not start the service after installation.
3. Missing prerm script to stop the service.


As mentioned above, this is compat 14 stuff.


4. Surprising need for for ${misc:Depends}



There is no such need in the Debian version of debhelper for 
dh_installsystemduser to generate the snippets. However, 
dh_installsystemduser must either install the services files *or* be run 
after they are installed at the correct location.
  My best guess is that you ran dh_installsystemduser to "early" the 
first time, then the files were in place, followed by you tweaking 
debian/control and then running dh_installsystemduser without clean 
first. That is basically the one way I can make sense of what happened.


That said, you ought have that dependency anyway for other reasons (at 
least up to compat 14, where it will be applied automatically).



So far I will anyway continue to use the manual scripts because I wish to
support old distros.
Anyway I wanted to have good and proper "official" scripts to install the
user service.

You can play with my simple package here:
http://github.com/yurt-page/sshtunnel

It can be a good sample and test ground.

Best regards and thank you for your work,
Sergey

[...]


From my PoV, I will acknowledge that the compat checklist is missing 
the remark that `dh_installsystemduser` changes behavior in compat 14 by 
adding start+stop snippets for user services.


For the other parts, I am not seeing anything that I can be sure is a 
bug in debhelper vs. issues caused by ad-hoc debugging / something else. 
At least not in Debian's version of debhelper.


Best regards,
Niels

PS: I suspect your `debian/dirs` file is (mostly?) redundant, since your 
`Makefile` does the `mkdir -p` necessary.




Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-25 Thread Sergey Ponomarev
Hi Niels,

I upgraded to Ubuntu 24.04 and now have debhelper 13.14.1ubuntu1.
Once executed the debuild nothing was generated.
When executed the dh_installsystemduser manually also nothing was generated.
>From it's sources I found that it looks for some dependency and I added to
the /debian/control:

Depends: ${misc:Depends}

Now this helped and two install/uninstall scripts were generated
/debian/sshtunnel.postinst.debhelper
/debian/sshtunnel.postrm.debhelper

I manually included the scripts to /debian/postinst and /debian/postrm and
built the deb.
It was installed successfully but didn't start the service.
I started manually. During uninstall it has not been stopped. There is no
prerm script that will do that.

So the issues are:
1. The debhelper did not execute the dh_installsystemduser. I guess I must
add it manually to /debian/rules
2. The generated scripts do not start the service after installation.
3. Missing prerm script to stop the service.
4. Surprising need for for ${misc:Depends}

So far I will anyway continue to use the manual scripts because I wish to
support old distros.
Anyway I wanted to have good and proper "official" scripts to install the
user service.

You can play with my simple package here:
http://github.com/yurt-page/sshtunnel

It can be a good sample and test ground.

Best regards and thank you for your work,
Sergey


On Sat, Mar 16, 2024 at 7:50 PM Niels Thykier  wrote:

> Control: tags -1 moreinfo
>
> Niels Thykier:
> > Sergey Ponomarev:
> >> debhelper package version: 13.11.6ubuntu1
> >> Ubuntu 23.10 Mantic
> >>
> >> Is there any plan for support of user services?
> >> The user service is complicated by itself because it differs by commands
> >> from system services.
> >> That's why I also asked to make a review of mine scripts to have at
> least
> >> one right example of this.
> >>
> >>
> >> [...]
> >
> > User services are handled by `dh_installsystemduser` (not
> > `dh_installsystemd`) and that command used `/usr/lib` since the
> > beginning as far as I can tell. That command was added in 10.9.1 and
> > should be in the default sequence.
> >
> > Best regards,
> > Niels
> >
> >
>
> Hi Sergey,
>
> I hope the above solved your issues.  If so, I will close this bug as
> resolved. :)
>
> Best regards,
> Niels
>
>


Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-16 Thread Niels Thykier

Control: tags -1 moreinfo

Niels Thykier:

Sergey Ponomarev:

debhelper package version: 13.11.6ubuntu1
Ubuntu 23.10 Mantic

Is there any plan for support of user services?
The user service is complicated by itself because it differs by commands
from system services.
That's why I also asked to make a review of mine scripts to have at least
one right example of this.


[...]


User services are handled by `dh_installsystemduser` (not 
`dh_installsystemd`) and that command used `/usr/lib` since the 
beginning as far as I can tell. That command was added in 10.9.1 and 
should be in the default sequence.


Best regards,
Niels




Hi Sergey,

I hope the above solved your issues.  If so, I will close this bug as 
resolved. :)


Best regards,
Niels



Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-11 Thread Niels Thykier

Sergey Ponomarev:

debhelper package version: 13.11.6ubuntu1
Ubuntu 23.10 Mantic

Is there any plan for support of user services?
The user service is complicated by itself because it differs by commands
from system services.
That's why I also asked to make a review of mine scripts to have at least
one right example of this.


[...]


User services are handled by `dh_installsystemduser` (not 
`dh_installsystemd`) and that command used `/usr/lib` since the 
beginning as far as I can tell. That command was added in 10.9.1 and 
should be in the default sequence.


Best regards,
Niels



Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-11 Thread Niels Thykier

Sergey Ponomarev:

Package: dh-systemd

I created a systemd service to establish SSH connections.
At beginning I installed the service file
into /usr/lib/systemd/system/sshtunnel
So the dh_systemd generated post install and post remove scripts to call
sysctl daemon-reload.
I copied them, made a small cleanup and included manually:
https://github.com/yurt-page/sshtunnel/commit/1b8f5f4a495802270b894ccf7f047aadab8772ac

Then I wanted to make the tunnel starting from a user and moved the service
file into /usr/lib/systemd/user/sshtunnel

But the dh_installsystemd didn't anything about the service file and I had
to create manually the install scripts:
https://github.com/yurt-page/sshtunnel/blob/master/debian/postinst
https://github.com/yurt-page/sshtunnel/blob/master/debian/prerm
https://github.com/yurt-page/sshtunnel/blob/master/debian/postrm

So could you please review the scripts and their generation to the
dh_installsystemd?

Here is a man page for the dh_installsystemd
https://manpages.debian.org/testing/debhelper/dh_installsystemd.1.en.html



Hi,

Which version of debhelper are you using?  Support for /usr is only in 
unstable/testing. I would recommend adding a Build-Depends on `debhelper 
(>=13.11.9~) to ensure you have all the `/usr-merge` related feature 
support.  In the concrete case, 13.11.8~ might be sufficient (and 
happens to be available in stable-backports)


Best regards,
Niels



Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-11 Thread Sergey Ponomarev
debhelper package version: 13.11.6ubuntu1
Ubuntu 23.10 Mantic

Is there any plan for support of user services?
The user service is complicated by itself because it differs by commands
from system services.
That's why I also asked to make a review of mine scripts to have at least
one right example of this.


On Mon, Mar 11, 2024 at 10:48 AM Niels Thykier  wrote:

> Sergey Ponomarev:
> > Package: dh-systemd
> >
> > I created a systemd service to establish SSH connections.
> > At beginning I installed the service file
> > into /usr/lib/systemd/system/sshtunnel
> > So the dh_systemd generated post install and post remove scripts to call
> > sysctl daemon-reload.
> > I copied them, made a small cleanup and included manually:
> >
> https://github.com/yurt-page/sshtunnel/commit/1b8f5f4a495802270b894ccf7f047aadab8772ac
> >
> > Then I wanted to make the tunnel starting from a user and moved the
> service
> > file into /usr/lib/systemd/user/sshtunnel
> >
> > But the dh_installsystemd didn't anything about the service file and I
> had
> > to create manually the install scripts:
> > https://github.com/yurt-page/sshtunnel/blob/master/debian/postinst
> > https://github.com/yurt-page/sshtunnel/blob/master/debian/prerm
> > https://github.com/yurt-page/sshtunnel/blob/master/debian/postrm
> >
> > So could you please review the scripts and their generation to the
> > dh_installsystemd?
> >
> > Here is a man page for the dh_installsystemd
> >
> https://manpages.debian.org/testing/debhelper/dh_installsystemd.1.en.html
> >
>
> Hi,
>
> Which version of debhelper are you using?  Support for /usr is only in
> unstable/testing. I would recommend adding a Build-Depends on `debhelper
> (>=13.11.9~) to ensure you have all the `/usr-merge` related feature
> support.  In the concrete case, 13.11.8~ might be sufficient (and
> happens to be available in stable-backports)
>
> Best regards,
> Niels
>
>


Bug#1066025: dh_installsystemd doesn't process user services in /usr/lib/systemd/user/

2024-03-11 Thread Sergey Ponomarev
Package: dh-systemd

I created a systemd service to establish SSH connections.
At beginning I installed the service file
into /usr/lib/systemd/system/sshtunnel
So the dh_systemd generated post install and post remove scripts to call
sysctl daemon-reload.
I copied them, made a small cleanup and included manually:
https://github.com/yurt-page/sshtunnel/commit/1b8f5f4a495802270b894ccf7f047aadab8772ac

Then I wanted to make the tunnel starting from a user and moved the service
file into /usr/lib/systemd/user/sshtunnel

But the dh_installsystemd didn't anything about the service file and I had
to create manually the install scripts:
https://github.com/yurt-page/sshtunnel/blob/master/debian/postinst
https://github.com/yurt-page/sshtunnel/blob/master/debian/prerm
https://github.com/yurt-page/sshtunnel/blob/master/debian/postrm

So could you please review the scripts and their generation to the
dh_installsystemd?

Here is a man page for the dh_installsystemd
https://manpages.debian.org/testing/debhelper/dh_installsystemd.1.en.html