OESF Portables Forum

Model Specific Forums => Cosmo Communicator => Cosmo Communicator - Linux => Topic started by: mibry on November 05, 2020, 02:13:16 am

Title: Ubports for Cosmo
Post by: mibry on November 05, 2020, 02:13:16 am
There has been quite a bit of work on a ubports port for the cosmo.
To install ubports on the cosmo you will need linux installed, I will not explain that in this post as there are instruction on Planets website.

Download the latest flashable zip file (Will be named artifacts.zip) from https://gitlab.com/ubports/community-ports/android9/planet-cosmocom/planet-cosmocom/-/pipelines.
Unzip artifacts.zip, 2 files will be unziped to a new folder call "out". The files will be called rootfs.img and boot.img.
cd to the out folder and move the rootfs.img file to / and rename it to ubuntu.img
next flash the boot.img to one of the free boot slots using the following command "dd if=~/out/boot.img of=/dev/disk/by-partlabel/boot4 <- the last part will need to be changed to reflect you boot slot.

Next reboot and select the boot slot with ubuntu touch. Then follow the setup instructions.

Thanks go to @TheKit for working on Ubports for cosmo.
Title: Re: Ubports for Cosmo
Post by: idc on November 05, 2020, 06:23:44 am
Thanks for the update. I shall try and give this a go when I have some spare time. Can you report on what currently is and isn't working?
I'm sure I'll not be alone in welcoming any reviews and comparisons anyone would care to make between Ubports, Planet's Linux, and Sailfish OS. (Years and years ago I backed Ubuntu's Kickstarter — or was it Indiegogo — in the hope I'd get a decent Linux phone; perhaps the Cosmo will eventually be it.)
Thanks very much.
Ian
Title: Re: Ubports for Cosmo
Post by: oida on November 05, 2020, 02:00:08 pm
I have rooted android and gemian on my cosmo. do I need to overwrite gemian or can I flash in the free recovery slot? (boot2)
tia
Title: Re: Ubports for Cosmo
Post by: mibry on November 05, 2020, 07:46:07 pm
I don't believe it is a good idea to use recovery slot 2. From what has been said on the telegram group is that slot 2 does not have access to the modem. Someone on the telegram group created a script to change the boot images between Sailfishos, Gemian and Ubports using the Planet recovery install custom OS option. I will see if I can find it and post it here.
Title: Re: Ubports for Cosmo
Post by: oida on November 06, 2020, 11:38:42 am
thx for the hint and saving me trouble.
afaik I only have two full partitions: android and linux. So I guess I need to delete eighter android or gemian for trying ubports?
Title: Re: Ubports for Cosmo
Post by: Piece_Maker on November 06, 2020, 02:53:56 pm
The UBPorts image resides in the same main partition as Debian, so you don't need to delete either. The bootloader has extra boot options, and by using my script (attached) on your Cosmo alternative OS installer SD card thing you can flash the UBPorts boot.img to one of these boot options and essentially triple-boot Android, Debian and UBPorts. 

You'll also need to put the boot.img on your SD card in the same folder and change its name to 'ubports-boot.img' for my script to work, and also add this: 

Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE 

