RaspberryPi上出現的萬惡錯誤_"Segmentation fault"

最近在樹梅派做嵌入式應用的小project的時候
遇到這個很討厭的錯誤資訊

想說試試看有沒有有解決方案
若解決不了就換別的備案 , 反正看了許多英文經驗交流還可學(複習)些單字
沒有壞處!!! 還順便接觸複習 Linux 指令




根據國外工程們的經驗分享和交流中
有人說是   "filesystem corruption" 的問題
可能是沒正確關機
下載到有病毒的檔案
周邊裝置沒安置好
等等諸多問題


第一個參考link 工程師A的問答經驗交流
https://raspberrypi.stackexchange.com/questions/5404/segmentation-fault


Segmentation faults should not be happening like that, and it strongly implies to me you have filesystem corruption.

It could also be the result of something malicious(惡毒的;有毒的), but that is probably less likely on the pi since it is prone to(傾向於....) such corruption if, eg, it is subject to inappropriate voltages(電壓 ; 伏特), or frequently unplugged(未使用(安插好)電子擴音裝置之樂器的)
without a proper shutdown.


Take the SD card out, salvage whatever you want/can off it using another computer, then umount it there but leave it plugged in and try:


希望應該不是有毒的問題
= =|||


下方後續又有國外高手工程師則認為是檔案空間不足夠
建議菜鳥工程師可以試試看
df 查看 並刪除快取資料


Can you confirm that you have enough space on the SD card, I think I saw this when I forgot to expand my rootfs after install. It fills up pretty quick after initial configuration and loading of packages. Do a df -k and make sure you are not at 100% on rootfs.


首先使用

df 指令

可以幫助我們去
查看檔案系統上的可用空間
透過  df  指令 將系統內所有的 filesystem  詳列並顯示所佔空間百分比



然後清空一些快取
sudo rm -rf /var/cache/apt/*.bin



這裡上方所顯示之資訊細項



Used : 用掉多少磁碟空間
Available:剩餘的磁碟空間大小
Use%:磁碟使用率,若使用率高達 90% 左右, 就要注意空間的清潔,避免系統出錯
Mounted on:磁碟掛載的目錄所在地(掛載點啦!)

目前看來  最多使用率的
/dev/root 為64% 還可接受
問題應該不是這個!!!!


若覺得 df 預設顯示格式不怎麼好判讀

可試試後頭再多加  -h
df -h
會以一般人叫好閱讀的容量顯示模式做呈現



選項與參數(節錄自  鳥哥):
-a  :列出所有的檔案系統,包括系統特有的 /proc 等檔案系統;
-k  :以 KBytes 的容量顯示各檔案系統;
-m  :以 MBytes 的容量顯示各檔案系統;
-h  :以人們較易閱讀的 GBytes, MBytes, KBytes 等格式自行顯示;
-H  :以 M=1000K 取代 M=1024K 的進位方式;
-T  :連同該 partition 的 filesystem 名稱 (例如 xfs) 也列出;
-i  :不用磁碟容量,而以 inode 的數量來顯示


第二篇參考文章
https://www.element14.com/community/thread/54581/l/segmentation-fault-for-every-command-lines?displayFullThread=true

工程B也遇到相同問題

I have purchased a raspberry pi 3 2 weeks ago.
I have purchased official SD card and power supply

I have used it for development purpose with a raspbian.

After a small week of usage, it started to stop execution
of some usual process: most failure are happening when
compiling. Once an "unusual" failure is first met, the raspberry
becomes unusable. Any command line started in an open
shell will either enter a dead lock, or fail with a segmentation
fault. Existing process seems to be still running. No new process
can run with success.

I have restarted from scratch, with a new SD card and after
afew days, end up with the same results.

I would like to identify the reasons

ie: board?
power supply?
sd card?
raspbian issue?
rpi kernel issue?

Any advise?
Tks


他說自從他三周前購買了樹梅派後
做了些利用也時常出現 死結、區段錯誤的問題
也試過用新的SD Card 重新安置 但過數日後也遭遇相同問題 = =|||

下方的工程師C就回應它說
這可能是Power supply 的問題

I think it is difficult to come to any firm conclusion.
You could try a different Pi, or an SD card from a completely different supplier. It could be
the power supply (it was unclear which power supply you're using, is it the 2.5A official one?).
It could be that you're powering off-and-on the Pi without using a shutdown command
(or you could be suffering power failures inadvertently and didn't realize it, and getting
file system errors). You could try inspecting dmesg output, or syslog.
Or there could be a real issue on your particular Pi like bad memory, better to always have
a couple of boards and supplies so you can compare and contrast.


總之沒捨麼結論  = =|||



第三篇遇到同樣問題的工程師C

Edox created the topic: Raspberry Pi 2 Program "Segmentation fault"
http://www.pilotlogic.com/sitejoom/index.php/forum/rapberrypi/3346-raspberry-pi-2-program-segmentation-fault

Im trying to build a program for my Raspberry Pi 2, all is OK except when a try to run the program in the Raspberry, i get "segment faul" message.
- Linux Mint 17.2 installed in VirtualBox version 4.3.18r96516
- Codetyphon 5.50 installed in Linux MInt 17.2 cinnamon 32 bits.

Can you help me please?

Thanks in advance!

他說他嘗試去編譯一個於第二代Pi板的程式
但是當他要運行的時候就會顯示如下錯誤令他頭疼
segment faul

看來是跟我一樣的窘境


下方有一位工程師 Sternas Stefanos 的傢伙則回應他

Sir
did you give executable permissions to your project ?
did you install GTK2 libraries to your Pi Box ?

一方面他懷疑是權限不足造成
還有缺少 GTK2套件

後續   工程師C  嘗試了如下兩條指令並回應依然無效

sudo apt-get update
sudo apt-get install libgtk2.0-dev.




第四篇工程師D
https://www.raspberrypi.org/forums/viewtopic.php?f=94&t=69914
在論壇問了相同問題


下方開發人員則跟他建議
嘗試看看升級系統、更新系統 響個指令
然後重啟

sudo apt-get update && sudo apt-get upgrade


依然無效 = =|||


還真是能遇到的問題都遇到了呢 !!!!


[ref link:]
Raspberry Pi 2 Program "Segmentation fault"

http://www.pilotlogic.com/sitejoom/index.php/forum/rapberrypi/3346-raspberry-pi-2-program-segmentation-fault


segmentation fault for every command lines

https://www.element14.com/community/thread/54581/l/segmentation-fault-for-every-command-lines?displayFullThread=true


`Segmentation fault` on every sudo action

https://raspberrypi.stackexchange.com/questions/46037/segmentation-fault-on-every-sudo-action


Segmentation fault
https://raspberrypi.stackexchange.com/questions/5404/segmentation-fault#comment9694_5404



Need help with "Segmentation fault"
https://www.raspberrypi.org/forums/viewtopic.php?f=94&t=69914









留言

這個網誌中的熱門文章

何謂淨重(Net Weight)、皮重(Tare Weight)與毛重(Gross Weight)

Architecture(架構) 和 Framework(框架) 有何不同?_軟體設計前的事前規劃的藍圖概念

(2021年度)駕訓學科筆試準備題庫歸納分析_法規是非題