{"id":1259,"date":"2019-08-31T18:32:53","date_gmt":"2019-08-31T16:32:53","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=1259"},"modified":"2022-06-06T19:12:22","modified_gmt":"2022-06-06T17:12:22","slug":"uprgrading-raspbian-from-stretch-to-buster","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1259","title":{"rendered":"Upgrading Raspbian from Stretch to Buster"},"content":{"rendered":"<p>With the new Buster release for the Raspberry Pi being out for some weeks, it&#8217;s time to upgrade my Pi Zero W server. Unfortunately, though, this is not so easy as a dist upgrade on some major distro like Ubuntu. The official recommendation is to start with a fresh image and then copy over the user-specific settings over from the former production system. &#8211; Easier said than done! As other users point out, transferring and adapting config files for apache, php-fpm, Nextcloud, WordPress, Prosody, Asterisk, Mysql,&#8230;. will take days to complete. Fortunately, <a href=\"https:\/\/pimylifeup.com\/upgrade-raspbian-stretch-to-raspbian-buster\/\">PiMyLifeUp describes a more convient way to upgrade from Stretch to Buster<\/a>. <!--more--><\/p>\n<h1>1. Precautions to be taken against fatal loss of production system<\/h1>\n<ul>\n<li>Produce a <strong>full backup<\/strong> of your stretch production system. Using <a href=\"http:\/\/hobbykeller.spdns.de\/?p=1213\" target=\"_blank\" rel=\"noopener noreferrer\">raspiBackup<\/a> is recommended.<\/li>\n<li>Take an empty microSD card and <strong>restore a clone<\/strong> of the production system to that card. That also ensures that the backup of your production is actually restorable in case of need. Writing the restore took about 3 hours for my system. Different microSD card sizes for the production and the clone are allowed as long as the space on the clone card is sufficient to hold all data from the production system.<\/li>\n<li>Disconnect the production system, boot up the clone and perform any of the subsequent steps on the clone.<\/li>\n<\/ul>\n<h1>2. Basic upgrade procedure<\/h1>\n<p>You can perform the upgrade on any Raspberry Pi device. There is no problem if you lateron take that SD card and plug in in your Zero W production device. My recommendation is to<strong> run the upgrade on the most performant Raspberry in your inventory<\/strong> (in my case that&#8217;s a 3B+). Doing so will not only<strong> speed up the upgrade process<\/strong> but also prevent that you get stuck in the upgrade process for insufficient memory.<\/p>\n<p>My system was once wrecked when the upgrade got stuck at &#8220;Generating Locales&#8221; because the Pi Zero W had run out of memory.<\/p>\n<p>[alert type=&#8221;warning&#8221; icon-size=&#8221;normal&#8221;]In any case you should run <code>sudo raspi-config<\/code> to<strong> disable the camera<\/strong> and set the <strong>GPU memory to the minimum of 16 MB<\/strong> for the update. Do not forget to <strong>reboot<\/strong> the clone to ensure that the settings take effect.[\/alert]<\/p>\n<p>Then follow the <a href=\"https:\/\/pimylifeup.com\/upgrade-raspbian-stretch-to-raspbian-buster\/\" target=\"_blank\" rel=\"noopener noreferrer\">instructions on PiMyLifeUp<\/a>. Make sure at the end, that you reinstall apt-listcache. When asked if services shall be restarted without confirmation choose yes. For any config files choose the option to go with the current ones (&#8220;N&#8221; or &#8220;O&#8221;).<\/p>\n<h1>3. PHP 7.3<\/h1>\n<h2>3.1 Install missing PHP 7.3 modules<\/h2>\n<p>The upgrade will only produce a bare bone PHP 7.3 installation and assumes that you are going to stick with your version 7.0 PHP. But getting PHP 7.3 support is one of the major advantages of switching from Stretch to buster. We therefore have to install some modules manually. The following list is taken from an article on <a href=\"https:\/\/canox.net\/2016\/06\/die-eigene-cloud-mit-dem-raspberry-pi-und-nextcloud\/\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"broken_link\">canox.net<\/a>. As we use MariaDB we have omitted PostgreSQL. Several of the listed modules will already be installed, and I am not sure if the redis related modules are really necessary. Modules already installed will be skipped by apt and there&#8217;s no real harm in installing modules that are not needed.<\/p>\n<pre class=\"lang:default decode:true \">sudo apt install git certbot unzip nginx curl libcurl4 redis-server php-mysql php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-opcache php7.3-xml php7.3-xmlrpc php7.3-zip php7.3-apcu php7.3-common php7.3-intl php-pear php7.3-apcu php7.3-xml php7.3-mbstring php7.3-zip  php7.3-pgsql php7.3-intl php-imagick php7.3-json php7.3-bz2 php-smbclient redis-server php-redis<\/pre>\n<h2>3.2 Amend configuration files for PHP 7.3<\/h2>\n<p>Edit <code>\/etc\/php\/7.3\/fpm\/pool.d\/www.conf<\/code> as follows:<\/p>\n<p>Most important is the need to set the listen address to:<\/p>\n<pre class=\"lang:default decode:true \">listen=127.0.0.1:9000<\/pre>\n<p>Uncomment the following lines by removing the leading semicolon:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Activating HP environment variables\">env[HOSTNAME]=$HOSTNAME\nenv[PATH]=\/usr\/local\/bin:\/usr\/bin:\/bin\nenv[TMP]=\/tmp\nenv[TMPDIR]=\/tmp\nenv[TEMP]=\/tmp<\/pre>\n<p>Further amends of the 7.3 configuration may be needed. I recommend comparing the new <code>\/etc\/php\/7.3\/fpm\/pool.d\/www.conf<\/code> file against the old <code>\/etc\/php\/7.0\/fpm\/pool.d\/www.conf<\/code> file on a desktop machine with some software like Meld to check for differences.<\/p>\n<h2>3.3 Activate PHP7.3 FPM<\/h2>\n<pre class=\"lang:default decode:true \" title=\"Engaging PHP7.3\">sudo systemctl stop php7.0-fpm.service\nsudo systemctl disable php7.0-fpm.service\nsudo systemctl enable php7.3-fpm.service\nsudo systemctl start php7.3-fpm.service<\/pre>\n<h1>4. WordPress<\/h1>\n<p>While Nextcloud should be ready to go, WordPress still has trouble with the crayon syntax highlighter module. My recommendation is to deactivate the module.<\/p>\n<h1>5. Prosody<\/h1>\n<p>Prosody will have troubles finding the certificates. The only way which is really working safely for now is to acquire root privileges and copy copy the most recent <code>certX.pem<\/code> and <code>privkeyX.pem<\/code> from <code>\/etc\/letsencrypt\/archive\/hobbykeller.spdns.de\/<\/code> to <code>\/etcprosody\/certs<\/code> and rename them to <code>localhost.key<\/code> and <code>localhost.crt<\/code>.<br \/>\nAny other approach has so far failed because the certificates are both used by nginx and prosody. Symlinks apparently cannot cope with that ownwership structure.<\/p>\n<h1>6. Python modules<\/h1>\n<p>I later found out that a couple of Python scripts did not work because some of the modules they import got lost during the upgrade from Stretch to Buster. Therefore they should be manually reinstalled via pip. This is also a good opportunity to make sure that pip is in the most recent version:<\/p>\n<pre>sudo -H pip install --upgrade pip\nsudo -H pip install yahoofinancials\nsudo -H pip install requests<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With the new Buster release for the Raspberry Pi being out for some weeks, it&#8217;s time to upgrade my Pi Zero W server. Unfortunately, though, this is not so easy<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1259\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Upgrading Raspbian from Stretch to Buster<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[275,276,269,274,158],"class_list":["post-1259","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-buster","tag-php-7-3","tag-raspberry-pi","tag-stretch","tag-upgrade"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1259"}],"version-history":[{"count":7,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1259\/revisions"}],"predecessor-version":[{"id":1549,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1259\/revisions\/1549"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}