To the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line) and, as noted above, put the ubuntu.img file in the root directory of your Gemian install. Now boot to recovery with the SD card inserted and install UBPorts to another boot partition of your choice (But not the second one, as noted above there's no networking there!)

I've found the UBPorts image to be the most fleshed-out alternate OS yet - the camera works, keyboard layout works, 4G works, Bluetooth works  8)
Title: Re: Ubports for Cosmo
Post by: oida on November 13, 2020, 08:27:29 am
tried it now: looks quite promising, still alpha, keep the superb work, thx so far.
It did overwrite Gemian though, even I used the script. No problem since both are not usable at the moment:
In ubports: Network (wifi) only works once after reinstalling. After a standby it cannot find any more networks, even after a reboot.
Phone does not work, cannot connect to any carrier / resolving carriers does not work. Mobile data also does not work.
Trying OTA results i  rebooting to fastboot.
 
Title: Re: Ubports for Cosmo
Post by: soCket23 on November 21, 2020, 11:29:24 pm
The UBPorts image resides in the same main partition as Debian, so you don't need to delete either. The bootloader has extra boot options, and by using my script (attached) on your Cosmo alternative OS installer SD card thing you can flash the UBPorts boot.img to one of these boot options and essentially triple-boot Android, Debian and UBPorts. 

You'll also need to put the boot.img on your SD card in the same folder and change its name to 'ubports-boot.img' for my script to work, and also add this: 

Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE 

To the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line) and, as noted above, put the ubuntu.img file in the root directory of your Gemian install. Now boot to recovery with the SD card inserted and install UBPorts to another boot partition of your choice (But not the second one, as noted above there's no networking there!)

I've found the UBPorts image to be the most fleshed-out alternate OS yet - the camera works, keyboard layout works, 4G works, Bluetooth works  8)

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

next flash the boot.img to one of the free boot slots using the following command "dd if=~/out/boot.img of=/dev/disk/by-partlabel/boot4 <- the last part will need to be changed to reflect you boot slot.

I was thinking about adding that line if code into the UBports-cosmo-installer.sh, loooking at the other installers I feel like that was the missing piece. buuuuut I am not code savvy enough to just through it in and hope for the best. also I think it needed edited a pinch to pull from the righ locations and the syntax seemed off.. I wish I could just image the whole device onto an extraneland the start from scratch , but I need another SD card for that. I'll let you know. WOuld love feedback on  my theory.


AND ITS STUCK. Opening terminal, going through some sort of instruction/show of features and the screen won’t swipe to keeping moving through it.
Title: Re: Ubports for Cosmo
Post by: Piece_Maker on November 22, 2020, 05:39:20 pm

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.
Title: Re: Ubports for Cosmo
Post by: oida on November 23, 2020, 09:38:42 am

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.

You have no rooted Android.
I have and as long there is no AOSP android image from Pl. Co .I have to stay rooted for security reasons (blocking google etc)
So eighter Debian or UBports.
Both are not usable as a daily driver, nor is Android because of old security patches and issues.
Title: Re: Ubports for Cosmo
Post by: MonkeyControl on November 24, 2020, 05:04:36 pm
Wow, thanks for this, much appreciated.  This is great for the Cosmo. 
I been using UBPorts as a daily driver (on PinePhone), it's such a nice OS, and the UI is so slick. 
Now my Cosmo (which got parked after I damaged the CoDi, and repair looked unlikely under lockdown), will get its repair and may well get the sim card back. 
I got it installed and working last night, see photo of PinePhone and Cosmo both running UBPorts. 
Well impressed. 
Title: Re: Ubports for Cosmo
Post by: Piece_Maker on November 28, 2020, 07:30:05 pm

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.

You have no rooted Android.
I have and as long there is no AOSP android image from Pl. Co .I have to stay rooted for security reasons (blocking google etc)
So eighter Debian or UBports.
Both are not usable as a daily driver, nor is Android because of old security patches and issues.

I don't think I ever claimed to have rooted Android, though I guess I could put it into my TWRP partition as that's next to useless anyway, it'd lose modem functionality though. The only way I've found to have additional 'slots' on the bootloader is to just manually re-install the rooted Android boot option from the SD card which is obviously a bit rubbish. It'd be nice to have two more slots on the bootloader, for rooted Android and Sailfish OS too, but I don't see how that's possible!
Title: Re: Ubports for Cosmo
Post by: asyik on December 21, 2020, 08:04:29 am
Please help.

I cant seem to get the UBports installed successfully.

This is what i did.

1) Add to the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line)
Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE
So it looks like this
Code: [Select]
#!/system/bin/sh
PARTED="/sbin/parted_static"
MBF="/sdcard/cosmo-customos-installer"
LS="/system/bin/ls"
OUTPUT="/tmp/output.txt"
PARTITION_FILE="/tmp/part_name.txt"
INSTALLER_FILE="/tmp/installers.txt"
ERROR="/tmp/error.txt"

echo "Detect Installers..." > $OUTPUT

log () {
echo -n "$1 " >> $OUTPUT
}

execute() {
log "Running \"$1\""
R=$($1 2> $ERROR)

if [ "$?" -eq "0" ]
then
log "OK\n"
else
log "ERROR: `cat /tmp/error`\n"
fia
}

part_name() {
PART=`$PARTED /dev/block/mmcblk0 p | grep "$1   " | awk '{ print $5 }'`
if [ $PART = "ext2" ] || [ $PART = "ext4" ]
then
$PARTED /dev/block/mmcblk0 p | grep "$1   " | awk '{ print $6 }' >> $PARTITION_FILE
else
echo $PART >> $PARTITION_FILE
fi
}

# Write installer list in $INSTALLER_FILE
# Format: Name,Installer file
echo "TWRP,$MBF/Cosmo_Installer_TWRP.sh" > $INSTALLER_FILE
echo "Debian KDE/Plasma,$MBF/Cosmo_Installer_Debian_kde.sh" >> $INSTALLER_FILE
echo "Rooted Android,$MBF/Cosmo_Installer_Rooted_Android.sh" >> $INSTALLER_FILE
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE

# Write partition list in $PARTITION_FILE
# Format: partition_name
#   partition_number  (partition name followed by \n followed by partition_name)
rm -f $PARTITION_FILE
part_name 38
part_name 41
part_name 42

2) Download artifacts.zip from https://gitlab.com/ubports/community-ports/android9/planet-cosmocom/planet-cosmocom/-/pipelines.

