Reflashing to switch from defaultuser to nemo?

I have an XA2 with nemo which I use almost entirely via SSH.

And I have a 10 III with defaultuser, which is impossible to send SMS via SSH with;

I want to have a backup of my nemo setup, is this basically impossible now? Is it possible to flash the old 3.0 Sailfish and get nemo on to a second-hand XA2? Does the hardware even matter, are there any restrictions on which hardware can be flashed with old images, and are they even available?

Basically, how does one get hardware that can run nemo these days?

I found this topic, and tried the advice from @decon once, but it went badly and I just flashed back to defaultuser.

  1. Rename homedir and add symlink (just in case)
devel-su
cd /home
mv defaultuser nemo
ln -s nemo defaultuser
  1. Search for all files in /etc containing defaultuser
grep -sIR defaultuser /etc/
  1. For each file found replace defaultuser with nemo
sed -i 's/defaultuser/nemo/g' <file_name_here>

If a file is read only then set write permissions first (and restore them afterwards)

chmod u+w <file_name_here>
sed -i 's/defaultuser/nemo/g' <file_name_here>
chmod u-w <file_name_here>
  1. Reboot phone
reboot

I can try again, but would love to just grab a Gemini or XA2 if it is possible to flash straight to something with nemo.

Any tips very welcome…

1 Like

Sailfish OS 4.x: How to revert the default user account from defaultuser to nemo

This example uses a VMWare installation of Alpine Linux to modify the flashable SailfishOS image.

I used Alpine because it’s the go-to distro for small virtual systems (docker images use it extensively), and as such rather quick to set up.

If you already have a Linux system, you can skip most of part 1, but will have to make sure the tools are installed from your distro packages.

Part One: set up the Linux environment:

1. Install Alpine Linux in VMWare

  1. Create new VM, ~1G RAM, 2 CPUs, minmimum 3GB Disk, NAT networking
  2. Boot from install ISO
  3. run setup-alpine
  4. follow the wizard
  5. when asked about the disk type, choose sys
  6. finish wizard
  7. reboot

2. add community repo in /etc/apk/repositories

http://dl.alpinelinux.org/alpine/v3.15/main
http://dl.alpinelinux.org/alpine/v3.15/community
#http://dl.alpinelinux.org/alpine/v3.15/testing

3. install VMWare tools

apk update
apk add open-vm-tools
apk add open-vm-tools-guestinfo
apk add open-vm-tools-deploypkg
apk add open-vm-tools-hgfs

4. mount shared folders

/etc/fstab:
vmhgfs-fuse    /mnt/vm    fuse defaults,allow_other 0 0

5. extract sailfishos.img001 to VMWare shared folder

6. mount shared folder

modprobe fuse
mount /mnt/vm

7. add android and image tools

apk update
apk add util-linux
apk add util-linux-misc
apk add multipath-tools
apk add lvm2
apk add android-tools

Part Two: convert and mount the image

1. convert image

simg2img /mnt/vm/sfos/sailfishos.img001 /var/tmp/sailfishos.img
losetup -f /var/tmp/sailfishos.img

2. mount SFOS LVM partitions

lvscan
kpartx -a -v /dev/loop0
mkdir -p /mnt/sailfishos/root
mkdir -p /mnt/sailfishos/home
mount /dev/sailfishos/root /mnt/sailfishos/root

Part Three: manipulate the image contents

1. Find defaultuser references on image

grep -a -r defaultuser /mnt/sailfishos/root/ 2>/dev/null

# just to make sure it isn't actually in the image
grep defaultuser  /mnt/sailfishos/root/etc/passwd
grep defaultuser  /mnt/sailfishos/root/etc/group
grep 100000  /mnt/sailfishos/root/etc/passwd
grep 100000  /mnt/sailfishos/root/etc/group

List of files:

  • MOUNT_ROOT/usr/lib/startup/start-autologin ← that’s the main one
  • MOUNT_ROOT/etc/connman/connman-vpn.conf
  • /var/lib/rpm/Packages ← ignore this, harmless
  • /usr/lib/libsepol.so.1 ← ignore this, harmless

2. change files

Use your favourite editor to change the references to your preferred user account.

Part Four: convert image back to flashable sparse image:

umount /mnt/sailfishos/root
losetup -d /var/tmp/sailfishos.img
img2simg /var/tmp/sailfishos.img /var/tmp/my_sailfishos.img

Part Five: flashing

  1. Enter your “flashing” folder (extracted Release zip with Sony Binaries .img added)
  2. Copy the new image over the original sailfishos.img001
  3. execute md5sum sailfishos.img001
  4. open md5.lst in a text editor
  5. replace the MD5 sum part in md5.lst
  6. save md5.lst
  7. execute the flashing script as usual
4 Likes

The above is something I wrote some time ago. No guarantees.

That being said, if your only issue is sending SMS, perhaps you should fix the method of sending SMS as defaultuser rather than all that nemo conversion stuff.

Because that sounds like a classic X-Y Problem.

2 Likes

(a) Thanks for the great walkthrough and (b) yes, this is an X-Y problem, and I guess the easy way is to sort out defaultuser’s permissions with the radio group.

Embarrassingly found my own post about a solution to this, which I had forgotten about…

1 Like

Take a look at abransons post here:

2 Likes

I have taken the liberty to rename the title of this topic.

2 Likes