How long can raspberry pi stay turned on?

for automated home, the raspberry pi will be plugged to an electrical outlet, but it won’t be shut down at all because that would shut off the automation as well, right?

so can raspberry pi stay on for years?

Yep… mine has been on for years

1 Like

Yes.

But you will need to help it. In general, reduce the amount of writing that is performed on the SD card, don’t load up your RAM, and get a good quality power supply.

If it is critical that your home automation is on 100% of the time for years on end, then don’t use a Pi.

Show us your uptime! I can only boast 65 days because I moved my Pi two months ago, but it’s been in service since January 2019 with the same SD card. I suspect this is on the young end of things…

1 Like

Only if you do not patch security vulnerabilities the OS kernel & libraries. They usually require a reboot.

If the micro SD card is full, won’t it just overwrite the logs?

It’s more about the SD card failing due to wear.

1 Like

My pi3b+ has been in use since sept 2018 with the same sd card. it gets rebooted often due to various things. The pi was a few years old before t was used for openhab. it was also running pihole for about the first 6 months or so. now i have an old pi1 running pihole and logitech media server which has been on for about 18 months.

1 Like

I installed raspbian on my raspberry pi, will it reboot by itself? or do I have to tell it to?

I had a First gen Pi running Homeseer from 2014 to a few months ago when I switched to OpenHab. I replaced it with a new Pi4 4gb. I would recommend taking image backups of your SD card every few months (on top of a normal backup strategy) I tape the backup sd card to the lid of my pi, in event something fails.

The SD card is the weak link, the pi itself will probably run for decades.

3 Likes

Assuming a UPS to maintain power.

it’s not SD card the weakest link, OS is. eg. OS which tears down SD card.
I’m running all my RPi’s on DietPI + USB root + SD boot for more than 5years now. Haven’t lost single SD card yet.

If you are serious about running long, go DietPI

1 Like

Isn’t everything you’ve described here to reduce wear on the SD card? So presumably it is the weakest link in this scenario?

Just to summarize and point out a few important things that have been brought up:

  • As long as the RPi has power and nothing else changes (i.e. minimal to no writes to the SD card) the RPi will remain turned on indifinitely.

  • The above is almost always impossible to achieve. There will be updates that may require a reboot (anytime the kernel or the firmware is updated a reboot is required, power outages occur, it’s really hard to prevent all writes to the SD card).

  • There are techniques and approaches that minimize writes to the SD card which extends it’s life. One approach is built into openHABian (Zram).

  • It’s up to you to protect the power of the RPi. Note that suddenly losing power is much more likely to corrupt your file system on the SD card (or any flash based storage media) than wearing out. I suspect a huge percentage of corrupted SD cards that are blamed on wearing out is in fact caused by suddenly losing power in the middle of a write.

  • If you want the system to remain up for very long periods of time with no down time you have to avoid changing anything after it gets running. That means no changes to configs, no upgrades to the software, etc. I don’t recommend this as there are very important reasons to keep up with latest versions of software and such. So you need to plan on having some down time during/after an update/upgrade. I recommend upgrading often to minimize the length of these down times.

  • It is possible that hardware can become damaged or broken over time but it is very rare that these SBCs wear out. There are no moving parts.

No. First of all, it won’t perform an upgrade on it’s own (unless you set it up to). When you upgrade, it will not reboot the machine it’s required until you tell it to. You can check to see if an upgrade is required by looking in cat /var/run/reboot-required.pkgs on Debian based machines (Raspbian is Debian based). If it says 'service' waiting for a reload or something like that a reboot is required to apply some updates. Only kernel and firmware updates require a reboot. And I can’t remember the last time there was a kernel update for Raspbian Buster.

You can configure this stuff to happen automatically using cron jobs. But I prefer to be there and engaged for any changes to a server that expected to run long term.

2 Likes

My Rpib3+ is now up over 400 Days.
To reduce the use of the SD Card I turn off Logging and show only errors and warnings in the Log.

SD card itself is fine for the job, it’s OS which does unnecessary read/writes to lower down engineered lifespan of the SD

All I have described is to use OS which cares about limited lifespan so you don’t have to care about faillures as it will live way longer than you then.

My raspberry works quite hard, it runs OH, motion, Apache with my own web interface to OH, and many many other smaller services 24/7. No problems at all. To prevent the SD card from degrading, SD only holds a boot partition and set to read only (in raspi-config). Root filesystem is moved to external SSD via USB 3.0 Box. Also powered through the UPS. UPS is a great thing, my desktop PC’s RAID 1 fell apart every 2 or 3 month, needed to rebuild. Until I got the UPS. Not even one RAID problem from that time. One thing you need to know about UPSes - modern models often does not hold low loads (low is something like less than 50W or so), UPS considers there is no load at all and switches off in some minutes after running on battery. You can buy older model or choose a model which can be “hacked” by removing a resistor on the board. My ippon is “modified” that way and can run raspberry pi on full load >5 hours.