by Joshua Branson — February 04, 2023
So I have been running this to upgrade the pinephone for a while now:
# apk upgrade
# apk update
# apk upgrade
# apk update
Today, when I rebooted I got a message that said that my pinephone’s version was no longer supported. I should upgrade:
I figured that I will probably do this again, so I might as well write down the steps for how to do the upgrade.
Before I really get started in this, I want to get set up in the matrix chat room. I used the web based interface for the matrix chat. It had me create an online account, and verify my email address, then I could talk in the matrix channel. That was easy, moving onto the next step.
First install postmarketos-release-upgrade
package:
# apk add postmarketos-release-upgrade
Next I want to create a backup, of the pinephone incase the upgrade fails or breaks the phone and I have to install postmarketOS.
Ok, in the pinephone’s terminal, start the sshd daemon:
sudo service sshd start
So possibly the best way to upgrade your pinephone is to connect the phone to your laptop/desktop via a usb cord and enable usb internet.
Apparently after you connect the phone to your host machine, you should be able to run:
ssh user@172.16.42.1
That didn’t work. And it is quickly looking to me like the usb internet upgrade option is NOT going to work. Or rather, it will work, but it will take me a lot of time to get it to work.
So instead of using the usb internet upgrade option, I will try connecting the pinephone to the internet via an ethernet cord (I personally disabled the wifi on the phone to try to save power). Then I will make a backup of the pinephone.
Ok, now that I have my phinephone connected to an ethernet port, I used my laptop to ssh into the pinephone.
I found my pinephone’s ip address via running this on the pinephone’s terminal:
ip a
Ok, so the looking at eth0: the pinephone’s ip address is:
SOME.IP.Address.04
So, I can now ssh into the phone via:
ssh user@SOME.IP.Address.04
Since I have ssh-agent set up, lets set up ssh key login:
ssh-copy-id user@SOME.IP.ADDRESS.04
Now let’s create a backup on my host comptuter (laptop):
mkdir ~/postmarket-os-backup
rsync -avz --exclude=.cache user@SOME.IP.ADDRESS.04:/home/user/ .
fish: Unknown command: rsync
fish:
rsync --server --sender -vlogDtprze.iLsfxCIvu . /home/user/
^
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]
Well that seems like a weird problem. Let’s go join the fish irc channel.
Well the channel is here:
#fish
at irc.oftc.net
I can find out how to connect via going to oftc.net. They ever have a webchat. That makes it easy. Just put in a goofy nickname and you are in the chat room!
It took the fish people a while to respond, so I also asked in the #guix
channel, while I was waiting. A guix user said that I should try this:
guix shell --network -C coreutils rsync openssh-sans-x
And then run my rsync command.
That didn’t work, but then the #fish
people just asked me if I have rsync
installed on my pinephone…I didn’t realize I needed it installed on both
devices.
So let’s do that on the pinephone: sudo apk add rsync
.
Let’s try this again. On my laptop I ran this:
rsync -avz --exclude=.cache user@SOME.IP.ADDRESS.04:/home/user/ ~/postmarket-os-backup
Ok that worked!
The postmarketOS wiki recommends that I use tmux or screen to update the pinephone, in case the ssh connection breaks. Well I believe that I have tried updating the pinephone before using just an ssh connection, and the ssh connection dropped. I did not know if they phone was done updating or if it had just died. So I forcefully shut off the device, and it failed to boot. Fun times.
Well let’s go ask in the postmarketOS irc channel or matrix and ask about using tmux or screen. How does it make sure that the ssh connection does not break? I can also check out the archlinux wiki. Also it seems as if tmux is more user friendly, so I will check out the tmux page to learn more about it.
Well let’s go ahead and install tmux on my laptop: guix install tmux
.
Let’s try to run an ssh connection on the pinephone via tmux. I think this is how you do it:
tmux
ssh user@<IP address of the pinephone>
Well I asked in the postmarketOS irc channel why they reccommend using tmux in case the ssh connection drops, and this is the answer that I got:
if you use tmux, you can just restore your tmux session if the ssh connection drops and the command will still be running in there
run tmux then if the connection drops tmux list-sessions and then tmux attach-session I think
Then if the ssh connection gets dropped, I can open up a new terminal and do
this tmux attach
, and I will be right back where I was. This video explains
that. That is pretty awesome!
Here are some tmux resources.
Next, I ran the following to update the pinephone:
tmux
ssh user@<my Pinephone IP address>
postmarketos-release-upgrade
Since, my phinephone had an ethernet connection, the upgrade process was over inside 5 minutes, and the phone rebooted itself. Nice work postmarketos developers!