Unzip artifacts.zip

rootfs.img --> renamed to ubuntu.img
boot.img   --> renamed to ubports-boot.img

3) Download Cosmo_Installer_UBPorts.sh

Add this at the bottom of the Cosmo_Installer_UBPorts.sh file.
Code: [Select]
# Install root image into partition 43
execute "$DD if=$MBF/ubuntu.img of=$LINUX_ROOTFS bs=1m"

so it looks like this

Code: [Select]
#!/system/bin/sh
PARTED="/sbin/parted_static"
DD="/system/bin/dd"
MBF="/sdcard/cosmo-customos-installer"
BOOT_PARTITION="/dev/block/mmcblk0p"
LINUX_ROOTFS="/dev/block/mmcblk0p43"
OUTPUT="/tmp/output.txt"
ERROR="/tmp/error.txt"

echo "Installing UBPorts..." > $OUTPUT

log () {
echo -n "$1 " >> $OUTPUT
}

execute() {
log "Running \"$1\""
R=$($1 2> $ERROR)

if [ "$?" -eq "0" ]
then
log "OK\n"
else
log "ERROR: `cat /tmp/error`\n"
fi
}

# Installing boot image into user-selected boot partition
execute "$DD if=$MBF/ubports-boot.img of=$BOOT_PARTITION$1 bs=1m"

# Rename partition to specific OS
execute "$PARTED /dev/block/mmcblk0  name $1 UBPorts"

# Install root image into partition 43
execute "$DD if=$MBF/ubuntu.img of=$LINUX_ROOTFS bs=1m"

4) Put the ubuntu.img, ubports-boot.img , list_installers.sh and Cosmo_Installer_UBPorts.sh files and in cosmo-customos-installer directory

5) Boot to recovery with the SD card inserted

6) Install UBPorts to another boot partition  --> this case i chose the last partition

But no luck.

Title: Re: Ubports for Cosmo
Post by: oida on December 21, 2020, 12:20:33 pm

I don't think I ever claimed to have rooted Android, though I guess I could put it into my TWRP partition as that's next to useless anyway, it'd lose modem functionality though. The only way I've found to have additional 'slots' on the bootloader is to just manually re-install the rooted Android boot option from the SD card which is obviously a bit rubbish. It'd be nice to have two more slots on the bootloader, for rooted Android and Sailfish OS too, but I don't see how that's possible!

Off course you didn't, no offence, just a statement.
More boot slots would really be great.

I cannot get my simcard running. Any1 can? or it could be my provider.
Title: Re: Ubports for Cosmo
Post by: MonkeyControl on December 23, 2020, 02:36:19 pm
Quote

I cannot get my simcard running. Any1 can? or it could be my provider.

I got mine running on 2degrees and vodafonenz in NZ, it may be your provider. 
Try looking up your APN settings and having a tinker. 
Title: Re: Ubports for Cosmo
Post by: rulerofthenight on December 24, 2020, 03:37:16 am
Hi
i'm trying to install ubports on my cosmo.
i put the ubuntu.img to the root and used your command to flash the boot to my fourth boot partition.
however, if i choose the 4th boot option, the cosmo just vibrates a couple of times and then reboots.

what am i doing wrong?

