fcole90 / fah-snap

Snap package of Folding@Home: Client, Controller and Viewer
https://forum.snapcraft.io/t/a-snap-of-folding-at-home-against-covid19/16021
5 stars 2 forks source link

Lack of information on how to use fah as a daemon #4

Closed thaddeusc1 closed 4 years ago

thaddeusc1 commented 4 years ago

What happens?

sudo /etc/init.d/FAHClient start -v
Starting FAHClient . . . /etc/init.d/FAHClient: line 120: /usr/bin/FAHClient: No such file or directory

What should happen?

The FAHClient should start

Steps to reproduce

Attempt to start FAHClient via init.d

Additional system information

Ubuntu 19.10 (Eoan)

Notes

Inside the init.d script:

022: EXEC=/usr/bin/FAHClient
⋮
120: $EXEC $OPTS &

yet, when installed as a Snap package it looks like the binaries are installed in a sandboxed location — e.g.,

/snap/folding-at-home-fcole90/5/usr/bin/FAHClient
fcole90 commented 4 years ago

Hi, snaps work in a confined sandbox, and behave in a way which is not very intuitive if you're used to classical GNU/Linux applications. Needed resources are exposed using plugs, you can think to them like Android permissions. I'm still learning too and I should add documentation for that.

FAHClient is a daemon, which is started upon installation and later at every boot time.

You should be able to interact with it using the commands explained here: https://snapcraft.io/docs/service-management

Like I tried the following:

snap services folding-at-home-fcole90.FAHClient 
Service                            Startup  Current  Notes
folding-at-home-fcole90.FAHClient  enabled  active   -

My understanding is that snap is actually taking care of creating a needed systemd service.

Let me know if this addressed your issue :blush:

fcole90 commented 4 years ago

I updated the description in the store on how to interact with the FAHClient. https://snapcraft.io/folding-at-home-fcole90

fcole90 commented 4 years ago

Is it ok if I close this issue?

thaddeusc1 commented 4 years ago

Thanks for providing instructions to configure FAHClient as a service; Unfortunately, the instructions you provided do not resolve the issue — FAHClient still fails to launch at startup:

thedude@swift-canyon-nuc:~$ snap services folding-at-home-fcole90.FAHClient
error: snap "folding-at-home-fcole90" has no service "FAHClient"

After digging into the snapcraft documentation for service management, the following command enabled the automatic starting of FAHClient as service when the system boots: sudo snap start --enable folding-at-home-fcole90.client

So, if you update the documentation in the store, this should resolve this issue.

System information

P.S. Sorry about the long turn-around time. Haven't had much personal time to revisit this issue during March and most of April.

tl;dr

It looks like the service definition for FAHClient has the name client:

thedude@swift-canyon-nuc:~$ snap services
Service                         Startup   Current   Notes
folding-at-home-fcole90.client  disabled  inactive  -

Also, please note that it appears the default post-install behavior for this package is to disable autostart.

This goes beyond the scope of this issue, but it would be really nice if this snap autostarted at boot or user login time — similar to the official FAH Linux client.

Detailed snap information

This is the state of the snap after a fresh install:

thedude@swift-canyon-nuc:~$ snap info folding-at-home-fcole90
name:      folding-at-home-fcole90
summary:   Folding at Home - Help research with distributed computing
publisher: <Name Redacted> (fcole90)
store-url: https://snapcraft.io/folding-at-home-fcole90
contact:   https://github.com/fcole90/fah-snap/issues
license:   unset
description: |
  **I am One in a Million**: Regardless if you are already folding or haven’t
  heard a word about
  it before, we need your help to reach our goal – which is 1 million
  folders.
  **Start folding now**

  **After intalling the package you need to allow Folding@Home to check your
  hardware.** You can grant this permission with the command:

     snap connect folding-at-home-fcole90:hardware-observe

  This is a packaging of Folding@Home for the snap platform and may work
  differently from other formats. Check more information or report issues on
  https://github.com/fcole90/fah-snap

  **What is it?**
  **Folding@home (FAH or F@h)** is a distributed computing project for
  simulating protein dynamics,
  including the process of protein folding and the movements of proteins
  implicated in a variety of diseases.
  It brings together citizen scientists who volunteer to run simulations of
  protein dynamics on their personal computers.
  Insights from this data are helping scientists to better understand
  biology, and providing new opportunities
  for developing therapeutics.

  **More info**
  Folding@Home is run by Pandegroup of Stanford University. You can find more
  information on
  the Folding@Home website: https://foldingathome.org

  **Usage**
  You can use the FAHClient service, the applications FAHControl and
  FAHViewer, or the webclient at http://client.foldingathome.org/.

  You can interact with FAHClient as a service, as described in the
  documentation on snap services:
  https://snapcraft.io/docs/service-management

  **Example**

     $ snap services folding-at-home-fcole90.FAHClient
     Service                            Startup  Current  Notes
     folding-at-home-fcole90.FAHClient  enabled  active   -
commands:
  - folding-at-home-fcole90.FAHControl
  - folding-at-home-fcole90.FAHViewer
  - folding-at-home-fcole90.configure
  - folding-at-home-fcole90
services:
  folding-at-home-fcole90.client: simple, disabled, inactive
snap-id:      MmD5jWldYNMNgb2rFFht3FNKGJx1FLLV
tracking:     latest/stable
refresh-date: today <2020-04-25> at 18:11 EDT
channels:
  latest/stable:    7.5.1 2020-04-03 (35) 95MB -
  latest/candidate: 7.5.1 2020-04-03 (35) 95MB -
  latest/beta:      7.5.1 2020-04-03 (35) 95MB -
  latest/edge:      7.5.1 2020-04-02 (35) 95MB -
installed:          7.5.1            (35) 95MB -
fcole90 commented 4 years ago

Hi and thanks for reporting this. I had written the instructions at the time, then I changed the behaviour of the snap and I didn't update them, my bad. I now updated the instructions in the readme. Let me know if you find them clear enough or if I forgot something important.

thaddeusc1 commented 4 years ago

Thanks, the new instructions and documentation you posted on the store are clear and resolve the issue!

fcole90 commented 4 years ago

Thanks :blush: