This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot set pypilot to IMU only
#11
I acknowledge that I don't fully understand this system, but I don't understand how cannot it be possible to reinstall some packages, reinstall missing dependencies, or something else.
The idea of starting over everytime some installation is corrupt makes the whole system if not unusable, very annoying to use  Big Grin


I've spent months in having everything working together, and I don't mind spending more time in fixing this issue, but starting over again, configure everything again... I honestly don't know if I have the strenght for it.
If the problem is purely related to the global variable PKEXEC_UID i could run

echo 'export PKEXEC_UID=$(id -u)' >> ~/.bashrc

But that is not the case. ChatGPT suggested me to modify the python script that tries to get the user like this, in order to add a fallback to default user "pi":
Code:
def __init__(self):
    self.user = os.environ.get('USER')
    if self.user == 'root':
        try:
            self.user = os.path.expanduser(os.environ["SUDO_USER"])
        except KeyError:  # SUDO_USER not set
            try:
                import pwd
                pkexec_uid = os.environ.get("PKEXEC_UID")
                if pkexec_uid is not None:
                    self.user = pwd.getpwuid(int(pkexec_uid)).pw_name
                else:
                    # Handle the case where neither SUDO_USER nor PKEXEC_UID is set
                    # Fallback to a default or use another method to determine the user
                    self.user = 'pi'  # Or any other fallback mechanism
            except KeyError:  # PKEXEC_UID not set
                # Additional fallback logic here if necessary
                self.user = 'pi'  # Fallback to a default user or handle differently
    self.home = '/home/'+self.user

Do you think that could be a valid workaround?
Reply
#12
(2024-04-03, 10:19 AM)MigGat Wrote: The idea of starting over everytime some installation is corrupt makes the whole system if not unusable, very annoying to use  Big Grin

I know that sentiment very well, but on the other hand the idea of not ever reinstalling out of principle, or out of fear, also makes one slave to one's own stubbornness ;-). There's a great liberation in doing it at least once, and even more comfort in documenting the steps to be able to do it repeatedly, at least when time is ticking and there's great sailing weather out there. Besides, you can always do it on a new SD card and leave the old one around. 

Take care, be good to yourself!
Reply
#13
I am afraid chatGPT does not provide any solution (as usual...), it just catch the error so that the program does not break and at the end proposes a default user or "handle differently" but we need to get your current user and "pi" is not an option because you may been using a custom user:

except KeyError: # PKEXEC_UID not set
# Additional fallback logic here if necessary
self.user = 'pi' # Fallback to a default user or handle differently

The problem is that PKEXEC_UID is not set in your system and I have never seen that. You will have more errors on other scripts for sure.

I have seen similar errors when you mix compiled python packages and debian python packages. I would use a new SD with a fresh install to see if the same error occurs before and after installing the extra packages you installed.
Reply
#14
(2024-04-02, 10:32 PM)MigGat Wrote:
Also, should I update all packages suggested?

Yes, always.
Reply
#15
@ironman Yes, I know, I did about 10 fresh installs in my old boat, between OP2 and OP3. And also started clean 3 times on this new boat (since october). The main problem is that being a developer, i'm not confortable with just "start over" without understanding the root of the issue, because nothing grants me it won't happen again.

@everyone I'm 99% sure that if I do a clean install, it will work perfectly fine (because pypilot has been working fine in ALL of my previous installs). What I don't understand is, if the problem is a missing PKEXEC_UID, isn't it possible to just create it? How did it disappeared or wasn't created in the first time?

I have several services that I wrote myself to monitor thr Rpi from my server (just a few pings asking if a reboot is needed, upload avnav's tracks, and stuff like that), so I don't think the cause of the issue can be there.
Reply
#16
Well, I'll assume there's no other option Sad
I thought Debian would have a "self repair" feature like windows, but I guess that's not a thing in unix based systems, so fingers crossed, lets see if I can get everything running again.

I guess at least it's safe to copy most of the contents in /home/pi/.signalK, correct? I would like to preserve at the very least the plugins configuration, if possible.
Reply
#17
(2024-04-03, 03:48 PM)MigGat Wrote: I guess at least it's safe to copy most of the contents in /home/pi/.signalK, correct? I would like to preserve at the very least the plugins configuration, if possible.

If you can still get in to signalk there's a backup/restore option in the server menu which saves settings.
Reply
#18
(2024-04-03, 03:58 PM)PaddyB Wrote:
(2024-04-03, 03:48 PM)MigGat Wrote: I guess at least it's safe to copy most of the contents in /home/pi/.signalK, correct? I would like to preserve at the very least the plugins configuration, if possible.

If you can still get in to signalk there's a backup/restore option in the server menu which saves settings.

Oh! That's cool
Reply
#19
If you really want to dig into this, I suggest compiling a list of steps to reliably reproduce the error. If that is not possible it may be data corruption. From there you can dissect the state of the system along each step and determine what has changed.
Reply
#20
So I finally followed your advise and restarted from a new image (starting version).

I set everything up (thank god this time I remembered to take a few screenshots), restored SignalK backup... and it seems some configuration file is messed up :S

Any idea where to look?

   

BTW, Pypilot worked perfectly fine before restoring signalk, but now the error is realted to not being able to connect to SignalK, which makes sense.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)