my Raspberry Pi 3 (Raspbian Stretch) is behaving oddly for about 5 days now. What's happening: I create a file on my Desktop and modify another file at another location. Now I reboot the pi. Once I log in to my user account, the file on the desktop has been deleted. The changes I made to the other file are gone, and it has been put back to the state it was 5 days ago. It seems, this is happening to all files on my system, no matter where they are located. I went ahead and created a new user account by "sudo adduser ", reboot the system. The user name was not existing after reboot.
What I did to my machine 5 days ago: sudo apt-get update && sudo apt-get upgrade Also: I am running a Nextcloud server on my Pi, which is based on Apache2 and MySQL/MariaDB. I wanted to switch the character set for MySQL/MariaDB from "latin1" to "utf8" in "/etc/mysql/conf.d/mariadb.cnf". However, it did not work out the way I thought it would, so I reverted all the changes I made to this file. I also do not see, how this would be related to the problem I experience now, but maybe someone of you guys does and therefore this information might still be valuable.
As you can imagine, this tiny problem makes my webserver useless, to say the least. Something is broken in my config. Please, if anybody has a clue, what might be wrong here, feel free to post below!
Have a great day.
A dead microSD card may be possible. (@ OyaMist Aeroponics )
In the meantime, I investigated a bit further.
I plugged in the microSD card into my laptop running on another Linux distribution. My goal was to perform fsck on the file system to (hopefully) fix the problems. The SD Card is /dev/sdb:
sudo fdisk -l Disk /dev/sdb: 15 GiB, 16088301568 bytes, 31422464 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x000afe9d
Device Boot Start End Sectors Size Id Type
/dev/sdb1 8192 2289062 2280871 1,1G e W95 FAT16 (LBA)
/dev/sdb2 2289063 31422463 29133401 13,9G 5 Extended
/dev/sdb5 2293760 2359293 65534 32M 83 Linux
/dev/sdb6 2359296 2488319 129024 63M c W95 FAT32 (LBA)
/dev/sdb7 2490368 31422463 28932096 13,8G 83 Linux
However, sdb5 and sdb7 cannot be mounted. This is the popup I get for sdb7:
Unable to mount root0
Error mounting /dev/sdb7 at /media/username/root0: Command line 'mount -t >"ext4" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdb7" "/media/username/root0"' >exited with non-zero exit status 32: mount: /dev/sdb7 is write-protected, >mounting read-only mount: wrong fs type, bad option, bad superblock on /dev/sdb7, missing >codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail or so
Performing fsck -n on sdb7:
sudo fsck -fvn /dev/sdb7
fsck from util-linux 2.27.1 Warning: skipping journal recovery because doing a read-only filesystem check. Pass 1: Checking inodes, blocks, and sizes Deleted inode 523682 has zero dtime. Fix? no
Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Free blocks count wrong (1603838, counted=781309). Fix? no
Inode bitmap differences: -523630 -523682 -524992 -525029 -525074 -525099 Fix? no
Free inodes count wrong (706347, counted=679043). Fix? no
root0: ********** WARNING: Filesystem still has errors **********
Okay so it seems like the ext4 file system on sdb7 has some errors. When trying to force fsck on the sdb7 partition, I only get:
sudo fsck -fvy /dev/sdb7
fsck from util-linux 2.27.1 Disk write-protected; use the -n option to do a read-only check of the device.
How can I force fsck to repair the file system on sdb7 ?