thanks
Title: Re: Ubports for Cosmo
Post by: alien2003 on December 27, 2020, 05:17:20 am
Does not work for me too :( Infinite load with Planet logo
Title: Re: Ubports for Cosmo
Post by: sven1999 on January 07, 2021, 07:42:46 am
There is new Wiki page from Adam Boardman about UbuntuTouch on Cosmo: https://github.com/gemian/gemian/wiki/UBPorts
Be careful because it might be unfinished ... If you are brave and try it out, please post your "travel report".
Title: Re: Ubports for Cosmo
Post by: asyik on January 10, 2021, 06:44:49 am
There is new Wiki page from Adam Boardman about UbuntuTouch on Cosmo: https://github.com/gemian/gemian/wiki/UBPorts
Be careful because it might be unfinished ... If you are brave and try it out, please post your "travel report".

stucked at planet logo
Title: Re: Ubports for Cosmo
Post by: tac on January 19, 2021, 03:48:50 pm
I got mine working via these instructions. 

https://github.com/gemian/gemian/wiki/UBPorts

Issues I see so far are Sound related.  When I play music through the any music player it doesn't output any sound.
Title: Re: Ubports for Cosmo
Post by: sven1999 on January 22, 2021, 09:55:53 am
@tac: So you have a stable triple-boot Cosmo now?

For sound, try to plug in and off some head phones. This worked for me under Gemian.
Title: Re: Ubports for Cosmo
Post by: rulerofthenight on January 22, 2021, 07:01:10 pm
ok i managed to install ubuntu touch.
now, how can i update? if i download an updated build and manually try to flash it, it does not seems to work.
OTA won't work neither
Title: Re: Ubports for Cosmo
Post by: mibry on January 24, 2021, 11:37:17 pm
Codi is now working with the latest build of ubports. I have been running it for the last 2 days.

Great work from Notkit and Adam Boardman.
Title: Re: Ubports for Cosmo
Post by: sven1999 on January 25, 2021, 02:45:15 am
Has anybody shared such good news on https://forums.ubports.com/ ? Maybe this will help the adoption of this device. It is not even listed on the device list https://devices.ubuntu-touch.io/
Title: Re: Ubports for Cosmo
Post by: sven1999 on January 25, 2021, 10:15:26 am
I successfully installed the Ubuntu Touch version from 2021-01-22, following https://github.com/gemian/gemian/wiki/UBPorts . Many things are working out-of-box, but not SIM cards. Anyone got a SIM card working?
Title: Re: Ubports for Cosmo
Post by: megastruktur on January 29, 2021, 03:22:00 am
Ok for anyone who also could've have problems with installation  :)

1. Install regular KDE to your Cosmo (https://support.planetcom.co.uk/index.php/Linux_for_Cosmo#Cosmo_Linux_installation)
2. Boot into KDE
3. Download the latest FLASHABLE artifacts (https://gitlab.com/ubports/community-ports/android9/planet-cosmocom/planet-cosmocom/-/jobs)
4. Unzip Artifacts, go to "out" directory and see 2 files.
- Rename "rootfs.img" to "ubuntu.img"
- Rename "boot.img" to "ubports-boot.img"
5. Move the "ubports-boot.img" to your SDCard (put it to the dir with all other scripts)
6. Move the "ubuntu.img" to your "/" directory within KDE (sudo mv ubuntu.img / - like this)
7. Follow these instructions from Piece_Maker: https://www.oesf.org/forum/index.php?topic=36413.msg296947#msg296947

Profit!  :)
Title: Re: Ubports for Cosmo
Post by: tac on January 30, 2021, 03:28:54 pm
Hi, @sven1999 use, I was able to boot into Android, Ubuntu Touch and Linux via the boot screen, All booted ok.  I don't really use the android any more though. 
Title: Re: Ubports for Cosmo
Post by: MonkeyControl on February 02, 2021, 02:11:11 am
Has anybody shared such good news on https://forums.ubports.com/ ? Maybe this will help the adoption of this device. It is not even listed on the device list https://devices.ubuntu-touch.io/
I've made a couple of noises over there, and posted a photo of UBPorts running on my Cosmo.  I'm still having a spot of bother with sms receiving, but apart from that it works very well for me.  It's stable, pretty much does everything I need, and the UI is so nice. 
Title: Re: Ubports for Cosmo
Post by: Piece_Maker on February 03, 2021, 07:30:38 pm
UBPorts definitely lends itself well to a 'half and half' device like the Cosmo! SMS not working is a biggie for me though (Can't even setup Axolotl for Signal without it) and it won't play music via the music player which makes it a bit of a non-starter for me. The content sharing hub is also completely broken which makes a lot of things awkward. 

Really nice OS though and I'll definitely leave it on and watch it mature!
Title: Re: Ubports for Cosmo
Post by: rulerofthenight on February 24, 2021, 08:59:57 am
i already asked this but since i can't seems to find a working way to update the ubports once installed.
i'm stuck with the version i installed first time. if i try to re-flash a new .img the process will end succesfully but then i found the same version of ubuntu touch when i boot.
obviously OTA update is not working neither.
any suggestion?
thanks
Title: Re: Ubports for Cosmo
Post by: sven1999 on February 24, 2021, 10:47:47 am
Mayby a new topic would help? Anyway. Which versions are you talking about? Which flash process do you follow?
Title: Re: Ubports for Cosmo
Post by: dragon788 on September 29, 2021, 12:22:19 pm
i already asked this but since i can't seems to find a working way to update the ubports once installed.
i'm stuck with the version i installed first time. if i try to re-flash a new .img the process will end succesfully but then i found the same version of ubuntu touch when i boot.
obviously OTA update is not working neither.
any suggestion?
thanks

To update if the built in OTA updates aren't working properly, boot to Gemian and download a new `flashable` build from the UBports Gitlab, and then unpack it and overwrite your `ubuntu.img` in the root of the Gemian filesystem, you shouldn't need to rewrite the `boot.img` because the filename and path hasn't changed. This shouldn't affect your data as that should be stored in the `/user-data` folder that is also mapped from the Gemian filesystem (since UBports can see those files as well).
Title: Re: Ubports for Cosmo
Post by: sven1999 on October 01, 2021, 02:34:48 am
Quote
you shouldn't need to rewrite the `boot.img`
Last time I checked, the boot.img files differed between versions. So, better rewrite it?