WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Files unreadable for some reason.  (Read 14745 times)

Offline atomant

  • Newbie
  • *
  • Posts: 30
Files unreadable for some reason.
« 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.
|-|4\/3 4 |\|1(3 |)4\|

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11048
Re: Files unreadable for some reason.
« Reply #1 on: June 29, 2019, 12:58:53 PM »
That extension might be corrupted (likely other things too on the same SD card). Check its md5sum.
The only barriers that can stop you are the ones you create yourself.

Offline neonix

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 393
Re: Files unreadable for some reason.
« Reply #2 on: June 30, 2019, 02:51:36 AM »
What file system do you use on your SD card?
You can check it using this command
Code: [Select]
fdisk -l
It looks like glibc_base-dev.tcz is corrupted.

Offline atomant

  • Newbie
  • *
  • Posts: 30
Re: Files unreadable for some reason.
« Reply #3 on: June 30, 2019, 03:09:23 AM »
What file system do you use on your SD card?
You can check it using this command
Code: [Select]
fdisk -l
It looks like glibc_base-dev.tcz is corrupted.

Code: [Select]
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.)
|-|4\/3 4 |\|1(3 |)4\|

Offline atomant

  • Newbie
  • *
  • Posts: 30
Re: Files unreadable for some reason.
« Reply #4 on: June 30, 2019, 03:24:49 AM »
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?
|-|4\/3 4 |\|1(3 |)4\|

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: Files unreadable for some reason.
« Reply #5 on: June 30, 2019, 03:50:38 AM »
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.
« Last Edit: June 30, 2019, 03:53:14 AM by PDP-8 »
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: Files unreadable for some reason.
« Reply #6 on: June 30, 2019, 04:19:18 AM »
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.
That's a UNIX book! - cool  -- Garth

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Files unreadable for some reason.
« Reply #7 on: June 30, 2019, 07:03:19 AM »
Quote from: atomant
(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

Offline atomant

  • Newbie
  • *
  • Posts: 30
Re: Files unreadable for some reason.
« Reply #8 on: June 30, 2019, 08:36:22 AM »
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.
|-|4\/3 4 |\|1(3 |)4\|

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: Files unreadable for some reason.
« Reply #9 on: July 01, 2019, 01:48:13 AM »
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.
That's a UNIX book! - cool  -- Garth

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1252
Re: Files unreadable for some reason.
« Reply #10 on: July 01, 2019, 08:09:41 AM »
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.

Offline atomant

  • Newbie
  • *
  • Posts: 30
Re: Files unreadable for some reason.
« Reply #11 on: July 01, 2019, 01:33:23 PM »
@Paul_123: Ah, makes more sense now, thanks.
|-|4\/3 4 |\|1(3 |)4\|

Offline neonix

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 393
Re: Files unreadable for some reason.
« Reply #12 on: July 01, 2019, 02:54:02 PM »
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)

Offline atomant

  • Newbie
  • *
  • Posts: 30
Re: Files unreadable for some reason.
« Reply #13 on: July 08, 2019, 07:25:59 AM »
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.
|-|4\/3 4 |\|1(3 |)4\|

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14831
Re: Files unreadable for some reason.
« Reply #14 on: July 08, 2019, 08:40:04 AM »
Do you use "sync" and then "sudo exitcheck.sh" to shutdown piCore or just pull the power cord out?