LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Raspi resets itself when rebooted, loses all modifications (https://www.linuxquestions.org/questions/linux-desktop-74/raspi-resets-itself-when-rebooted-loses-all-modifications-4175591246/)

gairsty 10-12-2016 03:50 AM

Raspi resets itself when rebooted, loses all modifications
 
When I reboot my raspberry pi (Raspbian) all files + directories that I create, modify or delete; are reset back to how they were (if they existed).

I discovered this when I wanted to remove a program from crontab. When I rebooted the pi, the program still ran, and crontab wasn't as I had last saved it. Crontab had reverted back to it's previous state.
If I create a file, ~/foo.txt, it'll be gone when I reboot the pi.
If I modify an existing file, it'll revert back once the pi reboots.

I can create, modify and run bash scripts, but they go when I reboot.

The last modification date on the files in ~/ are back in July and I can't remember what I may have done that long ago.

I don't see any unusual commands in ~/.bash_history (also reverts when the pi reboots)

The pi is running as a simple headless server.

Thanks for any help.

pan64 10-12-2016 03:52 AM

would be nice to describe what did you install exactly and how. Did you make any special configuration?

gairsty 10-12-2016 04:14 AM

Hi.
uname -a returns
Quote:

Linux NASPi1 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
cat /etc/issue.net returns
Quote:

Raspbian GNU/Linux 7
I wasn't installing anything new, just commenting out btsync from crontab so that I could remove it and install resilio.
My other pis don't exhibit this 'feature'.

I can't see anything in history that's been installed, or modified that would've caused the problem.

c0wb0y 10-12-2016 07:42 PM

Try to inspect any process and cron tabs? ps might yield some strange processes there. Can you 'touch' a few files and see what happens after rebooting?

gairsty 10-13-2016 01:58 AM

If I create a file, it will be gone after reboot.
If I modify a file, it will revert to it's previous state after reboot.
If I delete a file, it will return after reboot.

My problem is that I don't know what processes might be causing this issue.
I suspect that it's either something in the shut down process, or the boot up process, but am not well-versed in those processes.

thanks.

pan64 10-13-2016 02:02 AM

Quote:

I wasn't installing anything new
is not an answer. What did you download/install, how it was configured ..... How this system was created?

what is in /etc/fstab?

gairsty 10-13-2016 04:34 AM

/etc/fstab
Quote:

proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that


pan64 10-13-2016 06:18 AM

what I can imagine is: the card is readonly and you modified only a virtual filesystem, not the original one on the card.
But there can be other reasons. Probably you can find related info in /var/log (after boot).

gairsty 10-13-2016 09:04 AM

OK.
I double, double-checked the SD card write-protect switch, and it is definitely not write-protected.

Here's the output of ls -alt /var/log | head -n 20
Quote:

total 34116
-rw-r----- 1 root adm 7742034 Oct 13 15:01 auth.log
-rw-r----- 1 root adm 32933 Oct 13 15:00 syslog
-rw-rw-r-- 1 root utmp 292292 Oct 13 14:59 lastlog
-rw-rw-r-- 1 root utmp 92928 Oct 13 14:59 wtmp
-rw-r----- 1 root adm 29799 Oct 13 14:57 kern.log
-rw-r----- 1 root adm 28209 Oct 13 14:57 messages
-rw-r----- 1 root adm 3161 Oct 13 14:57 daemon.log
-rw-r--r-- 1 root root 9719 Jul 19 09:17 Xorg.0.log
drwxr-xr-x 10 root root 4096 Jul 19 09:17 .
-rw-r----- 1 root adm 1165 Jul 19 09:17 debug
-rw-r----- 1 root adm 17377 Jul 19 09:17 dmesg
drwxr-s--- 2 Debian-exim adm 4096 Jul 19 06:25 exim4
-rw-r----- 1 root adm 244 Jul 19 06:25 mail.err
-rw-r----- 1 root adm 244 Jul 19 06:25 mail.info
-rw-r----- 1 root adm 244 Jul 19 06:25 mail.log
-rw-r----- 1 root adm 244 Jul 19 06:25 mail.warn
-rw-r----- 1 root adm 21439 Jul 19 06:25 syslog.1
-rw-r----- 1 root adm 2366 Jul 18 06:25 syslog.2.gz
drwxr-x--- 3 root adm 12288 Jul 17 06:25 samba

I presume something from Jul 19 will be helpful?

Thanks

c0wb0y 10-13-2016 02:49 PM

Are you sure you're not writing to a tmp directory (ie /tmp, /var/tmp)? Can you post output of mount?

gairsty 10-14-2016 01:02 AM

Certainly,
Quote:

/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=242776k,nr_inodes=60694,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=49412k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=98800k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/Music type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
/dev/sdc1 on /media/Photos type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
/dev/sda1 on /media/MEDIA type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
thanks

pan64 10-14-2016 01:07 AM

I would check messages, syslog, probably kern.log and daemon.log and bootlog too (and dmesg).
Once upon a time I had a reader wich "automagically" pushed the switch on the card to readonly every time I inserted a card into it. So I probably I would try another reader to check the card itself.

gairsty 10-14-2016 03:54 AM

Ok, now we're hitting the limits of my Linux knowledge.
What am I looking for in these logs?

pan64 10-14-2016 03:56 AM

I have no idea, but error messages: lines containing the words error, failed, cannot or similar. If you are in doubt probably you can post them.

c0wb0y 10-14-2016 04:36 AM

I noticed that / is pointed at /dev/root. I'm quite curious to know if /dev/root (which must be a symlink) actually points to the intended root device.

Code:

ls -l /dev/root


All times are GMT -5. The time now is 07:48 AM.