{"id":461,"date":"2017-07-01T13:34:27","date_gmt":"2017-07-01T12:34:27","guid":{"rendered":"http:\/\/chewett.co.uk\/blog\/?p=461"},"modified":"2017-07-01T15:33:13","modified_gmt":"2017-07-01T14:33:13","slug":"updating-raspberry-pi-cluster-without-logging-every-pi","status":"publish","type":"post","link":"https:\/\/chewett.co.uk\/blog\/461\/updating-raspberry-pi-cluster-without-logging-every-pi\/","title":{"rendered":"Updating the Raspberry Pi Cluster without logging in to every Pi"},"content":{"rendered":"<p>The Raspberry Pi foundation have recently <a href=\"https:\/\/www.raspberrypi.org\/blog\/a-raspbian-desktop-update-with-some-new-programming-tools\/\">updated their Raspbian image<\/a>. This brings bugfixes and upgrades to the Raspberry Pi. In this blogpost I share how you can run a command on your Raspberry Pi without logging in (this is mostly true although you still do &#8220;log in&#8221; just not in the typical way). This includes detailing how I have updated my Raspberry Pi Cluster quickly using this method.<\/p>\n<p>&nbsp;<\/p>\n<p><!--more--><\/p>\n<h2>Running a command on the Raspberry Pi without logging in<\/h2>\n<p>To run a single command on the Raspberry Pi you can use ssh similar to how you login. Instead of just entering in the name of the machine you can also add a command to run. For example you can run the below command.<\/p>\n<p><code>ssh bunker-node4 \"sudo apt-get update\"<\/code><\/p>\n<p>This will ssh into the machine <code>bunker-node4<\/code> and then run the command passed to SSH. During the runtime of the command you will see the output as if you ran it after logging into the Raspberry Pi. Once the command has finished running you will be returned to your terminal.<\/p>\n<p>In addition you can also run multiple commands by separating them with a semicolon (<code>;<\/code>) such as:<\/p>\n<p><code>ssh bunker-node4 \"whoami; pwd\"<\/code><\/p>\n<p>The above command will run <code>whoami<\/code>\u00a0on the Raspberry Pi followed by <code>pwd<\/code>\u00a0showing the output of both commands.<\/p>\n<h2>Updating all the nodes in my cluster<\/h2>\n<p>To update a Raspberry Pi to the new version you need to run <code>apt-get update<\/code> and <code>apt-get dist-upgrade<\/code>. I combined both these commands into a handy way to update each Raspberry Pi in turn.<\/p>\n<pre>ssh bunker-node4 \"sudo apt-get update; sudo apt-get dist-upgrade; sudo reboot\"<\/pre>\n<p>First this runs <code>apt-get update<\/code> and updates the package list. This gets the details of the newest packages and their required packages (dependencies). Once I have updated the package list I can then run <code>apt-get dist-upgrade<\/code>\u00a0which upgrades the packages installed to the latest versions available.<\/p>\n<p>Once this has updated the Raspberry Pi I then reboot it to reload all the services. I do this because any services that have been updated may need to be restarted to load the updated files. The easiest way of doing this and being sure that you are running the latest version of everything is by restarting the Raspberry Pi.<\/p>\n<p>Many times after doing updates you \u00a0will not need to restart it but its something I can easily do to ensure everything is fully updated.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Raspberry Pi foundation have recently updated their Raspbian image. This brings bugfixes and upgrades to the Raspberry Pi. In this blogpost I share how you can run a command on your Raspberry Pi without logging in (this is mostly true although you still do &#8220;log in&#8221; just not in the typical way). This includes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":467,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[122],"tags":[37,101,90],"class_list":["post-461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-cluster","tag-raspberry-pi","tag-raspberry-pi-cluster","tag-ssh"],"wppr_data":{"cwp_meta_box_check":"No"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/07\/raspbian_update_command.png?fit=580%2C307&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2toWX-7r","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":409,"url":"https:\/\/chewett.co.uk\/blog\/409\/setting-raspberry-pi-cluster-node\/","url_meta":{"origin":461,"position":0},"title":"Setting up a Raspberry Pi Cluster Node","author":"Chewett","date":"August 19, 2017","format":false,"excerpt":"To set up a Raspberry Pi node I will follow a specific set of steps so that every Pi is set up \u00a0similarly. For the initial deployment I will follow this once and then clone the SD Card multiple times. If at a later date more are added I will\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/setting_up_a_raspi_cluster_node.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":375,"url":"https:\/\/chewett.co.uk\/blog\/375\/setting-up-the-ci20-for-the-cluster\/","url_meta":{"origin":461,"position":1},"title":"Setting up the CI20 for the cluster","author":"Chewett","date":"October 27, 2018","format":false,"excerpt":"This post talks about the steps I have followed to set up my Creator CI20 for the Raspberry Pi Cluster. Burning Debian to the onboard NAND and configuring it To run the CI20 on the Raspberry Pi Cluster I am going to write Debian 8 to the NAND storage. First\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2018\/10\/ci40_setup.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":448,"url":"https:\/\/chewett.co.uk\/blog\/448\/testing-performance-raspberry-pi\/","url_meta":{"origin":461,"position":2},"title":"Testing the performance of a Raspberry Pi","author":"Chewett","date":"July 12, 2017","format":false,"excerpt":"I will be testing the performance of each Raspberry Pi version in my cluster. This is to determine what each one is best suited to running. To do this I need a similar set of tests to run for each and compare them. Ideally the tests will also be runnable\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":569,"url":"https:\/\/chewett.co.uk\/blog\/569\/creating-raspberry-pi-backup-script-scp-bash-windows\/","url_meta":{"origin":461,"position":3},"title":"Creating a Raspberry Pi backup script with scp and Bash on Windows","author":"Chewett","date":"August 30, 2017","format":false,"excerpt":"This post describes a simple way to keep backups of a Raspberry Pi or any other Linux computer. Why do I need backups of my Raspberry Pi? Some of the nodes in my cluster are going to be compute only, meaning that they will just run what is asked of\u2026","rel":"","context":"In &quot;Informational&quot;","block_context":{"text":"Informational","link":"https:\/\/chewett.co.uk\/blog\/category\/informational\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/backing_up_a_rasperry_pi.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/backing_up_a_rasperry_pi.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/backing_up_a_rasperry_pi.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2017\/08\/backing_up_a_rasperry_pi.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":407,"url":"https:\/\/chewett.co.uk\/blog\/407\/ssh-connect-host-raspberrypi-port-22-connection-refused-error-fixed\/","url_meta":{"origin":461,"position":4},"title":"ssh: connect to host raspberrypi port 22: Connection refused Error Fixed","author":"Chewett","date":"June 24, 2017","format":false,"excerpt":"I was setting up a new install of Raspbian Pixel and found I couldn't login to the Raspberry Pi. It was giving me an error: chewett@bunker-master:~$ ssh pi@raspberrypi ssh: connect to host raspberrypi port 22: Connection refused It turns out that recently the Raspberry Pi Foundation have changed the default\u2026","rel":"","context":"In &quot;Raspberry Pi Cluster&quot;","block_context":{"text":"Raspberry Pi Cluster","link":"https:\/\/chewett.co.uk\/blog\/category\/raspberry-pi-cluster\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1933,"url":"https:\/\/chewett.co.uk\/blog\/1933\/using-the-nano-editor-with-a-raspberry-pi\/","url_meta":{"origin":461,"position":5},"title":"Using the Nano Editor with a Raspberry Pi","author":"Chewett","date":"February 16, 2019","format":false,"excerpt":"Today I talk about the Nano editor which can be used to edit files on the Raspberry Pi over SSH. What is Nano? Nano is an easy to use command line text editor. It is very useful when you need to edit files on your Raspberry Pi over SSH. Using\u2026","rel":"","context":"In &quot;Informational&quot;","block_context":{"text":"Informational","link":"https:\/\/chewett.co.uk\/blog\/category\/informational\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/using_nano_on_the_pi.jpg?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/using_nano_on_the_pi.jpg?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/using_nano_on_the_pi.jpg?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/chewett.co.uk\/blog\/wp-content\/uploads\/2019\/01\/using_nano_on_the_pi.jpg?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=461"}],"version-history":[{"count":3,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/461\/revisions"}],"predecessor-version":[{"id":464,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/posts\/461\/revisions\/464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media\/467"}],"wp:attachment":[{"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chewett.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}