If you take away execute permissions from scripts in /etc/init.d they will not run in any runlevel. So maybe you did not quite hit the right order of things.
sudo chmod -x /etc/init.d/dphys-swapfile
sudo swapoff -a
sudo rm /var/swap
Then and after reboot free shows 0 swap.
efflandt@raspberrypi ~ $ ls /var
backups cache lib local lock log mail opt run spool tmp
Actually, the problem is with the , itself. It mysteriously becomes read-only after a month of use.
I guess one other thing that should be done to avoid an error when symbolic links in runlevels try to run dphys-swapfile when it no longer has execute permission is to remove the symlinks with:
sudo update-rc.d -f dphys-swapfile remove
Can you still flash a new image to an SD card that became read-only? If not, make sure that the little write protect switch on left side of SD is pushed away from you towards the contacts. Some people have also had that issue of flash memory becoming read only in Ubuntu PC Linux, but I never have. I did corrupt an SD card while overclock testing a Pi, but have never had any SD or other flash memory ever fail to the point that it could not be reflashed or formatted.
> make sure that the little write protect switch on left side of SD is pushed away from you towards the contacts.
I don't think this would help at all, since the RPi hardware doesn't connect up
the write-protect switch, as noted here:
One user suggests editing /etc/fstab to make the file system readonly:
Situation: Automatic Force-Restoration of Swap service
For some unknown reason, Raspbian OS permanently reloads the swap service at every reboot. Here are the steps I have to do after every reboot:
- sudo sync
- sudo swapoff -a
- sudo apt-get purge -y dphys-swapfile
- sudo rm /var/swap
- sudo sync
This stop swap, but it's back on a reboot. Writing this list into a script makes the script vanish upon a reboot with swap service activated.
Here are the other attempts I've tried and tried to kill the swap service:
- sudo update-rc.d dphys-swapfile disable
- sudo rm /etc/init.d/dphys-swapfile
- sudo dphys-swapfile disable
- sudo dphys-swapfile swapoff
- sudo dphys-swapfile uninstall
- sudo echo "CONF_SWAPSIZE=0" > /etc/dphys-swapfile
- sudo rm /etc/dphys-swapfile
- sudo chmod -x /etc/init.d/dphys-swapfile
All attempts to kill the swap service failed! Upon a reboot, a 100MB swapfile is restored and activated.