<h1 id="pi13-upgrade-from-jessie-8-to-stretch-9---performed-151220">Pi13 upgrade from Jessie 8 to Stretch 9 - performed 15/12/20</h1>
<h2 id="history">History</h2>
<p>Upgraded my raspberry pi 13, which I think had a minimal install Raspbian, Debian i.e. has no desktop installed. The Pi had a PiFaceIO board installed, <a href="https://hackerpublicradio.org/eps.php?id=2901">refer to my previous HPR episode Hpr2901</a></p>
<h2 id="backup-process-in-case-something-went-wrong">Backup process, in case something went wrong</h2>
<p>I first moved all the unnecessary files to free up as much space as possible</p>
<p>Shrunk the Pi partition on the installed 128GB SD card down to 25106MB (24.52GB), (25708544K), 26,325,549,056 bytes using partition magic</p>
<p>I calculated that this would be 51,417,088 blocks of 512 bytes</p>
<p>I used <code>dd</code> to make an image file and grabbed some unallocated space after partition by using count=55417088, refer to the command below</p>
<pre><code>sudo dd if=/dev/sdb of=/home/stuart/pi-13-img-backup.img bs=512 count=55417088</code></pre>
<p>I used the following command to image files to a spare 64GB SD card</p>
<pre><code>sudo dd if=/home/stuart/pi-13-img-backup.img of=/dev/sdb bs=512 status=progress</code></pre>
<p>I then expanded the partition to fill the full 64GB of the card</p>
<p>Booted from the 64GB card to make sure that I had a backup in case anything went wrong</p>
<p>Removed the 64GB card which I can go back to if things don't work out</p>
<p>Booted from 128GB card and expanded the partition using Gparted to fill 128GB SD card</p>
<p>I used the 128GB SD card to perform the upgrade, remember I have 64GB card to fall back on if things go wrong</p>
<h2 id="upgrade-process">Upgrade process</h2>
<p><a href="https://www.datenreise.de/en/raspberry-pi-raspbian-update-update-jessie-to-stretch/">Source of information below</a></p>
<p>Step 1: Check available disk space</p>
<p>In order to update to Raspbian Stretch, there must be enough space on the SD card. Therefore you should check the available and used disk space usage first:</p>
<pre><code>$ df -h</code></pre>
<p>Step 2: Check package status</p>
<p>You must also check that all packages are in a state that is suitable for upgrade. The following command displays all packages that have the status semi-installed or configuration failed, and those with error status:</p>
<pre><code>$ sudo dpkg --audit
$ sudo dpkg --get-selections | grep hold</code></pre>
<p>Step 3: Update system</p>
<p>Before upgrading, the Raspbian should be completely updated:</p>
<pre><code>$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade</code></pre>
<p>Step 4: Modify Release</p>
<p>For upgrading to the new Raspbian version, the package lists must be adapted to the "Stretch" release. To do this, only the word "jessie" has to be replaced by "stretch". In order not to overlook any position, we simply let the replacement be done by the following command:</p>
<pre><code>$ sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list
$ sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list.d/*.list</code></pre>
<p>Step 5: Updating package lists</p>
<p>The new package lists must then be updated and imported:</p>
<pre><code>$ sudo apt-get update</code></pre>
<p>Step 6: Update to "Stretch"</p>
<p>Now we are ready to start the upgrade:</p>
<pre><code>$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade</code></pre>
<p>Step 7: Clean up installation</p>
<p>Old, unnecessary packages are removed after the system update with the following commands:</p>
<pre><code>$ sudo apt-get autoremove
$ sudo apt-get autoclean</code></pre>
<h2 id="what-was-reported-during-upgrade">What was reported during upgrade</h2>
<h3 id="repo-for-get_iplayer-no-longer-available-so-had-to-comment-them-out.-on-my-pi-these-were-located-at-the-following-location.">repo for get_iplayer no longer available so had to comment them out. On my Pi these were located at the following location.</h3>
<pre><code>/etc/apt/sources.list.d/packages.hedgrows.org.uk.list</code></pre>
<h3 id="change-to-lsb_release-command">change to lsb_release command</h3>
<p>The lsb_release command no longer worked so after the upgrade I could not use it to check what version of Debian I was running.</p>
<p><a href="https://linuxconfig.org/check-what-debian-version-you-are-running-on-your-linux-system">Link to alternative methods to check installed Debian version.</a></p>
<p>I chose the following method</p>
<pre><code>cat /etc/os-release</code></pre>
<h3 id="bashrc---kept-my-original-file">.bashrc - kept my original file</h3>
<p>Something about /etc/login.defs &amp; /etc/login.defs.dpkg-new</p>
<h3 id="lots-of-changes-in-new-version-of-ssh">lots of changes in new version of ssh</h3>
<p>Something was mentioned about apt hashes sha1 weak "yes" &amp; apt hashes ripe-md/160 weak "yes"</p>
<p>Something about ~/.ssh/authorized_keys &amp; ~/.ssh/authorized_keys2</p>
<p>Something about key length and accepted key types</p>
<h2 id="what-went-wrong-after-the-upgrade">What went wrong after the upgrade</h2>
<h3 id="mocp-wouldnt-run">mocp wouldn't run</h3>
<p>I had to modify my config file in .moc folder I added the following line near the top of the file</p>
<pre><code>ALSAStutterDefeat = no</code></pre>
<p>In my .moc folder I had to also modify the my_keymap file at line 82. I think the next_search option is not available in the new version of moc 2.6-alpha3 installed with Debian Stretch. I commented out the following</p>
<pre><code>#next_search =          ^g ^n</code></pre>
<h3 id="pifacedigitalio-test.py-reported-an-error">pifacedigitalio test.py reported an error</h3>
<p>multiple errors reported last line of error was:-</p>
<pre><code>pifacedigitalio.core.NoPiFaceDigitalDetectedError: No PiFace Digital board detected (hardware_addr=0, bus=0, chip_select=0)</code></pre>
<p>I changed the first line of my python script</p>
<p>from</p>
<pre><code>#!/usr/bin/env python</code></pre>
<p>to</p>
<pre><code>#!/usr/bin/env python3</code></pre>
<p>This removed the original error. I stupidly thought this had solved the problem so I went about converting my script to run with Python 3 only to find at the end once I had correct everything that I ended up with the same original error.</p>
<h2 id="how-i-solved-the-pifacedigitalio-test.py-reported-error">How I solved the pifacedigitalio test.py reported error</h2>
<p><a href="https://www.raspberrypi.org/forums/viewtopic.php?t=196248">The problem was solved by looking at this post</a></p>
<p>According to the post it had something to do with the SPI serial speed changing from 500Khz to 125Mhz</p>
<p>Problem was solved by modifying a file spi.py</p>
<p>I found the location of the file by using the following command</p>
<pre><code>find / -iname spi.py</code></pre>
<p>The files were located at</p>
<pre><code>/usr/lib/python2.7/dist-packages/pifacecommon/spi.py
/usr/lib/python3/dist-packages/pifacecommon/spi.py</code></pre>
<p>I created a copy of the original file and called it spi.py.bak</p>
<p>I only modified the file in python2.7 as my program test.py runs in python2.7</p>
<p>I added a comma to the end of line 68 and added the following line to line 69</p>
<pre><code>speed_hz=ctypes.c_uint32(15000)</code></pre>
<h2 id="ssh-from-pifacecad-stopped-working">SSH from pifacecad stopped working</h2>
<p>My Raspberry pi "Pi10" downstairs would not SSH into my Pi13 server upstairs This made it impossible for me to remotely start and stop podcasts and audiobooks playing on my Pi13 upstairs.</p>
<p>This happened because the downstairs Pi10 had DSA and RSA keys and it was using DSA keys to ssh into Pi13. I found this by looking at /var/logs/auth.log on Pi13 The log reported</p>
<pre><code>userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes</code></pre>
<h2 id="ssh-from-eeepc-stopped-working">SSH from EEEPC stopped working</h2>
<p>Was not able to SSH into Pi13 from EEEpc</p>
<p>My EEEPC netbook only had DSA keys and that is what it was using to try and SSH into Pi13 I generated new RSA keys and added them to Pi13, this solved the problem and allowed me to ssh into Pi13 from the EEEpc</p>
