Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have setup the Raspberry Pi to run XBMC, and I want it to boot up to always play a playlist and files on the SD card. I have turned off the Raspbmc automatic update. It still runs okay when I switch the SD card to the "lock" position. Now my qeustions are:

  1. Will the "read-only" SD card system works all the time in my application?

  2. Since the SD card is always in read-only mode, if I do not use shutdown command, and just turn off the power switch, will it damage my system?

  3. Even if this works reliablely, it will always pop-up the message "Raaspbmc did not shut down properly". Is there any way to disable this message when the Pi powers up?

share|improve this question
If you want this to work reliably you will have to make sure the appropriate filesystems are also mounted as read only. – Jivings Feb 25 '13 at 8:39

I had a similar use. I'm using the Pi for narrowcasting web-pages in a building entrance. Powering the Pi via the USB-port on the TV.

Mount / read-only.

To make it powerloss proof I mounted / read-only by changing a line in /etc/fstab

/dev/mmcblk0p2  /               ext4    defaults,noatime,ro  0       1

Pretty simple. But some processes on a functional machine need to write.

Mount /tmp in memory.

Many things write to /tmp so I mounted that in memory by adding a line to /etc/fstab

tmpfs           /tmp            tmpfs   defaults,size=30M    0       0

I had a 512MB Pi available so I made /tmp 30M big.

Disable services I don't need that write.

I disabled rsyslog to stop it from logging and dphys-swapfile as it has no real place to write. Running without swap will give problems if you do heavy lifting that is memory intensive. In my case running a single midori process for a day, isn't. cat /etc/rc2.d/README on your Pi on how to do that. (raspbian starts in runlevel 2 by default, raspbmc may differ)

Let services I do need faux-write.

You can provide write access to a filesystem in memory the way a live-cd does it; with a union mount. But I didn't like the prospect of cross-compiling my own kernel for unionfs or the later aufs. Luckily unionfs-fuse is prebuilt available. It can't union mount /, but do I really need that?

Running midori I need X to work. X wants to write in /home/pi as I autologin as pi and to a couple of places in /var I decided to mount those to places using unionfs.

# move original /var and /home aside
mkdir /ro
mv /var /ro
mv /home /ro
# create mount points
mkdir /var /home

and appended 2 lines to /etc/fstab

unionfs-fuse#/tmp=rw:/ro/var=ro  /var  fuse   cow,allow_other,nonempty
unionfs-fuse#/tmp=rw:/ro/home=ro  /home  fuse   cow,allow_other

This is pretty nasty, as writes to /var, /home and /tmp all endup in /tmp. But I only need my machine to run for 8 to 10 hours, and then the power gets cutoff. So this will do.

Remounting read-write when tweaking stuff

When I changed networks, the /etc/resolv.conf that dhclient wrote didn't work anymore.

$ sudo mount / -o remount,rw
$ ifdown eth0; ifup eth0
$ sudo reboot

Don't forget to shutdown cleanly, or remounting ro after remounting rw.


If you can read German, there is a cleaner way (from archive.org). Deutsche Gründlichkeit...

share|improve this answer

SD card lock position pin is not connected at all on pcb, so your locking is virtual unless the card has internal locking mechanism. Try to write anything to SD card while it's locked and check it yourself.

share|improve this answer

SD's read-only switch is, at best, a software option. Almost every device I have will ignore it, and if avra's comment is correct, the Raspberry Pi may have no way to tell if it's on or off. So, to your questions:

  1. Yes, it will work, because it's not read-only.
  2. Yes, it will damage your system. You'll need to look at mounting root read-only, and having a small ram/tempfs file system for the things that Linux needs to keep track of.
  3. No, because there's a good chance you will have damaged the filesystem.
share|improve this answer
@avra 's answer is correct in that the physical switch that detected the position of the Write-protect slider on the standard-size SD Cards used in earlier RPis (I'm not sure of the micro size cards, mine do not seem to have such a thing) is not wired up to anything (that is the contacts on the side of the card holder) the other switch (at the bottom of the card holder) is the "card-insert" switch and that IS monitored by the RPi. – SlySven Jan 1 at 20:31
  1. I have not used XBMC, but this is not a good idea WRT to a normal operating system unless you go to some lengths to set it up for that purpose. By implication, if XBMC isn't explicitly set up so, then it is not a good idea for it either.

  2. If the card really is read only, actually it will NOT damage your system, however, if it were really read only, you are unlikely to get to the point where you could run 'shutdown'. If you did (meaning again, you are certain the entire card really is read only!), don't bother running shutdown. Just pull the plug. Since nothing on the card can change, it does not matter what you do.

  3. Sure, you could find the init files responsible and edit them (obviously, the filesystem will have to be writable to do that).

Realistically, if you do mount the root filesystem read-only (that may be harder than just using the lock toggle), you probably won't get a successful boot, because the OS does need to write to disk. HOWEVER, if you do, then feel free to do whatever you want (and can get away with). If the card is read-only it cannot be changed, so you can't do any harm.

share|improve this answer

If you just do


/dev/mmcblk0p2 / ext4 defaults,noatime,ro 0 1
/dev/mmcblk0p1 / vfat defaults,noatime,ro 0 1
you have a full read only system.


You can start Xorg with: -logfile /tmp/Xorg.log, and find other service which needs write access, redirect them to /tmp


As already mentioned, disable service you dont need with

insserv -r dphys-swapfile
insserv -r rsyslog
insserv -r samba (if installed) etc

then there should no problem at all. The good question is if there will be really no damage to SD card at all if RO only and plugin / out power all the time...

Finally, a beautiful splash screen and there you go, you have a custom cheap standalone appliance. :) And I love the Idea to power the PI over USB port from TV. But is that not limited to 500mA? Not sure, but PI needs approx 1A or not?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.