14

Actually I had a linux system ( running Ubuntu 12.04.3 ) for days without reboot. I ran in to some errors like sleep getting hang and some network mounted file system not getting mount even able to ping it (verified via other PC, the network mount was working fine).

Wanted to check if Linux also requires to reboot the machine after some time frame to avoid these types of weired errors which are non repeatable.

What is the maximum time we can maintain the PC up? Are there some other problems that could occur if we have a system up for year or more without reboot?

pRAShANT
  • 299

10 Answers10

39

Working as a system administrator, I see Linux servers up for over 700-800 days without reboot, so there are no uptime limitations; the errors you got are not related to Linux (the kernel) itself.

A lot of services can be restarted and most errors can be solved on production systems.

Léo Lam
  • 1,012
  • 3
  • 12
  • 27
user3417815
  • 737
  • 6
  • 15
16

There is no technical need to restart your computer after a certain time period. I've had mine running for months (incl. kernel module updates) with some suspensions (to RAM and disk) in between.

There are occasions where

  • it's absolutely necessary to reboot, like kernel updates (but those aren't urgent in many situations, and in some cases you can replace a running kernel with a new one on a live system. See kexec and Ksplice)
  • it may be easier to restart the whole system instead of just a particular (set of) subsystem(s).

There may be some issues that “become worse” over time (e. g. hardware driver issues, leaky processes), but those are considered bugs and can often be fixed with a software upgrade or worked around by a reload/restart of that particular subsystem (also see above).

David Foerster
  • 36,890
  • 56
  • 97
  • 151
10

I don't know whether this has an impact over system's stability, but the maximum uptime shown in Ubuntu with kernel 3.19-xx is 68,0962597349822 years on a 32-bit machine and 292471208677,8627 years on a 64-bit machine.

That's because the system's current uptime, which is returned by the sysinfo() syscall, is returned as a __kernel_long_t type, which is a declared as a long in a 32-bit kernel and as a long long in a 64-bit kernel;

A long on a 32-bit machine has a maximum value of 2147483647;

A long long on a 64-bit machine has a maximum value of 9223372036854775807;

Doing the math, 2147483647s = 68,0962597349822 years and 9223372036854775807s = 292471208677,8627 years.

Once this value increases exceeding its type's capability, an arithmetic overflow takes place and it's set to the smallest value allowed by its type (in both cases a negative number): this might be an issue for programs relying on it.

kos
  • 41,268
7

While I'm certain that there are servers with a higher uptime, I present the following from one of mine as an example of what is possible:

# uptime
04:58:44 up 2186 days, 23:15,  1 user,  load average: 0.02, 0.02, 0.00

This server was installed shortly after the DC it's in went live and hasn't been turned off since. Thus far it has continued happily doing what it was originally intended for and when that purpose gets moved to a different server I'll put something on there just to monitor the uptime and it will probably stay up until I can't justify keeping it alive any longer.

Thus I think "There is no maximum" is quite definitely the correct answer.

Kaithar
  • 171
6

I was in a class once with a sysadmin who claimed he had a linux server which was running with no reboots for over a decade. There is no inherent reason a system needs to be rebooted regularly. It is only required in limited instances such as kernel updates.

FWIW, I usually leave my Windows home computer running. It will usually run just fine for weeks without rebooting.

Phillip
  • 61
4

Linux (the kernel) is very good at freeing resources when programs exit. GNU/Linux, the entire OS, is generally fine to run indefinitely. Restarting user-space programs after you update them is generally a good idea, and often the easiest way to get everything using an updated glibc is to reboot the system.

On systems with driver bugs (typically graphics driver bugs, everything else is usually rock solid), you sometimes get weird behaviour that gets weirder if you don't reboot soon. If you see a kernel OOPS in your dmesg output, you should reboot as soon as is convenient, and report it (or google around for other people with similar problems on similar hardware, in case it's a known problem). Distros don't ship the very latest dev versions of the graphics stack, so sometimes the bug is already fixed upstream, and your graphics card is just too new for the drivers on the distro version you're running to be stable. In that case, look for a PPA with updated builds of mesa/drm/xorg. (I'm not sure what the best choice for running Ubuntu with a bleeding edge graphics stack is ATM).

Anyway, barring driver or other kernel bugs, Linux can run indefinitely without needing a reboot to clear memory fragmentation or anything like that.

I have a Linux router/firewall/mailserver/shell box (P3 450MHz, OCed to 500MHz) which routinely sees uptimes of hundreds of days. I reboot only to rearrange power cords, or to replace a failing power supply. It's been going steady with the same CPU/RAM/hard drives for probably 15 years. I've never had to reboot "because it was getting unstable". It was always for a specific reason, like failing power supply, or kernel upgrade, or power outage and my UPS battery was almost drained (triggering auto shutdown with apcupsd).

If your system is acting weird, check dmesg for problems. If it's just your desktop, then if you just installed some non-kernel package updates, log out / log in (or reboot, but you don't have to). I've found Kubuntu 15.04 will easily run into problems after package updates, I think due to binary incompatibility between upgraded / non-upgraded versions of the same library running in the same binary. (See discussion on this bug).

My go-to for checking for hardware problems is to boot memtest86+. (aptitude install memtest86+) Let that run a full pass, or run overnight. That doesn't guarantee a stable system, since power supply voltage dips on spike loads can happen with CPUs these days, and memtest won't rule that out. Nor will it get your CPU hot, like Prime95.

Peter Cordes
  • 2,287
3

My machine only restarted today for the 15.04 after being up for 11 days without any strange errors which I can recall. If you are doing heavy work and development on a system, it can sometimes be the only option to reboot, but it's only ever on a need-basis.

Patrick
  • 517
1

Technically there are no limits. you just have to set it to not sleep or shut down.

heemayl
  • 93,925
0

Not specific to Ubuntu, but I've got a 1997 vintage laptop (300 MHz, 288 MB RAM) running a Debian-based distro that has had uptime upwards of 60 days, while running a single program (plus system stuff and conky) and not starting and stopping other software except a terminal to load updates weekly. Eventually, it crashed when loading the updates, at around 63 days. By contrast, my Kubuntu 14.04 desktop system will freeze in screen lock after around two weeks. I agree with other answers; it's more about what software you run and how often you start and stop other programs, than about Linux as such.

Zeiss Ikon
  • 5,248
0

Personally I wouldn't want to run my laptop or PC for days with out rebooting or shutting it down.

Simply because of the main components that generate heat can speed up the wear and tear on the MB.

(Thats if you don't have the proper cooling and ventilation)