0

I am new to Ubuntu.

I have installed the server version with no GUI. At 3am every morning the server restarts itself.

I don't know where to look to see if its some setting in ubuntu. I ran the 'last' command and at the bottom of the display it says - wtmp begins Fri July 3 03:00:02 2020

If its a setting in ubuntu how can I turn it off and I don't know why it would restart at the same time every day. I am using version 18.04.4

Thanks

Ford
  • 81
  • 2
  • I would check the /etc/crontab file and see if something runs at 03:00 (displays as 0 3 * * * root command_to_execute) and if the command is run-parts --report /etc/cron.daily I would check the scripts in /etc/cron.daily/. – xenoid Jul 03 '20 at 09:39
  • At the dollar sign I typed last head but that brings up the same message of wtmp begins Fri July...... same result when I type last reboot head but same message. I tried this command at the dollar sign sudo crontab -e but there is just lots of text lines with # symbol in front. The first line says # Edit this file to introduce tasks to be run by cron. The last # line reads # m h dom mon dow command – Ford Jul 03 '20 at 09:50
  • This is initiated by unattended-upgrades; it will install new upgrades for packages and then reboot (standard at 3:00 local time). If you set a correct mail address in crontab the system will inform you of its intention to reboot. Moreover, when you login the day before the reboot, the system will tell you every hour on the hour that a reboot is imminent. However, every day is a bit excessive. My server reboots once every three weeks or so. You can do sudo apt update && sudo apt upgrade yourself and see if something is wrong that forces a daily reboot. – Jos Jul 03 '20 at 09:52
  • I ran the /etc/cron.daily/ as was suggested but that brings up a message of -bash: etc/cron.daily/: is a directory. – Ford Jul 03 '20 at 09:53
  • What is the output of grep ":Unattended-Upgrade " /etc/apt/apt.conf.d/*? – FedKad Jul 03 '20 at 09:54
  • I typed grep ":Unattended-Upgrade " /etc/apt/apt.conf.d/* and pressed enter but it just brings the name of my login $ ready for something to be typed there. I did get the sudo apt update && sudo apt upgrade command to work and nothing about times or reboot but it says there are 11 updates. I just selected N for now and I can run that later. – Ford Jul 03 '20 at 10:03
  • But now you still don't know what causes the daily reboots. Please rerun the command and press Y this time. – Jos Jul 03 '20 at 10:06
  • I think I will backup my data first, then run it. I have got files stored on the harddrive. in the meantime I rerun the grep command and used a capital U for upgrade. It must be case sensitive and I got this result. /etc/apt/apt.conf.d/20auto-upgrades:APT::Periodic:Unattended-Upgrade "1"; – Ford Jul 03 '20 at 10:09
  • I think that 1 means every day – Ford Jul 03 '20 at 10:14
  • You can edit the relevant file and change "1" to "0" for *manual* updates. But, in this case do not forget to run sudo apt autoclean && sudo apt autoremove && sudo apt update && sudo apt dist-upgrade at least once per week. I use manual update and run this command sequence several times per week. However, the system rebooting your server *every day* means that there is a problem with the automatic update. Run the above command sequence manually to see what kind of error(s) you have... – FedKad Jul 03 '20 at 10:17
  • Ok I will learn how to do that. What is the relevance of using the autoclean and auto remove. Does that have to be done? I am wondering if I set the updates to manual, if I have to run other commands once a week then maybe I leave things how they are. I don't touch the server for months. The reboot is an annoyance factor if I happen to be working on those documents at the time. Otherwise the system works fine. – Ford Jul 03 '20 at 10:21
  • See man pages for apt and apt-get. – FedKad Jul 03 '20 at 10:27
  • Ok I will learn how to do that. What is the relevance of using the autoclean and auto remove. Does that have to be done? I am wondering if I set the updates to manual, if I have to run other commands once a week then maybe I leave things how they are. I don't touch the server for months. The reboot is an annoyance factor if I happen to be working on those documents at the time. Otherwise the system works fine. I will run that command you suggest. I'll do my backups first then come back on it, once its completed. Thanks for your responses. – Ford Jul 03 '20 at 10:29
  • If you run the commands yourself, you might as well uninstall unattended-upgrades and reboot the server whenever you feel like it. – Jos Jul 03 '20 at 10:43

0 Answers0