Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: atomant on June 29, 2019, 11:18:08 AM
-
Hello good people of Tiny Core!
I have an rPi Zero W running 4.9.22-piCore, i'm trying to build a small program and i'm getting errors like this (this is just one example):
/usr/include/unistd.h:612:10: error: /usr/include/bits/confname.h: Input/output error
The file is there as a link:
tc@box:/mnt/mmcblk0p2/Controller$ ls -la /usr/include/bits/confname.h
lrwxrwxrwx 1 root root 54 Jun 29 15:03 /usr/include/bits/confname.h -> /tmp/tcloop/glibc_base-dev/usr/include/bits/confname.h
The target of the link is also there:
tc@box:/mnt/mmcblk0p2/Controller$ ls -la /tmp/tcloop/glibc_base-dev/usr/include/bits/confname.h
-rw-r--r-- 1 root root 23708 Aug 6 2016 /tmp/tcloop/glibc_base-dev/usr/include/bits/confname.h
but cannot cat it, cannot edit it, can't do anything with it, keep getting "read error", same if i try to do this as root using sudo. E.g:
tc@box:/mnt/mmcblk0p2/Controller$ sudo cat /tmp/tcloop/glibc_base-dev/usr/include/bits/confname.h
cat: read error: Input/output error
So for some reason these header files (as i said, there are a whole bunch of them) are unreadable and i have no idea what to look at, where to begin to try and fix this. Also note that this has been working before, then for some time i haven't touched on any of this but the system's been booted up many times, no idea what might have changed.
Any suggestions or pointers would be appriciated, thanks. Feel free to ask any questions, i'll try to answer them as best as i can.
-
That extension might be corrupted (likely other things too on the same SD card). Check its md5sum.
-
What file system do you use on your SD card?
You can check it using this command
fdisk -l
It looks like glibc_base-dev.tcz is corrupted.
-
What file system do you use on your SD card?
You can check it using this command
fdisk -l
It looks like glibc_base-dev.tcz is corrupted.
tc@box:~$ fdisk -l
Disk /dev/mmcblk0: 14 GB, 15552479232 bytes, 30375936 sectors
474624 cylinders, 4 heads, 16 sectors/track
Units: cylinders of 64 * 512 = 32768 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk0p1 4,0,1 37,63,32 8192 77823 69632 34.0M c Win95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary
/dev/mmcblk0p2 38,0,1 1023,63,32 77824 25468449 25390626 12.1G 83 Linux
Partition 2 does not end on cylinder boundary
/dev/mmcblk0p3 1023,254,63 1023,254,63 25468450 30375935 4907486 2396M c Win95 FAT32 (LBA)
Partition 3 does not end on cylinder boundary(Hmm...those “partition X does not end on cylinder boundary” messages don’t sound too good.)
-
That extension might be corrupted (likely other things too on the same SD card). Check its md5sum.
Is there any tool i can use to quickly and easily check the consistency of all the packages i have downloaded in my tce/optional folder?
-
Is your power supply still in good order? Are you using long thin power cabling or overloading with other devices dropping the voltage possibly causing bad writes in the first place?
Two good utilities to use if everything is in order is the Linux F3 utility, or it's windows-related cousing H2testw.
Also recommended for good health is to make sure the card was formatted properly in the first place. Unlike simple formatters in windows or linux, the people that wrote the specs - the SD Card Association - also have the ability to talk to the controllers and fix things that one ordinarily doesn't have access to.
You can find this here from the SD-Card Association. Ver 5.01 is the latest:
https://www.sdcard.org/downloads/formatter/
You may also want to read some VERY valuable tips from the Armbian group. Even though they DON'T do any Raspberry Pi, the run a wide variety of similar sbc from sd-card.
Look at the "How To Prepare an SD Card" section here:
https://docs.armbian.com/User-Guide_Getting-Started/
These tools, and good power hygiene will hopefully get you on solid ground again.
-
Additional note about the SD-Card association formatter tool:
If your Windows or Mac computer used to run this utility does not have an actual sd-card port, I have been very successful in using a high-quality USB <> SD Card dongle to reset some cranky controllers in low-voltage accidents.
Cards were non-counterfeit and batch tested with F3 before they went dumb due to low voltage.
-
(Hmm...those “partition X does not end on cylinder boundary” messages don’t sound too good.)
hi atomant,
Old versions of fdisk show these messages. No need to worry.
regards
Greg
-
Is your power supply still in good order? Are you using long thin power cabling or overloading with other devices dropping the voltage possibly causing bad writes in the first place?
It should be, there are other devices on the same power line and cables should be thick enough as far as i can tell. I’ll get out my trusty multimeter and see if i can catch any suspicious voltage drops. However, the SD card isn’t written to “normally”, the unreadable files are on the memory drive, or am i mistaken? If the SD card is the problem, shouldn’t the installing of the tcz package fail with some error in the first place when the files are read from the tcz package and put onto the memory drive?
I’ll check out the tools and resources you recommended, thank you.
-
The one unfuriating thing for me was that the voltage drop was not enough to make the system unusable - but just enough to be unreliable.
On a practical note, I only use the official sd-card formatter on new cards at least once just to be sure, and from then on, use the usual o/s specific formats for projects.
-
If the SD card is the problem, shouldn’t the installing of the tcz package fail with some error in the first place when the files are read from the tcz package and put onto the memory drive?
Folks are a bit confused as to how the normal TC works.
The Main drive is a ramdisk. When a TCZ is installed, the tcz file is loop mounted readonly filesystem, and then a symlink is placed on the ramdisk to point to each file in the loop mounted tcz. When the file is accessed, it is still read from SD card.
-
@Paul_123: Ah, makes more sense now, thanks.
-
Is there any tool i can use to quickly and easily check the consistency of all the packages i have downloaded in my tce/optional folder?
In GUI mode there is Apps > Apps > Maintenanace > Md5 Checking > Process Selected Item(s)
-
So i ended up booting TCL on a PC from a pendrive, using fsck to repair the filesytem (there were a lot of bad inodes) and then, just to be sure, re-downloaded the packages i use. This seems to have fixed it but i still wonder what can cause the filesystem to get corrupt. I checked voltage levels and it seems stable enough (moves around 5.005-5.007V so about). As far as i know -of course this is where i might be wrong- the SD card isn't written to during operation, i chose TinyCore exactly for this reason.
-
Do you use "sync" and then "sudo exitcheck.sh" to shutdown piCore or just pull the power cord out?
-
I have this kind of problems all the time, with my memory cards and pendrives. Why? Because crappy Chinese memory card readers, bad quality USB cables and the most important, it's not recommended to use journaling with flash technology. That's why I run my TC in LiveCD mode. If I want to archive somethings I'll copy it to pendrive.
There are some solutions, you can use NAS as a hard disk or force TC to do file system check from time to time. Other solution is to create 2 partitions, remaster TC that all data will be loaded from partition 1 by bootloader and after loading, don't use 1st partition. In this way partition 1 always by use as read-only and there is no risk because it won't be mounted and there will be not chance to corruption.
I destroyed my Debian/Ubuntu installation many times (no jurnaling). I use TC on memory card since 2009 and it corrupt many times. But since I load remastered version from the bootloader, I don't have any problems.
-
I just pull the plug, so to say. As far as i know corruption of the SD card should only occur if it is being written to when the power is removed. To my knowledge, this isn't happening (but of course i could be wrong). I'm using this system to play music from the internet, it is running YouTubeDL (python script), omxplayer and some self-written software to control what's happening. True, i'm not completely sure if either python or the player won't start writing files to the SD card but i don't see any sign of this (i see no remnant files lying around). My guess is that if any of these has the need to write some temporary files, it would do so to /tmp which is on the memory drive. Of course, this is a big guess again.
-
Not all SD cards are created equal, some are of really dubious quality. So try a high quality branded SD card
-
Not all SD cards are created equal, some are of really dubious quality. So try a high quality branded SD card
On paper it's a SanDisk...do you have any recommendations perhaps?
-
I would recommend a SanDisk without hesitation, but are sure it's an original?
Could be defective in any case
-
I would recommend a SanDisk without hesitation, but are sure it's an original?
No idea how i could be sure of that...didn't get it from some shady looking memory card dealer in a long raincoat. :D As far as i can remember i bought it in a computer store, where they got it from i can't know...
-
Could there be a voltage spike when you pull power?
Internal, delayed block ordering could result from a write (so the SD card could be writing several seconds after Linux says the write is done), but you say there were no writes.
-
SanDisk is the best brand. File system corruption occurs even on HDD (when you don't use journaling). You can use journaling on your flash device (with the risk it degenerate faster) or you can configure your system in way that everything will be in RAM and all devices will be unmounted.
-
piCorePlayer based on piCore has hundreds, maybe thousands of installations. I prepared a "copy2fs" solution waiting for corruptions of SD cards. It never happened. We might be lucky that our application does little writing to the SD card.
When you use "copy2fs" you can set it up to dismount all disks. I actually removed the SD card.
I've been using piCore based RPi's for over 5 years and I can't remember having a random SD card corruption! Lucky?
I use mainly SanDisk.
-
Roberts designed TC to be nice to flash from the outset, so if you are getting corruption, there is a local problem.
The major issue (aside from counterfeits) is write-amplification. That is, many small files being written all the time. Wear leveling helps. To help wear-leveling perform the best, use 4MB partition boundaries.
Even with TC, use a big card to have redundant cells. My recommendation is to go no smaller than 32gb, even if you are only using a small fraction of that with the o/s and your files.
And if overall speed is not a concern, there are so-called "high endurance" cards available designed for long term writing (think dashcams, body-cams, surveillance cams), which tradeoff a bit of speed for more endurance.
One such is the Samsung "Pro Endurance". Markets itself as "High Endurance for Video Monitoring".
Use of ext-2: these days the wear-leveling techniques are good enough that you *can* use journaling filesystems without worrying too much. Especially with an o/s like TinyCore.
But yeah, if one is using a 2gb card from 1998, then maybe ext2 is a good idea. Thing is, this "advice" from the past can live well beyond its expiration date if one stays up with technology. And it provides good fodder for click-bait sales of old stock, that marketers are well aware of.
-
Want peace-of-mind? Test with the F3 util:
Computer stores and online sales that seem reputable may be vulnerable to man-in-the-middle counterfeit substitutions.
Check yours - perhaps a single one if purchasing in a batch:
https://fight-flash-fraud.readthedocs.io/en/stable/
Here's are some examples. Many on web video as well:
https://fight-flash-fraud.readthedocs.io/en/stable/introduction.html#examples
You can get it for compiling right here: Note that most linux users will want to read the entirety of the above docs if they want the "extra applications" to work.
https://github.com/AltraMayor/f3/releases
Looks like F3 would make a *great* candidate for a F3.tcz package!
-
Could there be a voltage spike when you pull power?
Internal, delayed block ordering could result from a write (so the SD card could be writing several seconds after Linux says the write is done), but you say there were no writes.
Not that i can see but of course it's not impossible, can't see what happens inside the rPi's hardware. I see no spike on the power line with the multimeter.
To the others, card is 16Gb and i'm using Ext4 on the partition that's experiencing the problems. Theoretically, in normal operation, no writes to the card should ever occur, but as said before, i do not know this for sure.
-
Hi atomant
... I see no spike on the power line with the multimeter. ...
If it's a digital multimeter, you probably won't see a spike, its response is too slow. If it's an analog meter, you might be able to
spot something if it's blatant enough.
Try to isolate the problem. Start with Juanitos advice
Do you use "sync" and then "sudo exitcheck.sh" to shutdown piCore or just pull the power cord out?
If the corruption continues, make sure cables are as short as possible. Try another power supply.
Doesn't the Pi have a power status LED that lights when the power rail is questionable?
If the corruption stops, then it doesn't like you just cutting the power.
-
I hope it's not the power-cut because creating a "proper shutdown" is a pain in the ass...
-
FYI: I used iotop to see if any writes occur during operation, apparently not.
-
Is the drive still mounted when you pull the plug?
If one is going to hot-plug like this, instead of an orderly shutdown, does the application running in ram at least unmount the card after loading in preparation for an end-user to just pull the plug later on?
-
When you use "copy2fs" you can set it up to dismount all disks. I actually removed the SD card.
Ah, I stand corrected. Since pulling the plug is touted as an advantage on your website, I'd suggest not leaving this up to the user to set up the dismounts and do it by default. Just good engineering practice.
Nice site btw. Very modern and clean. Looking forward to the support forum.
-
piCorePlayer based on piCore has hundreds, maybe thousands of installations. I prepared a "copy2fs" solution waiting for corruptions of SD cards. It never happened. We might be lucky that our application does little writing to the SD card.
We try not to use this forum for piCorePlayer support as it is frowned upon. :(
We use the "Slim Devices Community Forums" hosted by Logitech: https://forums.slimdevices.com/
Steen (aka SBP) does all the website stuff.