Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Peach-Oled Segmentation Fault #5

Open
mhfowler opened this issue Dec 21, 2020 · 2 comments
Open

Peach-Oled Segmentation Fault #5

mhfowler opened this issue Dec 21, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@mhfowler
Copy link
Contributor

mhfowler commented Dec 21, 2020

peach issues 12.21.20

so the wifi is working again on my re-flashed pi now,
but alas some of the microservices are not running again.
peach-oled and peach-stats both throwing segmentation faults,
although peach-network is working!

  1. peach-oled
  • running peach-oled via apt-get install:
    installs successfully, but then the service fails to start and throws an error

  • running peach-oled from binary crosscompiled on the vps:
    segmentation fault

  • running peach oled via cross-compiling binary on my laptop in debian, and then running the binary on the pi, also has errors:

if I run peach-oled without sudo, this is the output:
[2020-12-21T18:23:04Z ERROR peach_oled] Application error: Failed to create interface for I2C device: Permission denied (os error 13)

if I run peach-oled with sudo, this is the output:
thread 'jsonrpc-eventloop-1' panicked at 'attempted to leave type `std::mem::ManuallyDrop<internal::SealedBag>` uninitialized, which is invalid', /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/mem/mod.rs:658:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Segmentation fault

as a sanity check, I tried building peach-oled on the pi, and then running the pi-built version,
and got the same errors

if I run cat /etc/modules, this is the output:

# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
i2c-dev
i2c-bcm2835

if I run i2cdetect -y 1, this is the output:

00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --    

I looked in signal and saw that you said that when I run i2cdetect -y 1 I should see UU somewhere in the output, which I don't see. so maybe there is something wrong with the I2C settings.

any idea?

  1. peach-stats

running via apt-get install:

  • successfully installs, but fails to start

running binary compiled on vps:

thread 'http.worker00' panicked at 'attempted to leave type `std::mem::ManuallyDrop<internal::SealedBag>` uninitialized, which is invalid', /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/mem/mod.rs:658:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Segmentation fault

compiling on local debian laptop:

  • can't compile
    mostly this error:
error[E0277]: `?` couldn't convert the error to `jsonrpc_core::Error`
  --> src/lib.rs:60:37
   |
60 |         let uptime = stats::uptime()?;
   |                                     ^ the trait `From<error::StatError>` is not implemented for `jsonrpc_core::Error`
  1. peach-network

this is the service which originally wasn't working, and led to the whole re-flashing. now its working, so thats good news (via apt-get install or binary) :)

@mycognosist mycognosist added the bug Something isn't working label Dec 22, 2020
@mycognosist
Copy link
Collaborator

@mhfowler

Thanks for the detailed issue. Let's start from the core and work our way outward from there.

First things first, the I²C initialization. As you noticed, the presence of an alphanumeric (3c in your case) and lack of UU in the output of i2cdetect -y 1 means that an I²C device has been detected but not initialized in the kernel.

Thanks for sharing the contents of /etc/modules. That all looks good.

Can you please look at the contents of /boot/firmware/config.txt on your Pi and see if the following lines are present:

# Activate I2C
dtparam=i2c_arm=on
# Apply device tree overlay to enable pull-up resistors for buttons
device_tree_overlay=overlays/mygpio.dtbo

Please also check the output of this command groups peach-oled (shows the groups that the peach-oled user belongs to). Output should look like this:

peach-oled : peach i2c gpio-user

As a meta-thought, it might be a good idea to have setup_dev_env.py write to a simple output file on the Pi with the settings it was run with. That would allow us to quickly check if the script was run with the --i2c flag or if it was left-out etc.


Second troubleshooting inquiry: the seg fault from the VPS-compiled peach-oled binary:

I can confirm that the latest peach-oled binary on the VPS throws a segmentation fault error on my Pi.

When cross-compiled on my laptop and run with the peach-oled.service file managing the service, as is the case when installing via .deb, there are no errors and peach-oled runs as intended. So something is going wrong with the cross-compilation on the VPS and the error is not in the code / peach-oled crate itself.

I don't know why cross-compiling on the VPS is proving to be such a headache. It almost seems better to have me cross-compile on my laptop and push releases to the VPS for packaging. I'll spend some time on it today and see what I come up with.

@mhfowler
Copy link
Contributor Author

thanks for all this!

/boot/firmware/config.txt looks right on this end

peach-oled was not a member of the gpio-user group
from my look at peach-config, it doesn't look like they are added (https://github.com/peachcloud/peach-config/blob/main/scripts/setup_dev_env.py#L92)

however, after adding peach-oled to the gpio-user group, I still get the same segfault when I run peach-oled

I'm going to open an ngrok tunnel so you can poke around on the pi directly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants