FAHControl error

If you're new to FAH and need help getting started or you have very basic questions, start here.

Moderators: Site Moderators, FAHC Science Team

Post Reply
Ghost_Rider_51
Posts: 9
Joined: Wed Jan 05, 2022 8:05 pm

FAHControl error

Post by Ghost_Rider_51 »

I just installed version 7.6.21 on my Fedora 34 system, which uses python 3.9.

I have previously used FAH with python 2.7 (flatpak) then took a break and wanted to get back to it using the python 3 version.

I have no problem running the client from the cli.
However, I get this error when attempting to start FAHControl :eo

Code: Select all

$ FAHControl 
Traceback (most recent call last):
  File "/usr/bin/FAHControl", line 39, in <module>
    if sys.platform.startswith('linux'): set_proc_name('FAHControl')
  File "/usr/bin/FAHControl", line 35, in set_proc_name
    buff.value = name
TypeError: bytes expected instead of str instance
The pertinent lines from /usr/bin/FAHControl are

Code: Select all

import os
import sys
import inspect
import socket
from optparse import OptionParser
from fah import FAHControl, load_fahcontrol_db
from fah.util import *
from fah.db import *


def set_proc_name(name):
    from ctypes import cdll, byref, create_string_buffer

    libc = cdll.LoadLibrary('libc.so.6')
    buff = create_string_buffer(len(name)+1)
    buff.value = name
    libc.prctl(15, byref(buff), 0, 0, 0)


if sys.platform.startswith('linux'): set_proc_name('FAHControl')
It would appear that create_string_buffer is creating 'buff' as an array of bytes then buff.value is failing to assign the string into that array. :?:


Is this a known issue?
Is there a workaround that will allow fahcontrol to properly launch?
What suggestions can you make to assist me to launch FAH and properly control it?
Joe_H
Site Admin
Posts: 7937
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: FAHControl error

Post by Joe_H »

The FAHControl distributed from the F@h download site is dependent on Python 2.7, it does not work with Python 3. The known fixes are either downloading the legacy Python support library or downloading and installing a version that has been updated to work with Python 3. The updated versions of FAHControl have been done by others using the open source code for FAHControl.

Links to a couple have been posted here in the past, if I find one of the posts I will post it here. Or someone else may have it to hand and provide it.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
calxalot
Site Moderator
Posts: 1115
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: FAHControl error

Post by calxalot »

Ghost_Rider_51
Posts: 9
Joined: Wed Jan 05, 2022 8:05 pm

Re: FAHControl error

Post by Ghost_Rider_51 »

Strange that you disavow the FAHControl when the packages I installed as RPMs came from this page.
https://foldingathome.org/start-folding/?lng=en

I automatically assumed that packages downloaded from there were the official packages and would just work.

I had trouble earlier with trying to use the tar files and installing from them (some of the python 2.7 modules were no longer available for fedora), which is why I previously used the flatpak. Yet this version installed very neatly from the rpm so it seemed it should work with python 3.9. Nothing indicated python 2.7 was needed and no dependencies were flagged as missing.

Perhaps if FAH is still 100% dependent upon python 2.7 then the rpm should be designed with that in mind and should at least make an attempt to ensure needed modules are either already installed or pulled in as dependencies. I see nothing on that web site that says it uses python 2.7 as a mandatory requirement for install or use.
Last edited by Ghost_Rider_51 on Thu Jan 06, 2022 12:21 am, edited 1 time in total.
Ghost_Rider_51
Posts: 9
Joined: Wed Jan 05, 2022 8:05 pm

Re: FAHControl error

Post by Ghost_Rider_51 »

The most recent update on that site was 12 months ago.
calxalot
Site Moderator
Posts: 1115
Joined: Sat Dec 08, 2007 1:33 am
Location: San Francisco, CA
Contact:

Re: FAHControl error

Post by calxalot »

Reports are that it works. Lack of recent activity does not mean it is dead.
Joe_H
Site Admin
Posts: 7937
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: FAHControl error

Post by Joe_H »

Ghost_Rider_51 wrote:Strange that you disavow the FAHControl when the packages I installed as RPMs came from this page.
https://foldingathome.org/start-folding/?lng=en

I automatically assumed that packages downloaded from there were the official packages and would just work.

I had trouble earlier with trying to use the tar files and installing from them (some of the python 2.7 modules were no longer available for fedora), which is why I previously used the flatpak. Yet this version installed very neatly from the rpm so it seemed it should work with python 3.9. Nothing indicated python 2.7 was needed and no dependencies were flagged as missing.

Perhaps if FAH is still 100% dependent upon python 2.7 then the rpm should be designed with that in mind and should at least make an attempt to ensure needed modules are either already installed or pulled in as dependencies. I see nothing on that web site that says it uses python 2.7 as a mandatory requirement for install or use.
The next version of the client will be able to include such updates as needed for more recent versions of Linux. But the current version is only slightly modified from when it was coded several years ago. For example, when it came out Ubuntu 16.04 was the LTS version, and 18.04 came out later the same year.

F@h has limited developer resources to make all of these changes you are calling for. Up until a few months ago there was a single person responsible for the client and server code, and for most of 2020 he was assigned to keeping the servers going during the highest level of COVID work. A second developer was hired this past year to work on the client, taking up work started in 2019 to make the client more open source and eventually get to a rewritten release version 8.

I wrote up a lengthier post on the history of the Version 7 client here - viewtopic.php?f=108&t=36774- if you are interested.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
Ghost_Rider_51
Posts: 9
Joined: Wed Jan 05, 2022 8:05 pm

Re: FAHControl error

Post by Ghost_Rider_51 »

After digging into the info on the git site referenced I found the following info that worked. It involved a data cast to byte type when making assignment into the value.
In file /usr/bin/FAHControl I made changes to lines 39 & 56.
Original lines

Code: Select all

line 39
if sys.platform.startswith('linux'): set_proc_name('FAHControl')
line 56
        sock.send('EXIT')
Modified lines

Code: Select all

line 39
if sys.platform.startswith('linux'): set_proc_name(b'FAHControl')
line 56
        sock.send(b'EXIT')
With those minor changes the FAHControl app now works on Fedora 34 with Python 3.9.

Thank you for the pointer to the git site and I hope this change can be done in the package you provide so others do not encounter the same problems I had.
:D

I do understand that things change in the languages (python) as time passes so it may be necessary to make the rpm installer smart enough to verify the version of python installed and then install a version of FAHControl that is appropriate for that version.

Once again, thanks for the info and for all you do.
Joe_H
Site Admin
Posts: 7937
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: FAHControl error

Post by Joe_H »

Python in particular created a problem. The developers broke backwards compatibility in code with Python 3, sections of the Python 2.7 compatible code needed to be rewritten as some functions were no longer present. I understand that the utility to convert version 2 to 3 code did not work well with the code base for FAHControl.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
Ghost_Rider_51
Posts: 9
Joined: Wed Jan 05, 2022 8:05 pm

Re: FAHControl error

Post by Ghost_Rider_51 »

I agree that the tools for conversion did not work well. I was trying to get it to work and spent several days trying to get it to work, even going so far as to install python 2.7 on a system that originally had only python3 but there were some required modules in 2.7 that had been removed and were no longer available.

Converting the code from 2 to 3 had errors that I gave up on back then and I used the flatpak version for a while.
I am very pleased that this newest release will work on python 3.9 with only the very minor changes I posted above.
Post Reply