Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosh Detached session message #3582

Closed
sn00pster opened this issue Jan 16, 2019 · 18 comments · Fixed by #4667
Closed

Mosh Detached session message #3582

sn00pster opened this issue Jan 16, 2019 · 18 comments · Fixed by #4667

Comments

@sn00pster
Copy link

sn00pster commented Jan 16, 2019

mosh-server has the ability to display a message telling you of any detached sessions that are connected to the server.

This support is based on utmp and libutempter. The current build of the mosh server does not link against libutempter, therefore the functionality is not available.

I have done some very hacky exploratory work, basically fudging into the build a Makefile for utempter which requires a lot of interaction while building to get it to use and link against utempter.

However, the message is still not displayed, so there is something else at fault here. I will try to discover what it is, but I know nothing about the correct way of getting utempter to automatically build and use a configure script, so I cannot share my work on this as it requires me to manually edit files during building and after failures in order to get the library built.

Any pointers on how I can get libutempter to download and configure/build properly would be helpful and would certainly advance figuring out what is going on.

@m4tt075
Copy link
Contributor

m4tt075 commented Jan 16, 2019

I'll be happy to help, if you are willing to do all the testing. Just PR your WIP and we'll take it from there... ;-)

@sn00pster
Copy link
Author

Let me try and figure something out, I can’t do a PR on the hacky bit as I’m fudging stuff inside the work-x64 folder as it builds.... I can do a PR on the libutempter “module” under cross and the additional dependency that mosh now has on it.

libutempter does not use a configure script, it’s just a Makefile, I used autoconf to generate a configure script and then once it started building I then replaced the generated Makefile with a modified version of the original makefile from the source package so that the libraries get written to the right place so that when mosh builds its configure script picks up that libutempter is available.....told you it was a hack! Lol

I’m an embedded software engineer by trade and my only PC coding these days is limited to Qt, so I never get involved with makefiles which is why i’ve Struggled to this point.

@m4tt075
Copy link
Contributor

m4tt075 commented Jan 16, 2019

To get you started with our build system:

  • You will need to create a cross-package for utempter in /cross/utempter. Then, you will have to add that as a dependency in the cross/mosh/Makefile , make it compile and put the libraries in the right place.
  • Start creating the cross/utempter package first
  • You can copy the Makefile from /cross/mosh for instance to get you started
  • If there is no configure script, you can override configuration by adding CONFIGURE_TARGET = nop in the Makefile and the step will be skipped. I don't think autoconf will be needed.
  • Pathes can be a bit tricky. Is there an option to define an INSTALL_PREFIX?

P.S.: I'm working in marketing these days. If I can do it, you can... :-)

@sn00pster
Copy link
Author

sn00pster commented Jan 16, 2019 via email

@m4tt075
Copy link
Contributor

m4tt075 commented Jan 16, 2019

Right. OK, you'll have to patch them out. I'd add a patch replacing usr by something like an %install_prefix% placeholder. That patch will be applied automatically during the build process. Then, you should be able to add some post_patch_target to the Makefile replacing that placeholder by the $(STAGING_INSTALL_PREFIX) variable. This is, where all the dependencies are staged and where mosh should be looking. You can refer to /cross/tvheadend for an examplatory post_patch_target implementation.

Eventually, you will also need some other stuff, i.e. PLIST and digests files. You'll find the background here: https://github.com/SynoCommunity/spksrc/wiki/Developers-HOW-TO

@sn00pster
Copy link
Author

sn00pster commented Jan 16, 2019 via email

@sn00pster
Copy link
Author

One other quick question, how do I clean say my libutempter build tree so that I can rebuild it from scratch? I don’t want to clean the whole working tree as that would obviously mean rebuilding everything, I just want to be able to clean certain bits so that I can test as I go along.

@m4tt075
Copy link
Contributor

m4tt075 commented Jan 17, 2019

If you cd into the overarching spk/working-<arch>-<fwvers> directory and run ls -latr, you'll see cookie files, like .copy.done, for all the individual build steps and recursions into cross packages, that have been completed. You can remove the cookie files of the build steps you want to repeat.

@sn00pster
Copy link
Author

sn00pster commented Jan 17, 2019

Awesome @m4tt075

Using the information you've provided here, I now have the cross/libutempter "module" fully working patches, build etc.

Should I put together a PR here for the WIP, although it's not currently working (i.e the message about detached sessions is not appearing), mosh is seeing the library during configuration and building the binary with the appropriate support - I now need to do some debugging to find out why it's not displaying.

Couldn't have done this without your excellent help!

One step closer.

By the way, I couldn't get the "clean" to work, I deleted the cookies and also the libutempter build folder, but when I did a make again it just didn't do anything and just told me nothing to be done, any further suggestions?

@m4tt075
Copy link
Contributor

m4tt075 commented Jan 17, 2019

Glad to hear it went so well and happy to help. You are advancing this project and we appreciate anybody willing to contribute!

On your question: Yes, it might not work if you cut out intermediate build steps. To make it work, usually you have to remove all the build steps and sub-directories created by a cross package. It might also be necessary to remove all subsequent build steps if there are interdependencies. You'd certainly have to remove those steps consolidating and creating the final package itself as well. I admit it can be tricky...

@dulitz
Copy link

dulitz commented Jan 21, 2019

Thanks a million y'all. Mosh with detached sessions would be completely amazing.

@sn00pster
Copy link
Author

OK, so appointments finished early today and I decided to torture myself by debugging this on my iPad over a mosh connection to my server.

I now have libutempter working. It requires a few more patches and I will try to clean up the makefile as well as there's a load of stuff in there which was commented on above that isnt actually needed.

Upshot is that mosh connections now show any detached sessions!

Will try to sort this out tomorrow when I'm back at a proper keyboard, this was hard work on a touchscreen and sftping files about!

@ymartin59
Copy link
Contributor

For information - it will have almost no impact technically - I have decided to move mosh out of "synocli-net" and create a dedicated package for it alone - because of its dependency volumes and requirement for Perl package installation.

@sn00pster
Copy link
Author

@ymartin59 good call, I think it makes sense to be a separate package anyway, it's such a great tool. Been very handy today when ssh would have kicked me out quite a number of times.

Glad to have contributed something as minor as the detached session reporting.

@iFredOS
Copy link

iFredOS commented Feb 20, 2019

How is it possible to download the separated Mosh package? I'm looking for Mosh for DSM for a few days and found this discussion.

@chickenandpork
Copy link
Member

chickenandpork commented Feb 20, 2019 via email

@sn00pster
Copy link
Author

Bear in mind this conversation, it doesn’t currently build against libutempter so it’s posdible to create a lot of detached sessions and not realise.

@iFredOS
Copy link

iFredOS commented Feb 21, 2019

Bear in mind this conversation, it doesn’t currently build against libutempter so it’s posdible to create a lot of detached sessions and not realise.

@sn00pster OK.

Sent with GitHawk

@ymartin59 ymartin59 mentioned this issue Oct 10, 2020
3 tasks
@hgy59 hgy59 mentioned this issue Jul 8, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants