upgrading-the-pinephone.html 8.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /><meta name="keywords" content="GNU, Emacs, Libre Software, Hurd, Guile, Guix" /><meta name="description" content="GNUcode.me is a website focusing on libre software projects, especially the GNU project." /><link type="application/atom+xml" rel="alternate" title="GNUcode.me -- Feed" href="/feed.xml" /><a rel="me" href="https://fosstodon.org/@thegnuguy"></a><link type="text/css" href="css/footer.min.css" rel="stylesheet"></link><link type="text/css" href="css/header.min.css" rel="stylesheet"></link><link type="text/css" href="css/main.min.css" rel="stylesheet"></link><title>Upgrading the PinePhone — GNUcode.me</title></head><body><header><nav><ul><li><a href="index.html">GNUcode.me</a></li><li><a href="services.html">Services</a></li><li><a href="about.html">About</a></li><li><a href="business-ideas.html">Business-ideas</a></li></ul></nav></header><h1>Upgrading the PinePhone</h1><main><section class="basic-section-padding"><article><h3>by Joshua Branson — February 04, 2023</h3><div><p>So I have been running this to upgrade the pinephone for a while now:</p><pre><code># apk upgrade
  2. # apk update
  3. # apk upgrade
  4. # apk update</code></pre><p>Today, when I rebooted I got a message that said that my pinephone’s version was
  5. no longer supported. I should <a href="https://postmarketos.org/upgrade">upgrade</a>:</p><p>I figured that I will probably do this again, so I might as well write down the
  6. steps for how to do the upgrade.</p><p>Before I really get started in this, I want to get set up in the <a href="https://wiki.postmarketos.org/wiki/Matrix_and_IRC">matrix chat
  7. room.</a> I used the web based interface for the matrix chat. It had me create an
  8. online account, and verify my email address, then I could talk in the matrix
  9. channel. That was easy, moving onto the next step.</p><p>First install <code>postmarketos-release-upgrade</code> package:</p><pre><code># apk add postmarketos-release-upgrade</code></pre><p>Next I want to create a <a href="https://wiki.postmarketos.org/wiki/Backup_and_restore_your_data">backup</a>, of the pinephone incase the upgrade fails or
  10. breaks the phone and I have to install postmarketOS.</p><p>Ok, in the pinephone’s terminal, start the sshd daemon:</p><pre><code>sudo service sshd start</code></pre><p>So possibly the best way to upgrade your pinephone is to connect the phone to
  11. your laptop/desktop via a usb cord and enable <a href="https://wiki.postmarketos.org/wiki/USB_Internet#Linux">usb internet.</a></p><p>Apparently after you connect the phone to your host machine, you should be able
  12. to run:</p><pre><code>ssh user@172.16.42.1</code></pre><p>That didn’t work. And it is quickly looking to me like the usb internet upgrade
  13. option is NOT going to work. Or rather, it will work, but it will take me a lot
  14. of time to get it to work.</p><p>So instead of using the usb internet upgrade option, I will try connecting the
  15. pinephone to the internet via an ethernet cord (I personally disabled the wifi
  16. on the phone to try to save power). Then I will make a backup of the pinephone.</p><p>Ok, now that I have my phinephone connected to an ethernet port, I used my
  17. laptop to ssh into the pinephone.</p><p>I found my pinephone’s ip address via running this on the pinephone’s terminal:</p><pre><code>ip a</code></pre><p>Ok, so the looking at eth0: the pinephone’s ip address is:</p><p>SOME.IP.Address.04</p><p>So, I can now ssh into the phone via:</p><p><code>ssh user@SOME.IP.Address.04</code></p><p>Since I have ssh-agent set up, lets set up ssh key login:</p><pre><code>ssh-copy-id user@SOME.IP.ADDRESS.04</code></pre><p>Now let’s create a backup on my host comptuter (laptop):</p><pre><code>mkdir ~/postmarket-os-backup
  18. rsync -avz --exclude=.cache user@SOME.IP.ADDRESS.04:/home/user/ .
  19. fish: Unknown command: rsync
  20. fish:
  21. rsync --server --sender -vlogDtprze.iLsfxCIvu . /home/user/
  22. ^
  23. rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
  24. rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]</code></pre><p>Well that seems like a weird problem. Let’s go join the fish irc channel.</p><p>Well the channel is here:</p><p><code>#fish</code> at irc.oftc.net</p><p>I can find out how to connect via going to oftc.net. They ever have a <a href="https://webchat.oftc.net/">webchat</a>.
  25. That makes it easy. Just put in a goofy nickname and you are in the chat room!</p><p>It took the fish people a while to respond, so I also asked in the <code>#guix</code>
  26. channel, while I was waiting. A guix user said that I should try this:</p><pre><code>guix shell --network -C coreutils rsync openssh-sans-x</code></pre><p>And then run my rsync command.</p><p>That didn’t work, but then the <code>#fish</code> people just asked me if I have rsync
  27. installed on my pinephone…I didn’t realize I needed it installed on both
  28. devices.</p><p>So let’s do that on the pinephone: <code>sudo apk add rsync</code>.</p><p>Let’s try this again. On my laptop I ran this:</p><pre><code>rsync -avz --exclude=.cache user@SOME.IP.ADDRESS.04:/home/user/ ~/postmarket-os-backup</code></pre><p>Ok that worked!</p><p>The <a href="https://wiki.postmarketos.org/wiki/Upgrade_to_a_newer_postmarketOS_release">postmarketOS wiki</a> recommends that I use tmux or screen to update the
  29. pinephone, in case the ssh connection breaks. Well I believe that I have tried
  30. updating the pinephone before using just an ssh connection, and the ssh
  31. connection dropped. I did not know if they phone was done updating or if it had
  32. just died. So I forcefully shut off the device, and it failed to boot. Fun
  33. times.</p><p>Well let’s go ask in the postmarketOS irc channel or <a href="https://wiki.postmarketos.org/wiki/Category:Community">matrix</a> and ask about using
  34. tmux or screen. How does it make sure that the ssh connection does not break? I
  35. can also check out the archlinux wiki. Also it seems as if tmux is more user
  36. friendly, so I will check out the <a href="https://wiki.archlinux.org/title/Tmux">tmux</a> page to learn more about it.</p><p>Well let’s go ahead and install tmux on my laptop: <code>guix install tmux</code>.</p><p>Let’s try to run an ssh connection on the pinephone via tmux. I think this
  37. is how you do it:</p><pre><code>tmux
  38. ssh user@&lt;IP address of the pinephone&gt;</code></pre><p>Well I asked in the postmarketOS irc channel why they reccommend using tmux in
  39. case the ssh connection drops, and this is the answer that I got:</p><blockquote><p>if you use tmux, you can just restore your tmux session if the ssh connection drops
  40. and the command will still be running in there</p><p>run tmux
  41. then if the connection drops
  42. tmux list-sessions
  43. and then
  44. tmux attach-session
  45. I think</p></blockquote><p>Then if the ssh connection gets dropped, I can open up a new terminal and do
  46. this <code>tmux attach</code>, and I will be right back where I was. This <a href="https://www.youtube.com/watch?v=JQ0yDCVu44E">video</a> explains
  47. that. That is pretty awesome!</p><p>Here <a href="https://mutelight.org/practical-tmux">are</a> <a href="https://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/">some</a> <a href="https://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2">tmux</a> <a href="https://man.archlinux.org/man/tmux.1">resources.</a></p><p>Next, I ran the following to update the pinephone:</p><pre><code>tmux
  48. ssh user@&lt;my Pinephone IP address&gt;
  49. postmarketos-release-upgrade</code></pre><p>Since, my phinephone had an ethernet connection, the upgrade process was over
  50. inside 5 minutes, and the phone rebooted itself. Nice work postmarketos
  51. developers!</p></div></article></section></main><footer><p>© 2020 Joshua Branson. The text on this site is free culture under the Creative Commons Attribution Share-Alike 4.0 International license.</p><p>This website is build with Haunt, a static site generator written in Guile Scheme. Source code is <a href="https://notabug.org/jbranso/gnucode.me">available.</a></p><p>The color theme of this website is based off of the famous <a href="#3f3f3f" target="_blank">zenburn</a> theme.</p></footer></body>