{"id":138,"date":"2024-01-29T10:23:53","date_gmt":"2024-01-29T09:23:53","guid":{"rendered":"https:\/\/daik.nl\/?p=138"},"modified":"2024-04-11T10:50:02","modified_gmt":"2024-04-11T09:50:02","slug":"automatic-updates-for-raspberry-pi","status":"publish","type":"post","link":"https:\/\/daik.nl\/?p=138","title":{"rendered":"Unattended upgrades for Raspberry Pi"},"content":{"rendered":"\n<p>This guide will help you to install automatic updates for Raspberry Pi<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unattended upgrades for Raspberry Pi is a must!<\/h2>\n\n\n\n<p>It is very important that you regularly update any OS of any kind of computer, whether it is a laptop or a built-in computer in your refrigerator. Hackers use previously found vulnerabilities in your OS. If you have closed it with the latest updates, then at least they can no longer use these vulnerabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Standard update commands<\/h2>\n\n\n\n<p>The standard update commands, which you should run regularly, are:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt upgrade<\/code><\/pre>\n\n\n\n<p>The first line retrieves the latest versions of the apps installed on your Raspberry. The second line will actually install them. You can choose to run these commands regularly. But you can also automate them:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Automate the updates<\/h2>\n\n\n\n<p>There is a program within Linux that allows you to schedule commands. You should see it as a kind of alarm clock, where you set the alarm to go off at certain times, but you can also have an action carried out immediately. That little program is called the crontab and you can set it with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo crontab -e<\/code><\/pre>\n\n\n\n<p>When you first start this on your Raspberry, you will be asked which editor you want to edit the file with. It is a configuration file that you edit. I always choose nano, purely because that is what I work with the most.<\/p>\n\n\n\n<p>A text document opens with an explanation of how to configure the crontab. It is quite complex, you do not need to know everything for this action, scroll to the last line and add the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>0 1 * * *  sudo \/usr\/bin\/apt update -y &gt; \/var\/log\/automaticupdates.log\n15 1 * * *  sudo \/usr\/bin\/apt upgrade -y &gt;&gt; \/var\/log\/automaticupdates.log<\/code><\/pre>\n\n\n\n<p>Leave the crontab file (with &lt;ctrl &#8211; x&gt; and save the changes (y, and &lt;enter&gt;). If you enter correctly you will get the answer: crontab: installing new crontab.<\/p>\n\n\n\n<p>You have now automated the update. Every day at 1:00 am a check will be made for new updates and they will be installed at 1:15 am. Furthermore, the resulting messages are stored in the log folder in the automaticupdates.log file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Check operation of automatic updates<\/h2>\n\n\n\n<p>The next day (or if you have been running it for a while) you can check whether the file is working. To do this, type the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/var\/log\/automaticupdates.log<\/code><\/pre>\n\n\n\n<p>You can see in the overview whether updates have been carried out, check whether there are also error lines in the log.<\/p>\n\n\n\n<p>If you are looking for an post about installing a Raspberry Pi, hit <a href=\"https:\/\/daik.nl\/index.php\/en\/2024\/01\/26\/how-to-install-a-raspberry-pi\/\">Installing a Raspberry Pi<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Automatic updates for Raspberry Pi<\/p>\n","protected":false},"author":1,"featured_media":144,"comment_status":"open","ping_status":"open","sticky":false,"template":"single-with-sidebar","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[120,130,13,22,125,123],"class_list":["post-138","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-raspberry","tag-automatic","tag-crontab-en","tag-linux","tag-raspberry-pi","tag-schedule","tag-update"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unattended upgrades for Raspberry Pi - DAIK<\/title>\n<meta name=\"description\" content=\"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/daik.nl\/?p=138\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unattended upgrades for Raspberry Pi - DAIK\" \/>\n<meta property=\"og:description\" content=\"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/daik.nl\/?p=138\" \/>\n<meta property=\"og:site_name\" content=\"DAIK\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-29T09:23:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-11T09:50:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"474\" \/>\n\t<meta property=\"og:image:height\" content=\"316\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"daik01\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"daik01\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/daik.nl\/?p=138#article\",\"isPartOf\":{\"@id\":\"https:\/\/daik.nl\/?p=138\"},\"author\":{\"name\":\"daik01\",\"@id\":\"https:\/\/daik.nl\/#\/schema\/person\/519bc4684d9c8c0cec1a6caa9b65412a\"},\"headline\":\"Unattended upgrades for Raspberry Pi\",\"datePublished\":\"2024-01-29T09:23:53+00:00\",\"dateModified\":\"2024-04-11T09:50:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/daik.nl\/?p=138\"},\"wordCount\":410,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/daik.nl\/#organization\"},\"image\":{\"@id\":\"https:\/\/daik.nl\/?p=138#primaryimage\"},\"thumbnailUrl\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg\",\"keywords\":[\"automatic\",\"crontab\",\"Linux\",\"Raspberry PI\",\"schedule\",\"update\"],\"articleSection\":[\"Linux\",\"Raspberry\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/daik.nl\/?p=138#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/daik.nl\/?p=138\",\"url\":\"https:\/\/daik.nl\/?p=138\",\"name\":\"Unattended upgrades for Raspberry Pi - DAIK\",\"isPartOf\":{\"@id\":\"https:\/\/daik.nl\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/daik.nl\/?p=138#primaryimage\"},\"image\":{\"@id\":\"https:\/\/daik.nl\/?p=138#primaryimage\"},\"thumbnailUrl\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg\",\"datePublished\":\"2024-01-29T09:23:53+00:00\",\"dateModified\":\"2024-04-11T09:50:02+00:00\",\"description\":\"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.\",\"breadcrumb\":{\"@id\":\"https:\/\/daik.nl\/?p=138#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/daik.nl\/?p=138\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/daik.nl\/?p=138#primaryimage\",\"url\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg\",\"contentUrl\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg\",\"width\":474,\"height\":316,\"caption\":\"Automatic updates for Raspberry Pi\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/daik.nl\/?p=138#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/daik.nl\/?lang=nl\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unattended upgrades for Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/daik.nl\/#website\",\"url\":\"https:\/\/daik.nl\/\",\"name\":\"DAIK\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/daik.nl\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/daik.nl\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/daik.nl\/#organization\",\"name\":\"DAIK\",\"url\":\"https:\/\/daik.nl\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/daik.nl\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/logo.png\",\"contentUrl\":\"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/logo.png\",\"width\":576,\"height\":600,\"caption\":\"DAIK\"},\"image\":{\"@id\":\"https:\/\/daik.nl\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/daik.nl\/#\/schema\/person\/519bc4684d9c8c0cec1a6caa9b65412a\",\"name\":\"daik01\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/daik.nl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1d92ef146a58720c38ca892f2c6e166e850669a89d08af16f01ec96c118e7000?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1d92ef146a58720c38ca892f2c6e166e850669a89d08af16f01ec96c118e7000?s=96&d=identicon&r=g\",\"caption\":\"daik01\"},\"sameAs\":[\"http:\/\/daik.nl\"],\"url\":\"https:\/\/daik.nl\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unattended upgrades for Raspberry Pi - DAIK","description":"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/daik.nl\/?p=138","og_locale":"en_US","og_type":"article","og_title":"Unattended upgrades for Raspberry Pi - DAIK","og_description":"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.","og_url":"https:\/\/daik.nl\/?p=138","og_site_name":"DAIK","article_published_time":"2024-01-29T09:23:53+00:00","article_modified_time":"2024-04-11T09:50:02+00:00","og_image":[{"width":474,"height":316,"url":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg","type":"image\/jpeg"}],"author":"daik01","twitter_card":"summary_large_image","twitter_misc":{"Written by":"daik01","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/daik.nl\/?p=138#article","isPartOf":{"@id":"https:\/\/daik.nl\/?p=138"},"author":{"name":"daik01","@id":"https:\/\/daik.nl\/#\/schema\/person\/519bc4684d9c8c0cec1a6caa9b65412a"},"headline":"Unattended upgrades for Raspberry Pi","datePublished":"2024-01-29T09:23:53+00:00","dateModified":"2024-04-11T09:50:02+00:00","mainEntityOfPage":{"@id":"https:\/\/daik.nl\/?p=138"},"wordCount":410,"commentCount":0,"publisher":{"@id":"https:\/\/daik.nl\/#organization"},"image":{"@id":"https:\/\/daik.nl\/?p=138#primaryimage"},"thumbnailUrl":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg","keywords":["automatic","crontab","Linux","Raspberry PI","schedule","update"],"articleSection":["Linux","Raspberry"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/daik.nl\/?p=138#respond"]}]},{"@type":"WebPage","@id":"https:\/\/daik.nl\/?p=138","url":"https:\/\/daik.nl\/?p=138","name":"Unattended upgrades for Raspberry Pi - DAIK","isPartOf":{"@id":"https:\/\/daik.nl\/#website"},"primaryImageOfPage":{"@id":"https:\/\/daik.nl\/?p=138#primaryimage"},"image":{"@id":"https:\/\/daik.nl\/?p=138#primaryimage"},"thumbnailUrl":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg","datePublished":"2024-01-29T09:23:53+00:00","dateModified":"2024-04-11T09:50:02+00:00","description":"This guide will help you to install automatic updates for Raspberry Pi os. This is a complete manual to support anattended upgrades on Linux devices.","breadcrumb":{"@id":"https:\/\/daik.nl\/?p=138#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/daik.nl\/?p=138"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/daik.nl\/?p=138#primaryimage","url":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg","contentUrl":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/th-4-1.jpg","width":474,"height":316,"caption":"Automatic updates for Raspberry Pi"},{"@type":"BreadcrumbList","@id":"https:\/\/daik.nl\/?p=138#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/daik.nl\/?lang=nl"},{"@type":"ListItem","position":2,"name":"Unattended upgrades for Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/daik.nl\/#website","url":"https:\/\/daik.nl\/","name":"DAIK","description":"","publisher":{"@id":"https:\/\/daik.nl\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/daik.nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/daik.nl\/#organization","name":"DAIK","url":"https:\/\/daik.nl\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/daik.nl\/#\/schema\/logo\/image\/","url":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/logo.png","contentUrl":"https:\/\/daik.nl\/wp-content\/uploads\/2024\/01\/logo.png","width":576,"height":600,"caption":"DAIK"},"image":{"@id":"https:\/\/daik.nl\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/daik.nl\/#\/schema\/person\/519bc4684d9c8c0cec1a6caa9b65412a","name":"daik01","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/daik.nl\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1d92ef146a58720c38ca892f2c6e166e850669a89d08af16f01ec96c118e7000?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1d92ef146a58720c38ca892f2c6e166e850669a89d08af16f01ec96c118e7000?s=96&d=identicon&r=g","caption":"daik01"},"sameAs":["http:\/\/daik.nl"],"url":"https:\/\/daik.nl\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daik.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=138"}],"version-history":[{"count":9,"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/posts\/138\/revisions"}],"predecessor-version":[{"id":543,"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/posts\/138\/revisions\/543"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daik.nl\/index.php?rest_route=\/wp\/v2\/media\/144"}],"wp:attachment":[{"href":"https:\/\/daik.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daik.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daik.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}