Categories
Tutorial Ubuntu Touch

Flashing Ubuntu Touch to your Pinephone’s EMMC memory

You might have already read my first round of ‘flashing 101’ when I successfully flashed Ubuntu Touch to and SD card making it possible to boot the Pinephone that way with Ubuntu Touch. That first blog is a bit more messy because I was learning so in fact, this post here might also help you with flashing to an SD card as it should be more clearly written. If I had more time I’d clean them both up but I don’t so yeah…

The next step in my learning is to figure out how to flash / copy ubuntu touch onto the pinephone’s EMMC (built in) memory. This should make it run faster. There wasn’t a step-by-step that I could find and so I guess I have to write it. Nice folks in the pinephone telegram group said that I would follow a similar method as flashing to the SD card (see my detailed step-by-step on that here so that hopefully is true. Let’s try…

1. Plug in your Pinephone

Unlike my other tutorial, you’ll need the device plugged into your production machine from where the image will be coming.

2. Get latest image

Choose the latest Pinephone image from this page. I choose stable usually but as of today ‘stable’ is a figment of our imagination 🙂 Save it somewhere memorable and probably smart to put it in a dedicated directory so you can run commands more simply and safely. I just realized there is a bmap file sitting with this image download on this page. This could be useful and relevant soon as you read on…

3. Get setup with BMAP

You can just follow my detailed blog if you’d like. If you don’t know what it is, then you probably want to do this.

4. Confirm the source of your ubuntu-touch-pinephone.img.xz file

The file you downloaded in step 2 above which you have on your computer. In my case it’s going to flash from my download directory in my dedicated ‘pinephone_flashing’ directory so mine looks like this:

~/Downloads/pinephone_flashing/ubuntu-touch-pinephone.img.xz

5. Put Pinephone into ‘Yumi Mode’

I didn’t know what else to call this so I named it ‘Yumi Mode’ since that’s the name of the UBports Robot Mascot… I tried to simply plug in the pinephone and do this work but it won’t recognize anything. Thankfully I had read some other tutorial about how to get into this mode. Here’s how

a) Assure device is powered off (you can push / hold power button for about 5 seconds)
b) Press / hold power and volume up buttons together for about 6 or 7 seconds.

If successful, you should start to see a trainload of partitions start to load in your file manager (Nautilus).

6. Identify the destination path to the EMMC

If you’ve done my other blog where you install Ubuntu Touch to the SD card this time we’ll do the same thing but point the destination to the EMMC memory.

  • Hit the super key to the left of the space bar
  • Type ‘disks’ to open the ‘Disks’ utility. You should now see two items related to UT in the left pane of the ‘Disks’ app:

‘Drive | JumpDriv e microSD’

and

‘Drive | JumpeDriv e eMMC’

  • Click the ‘Drive | JumpeDriv e eMMC’ on the left pane
  • Take the path from the ‘Device’ path. In my case it looks like this “Device dev/sdc” but yours can – and very possibly will be – slightly different in the last letter. You can actually just highlight it and copy it from there

path: /dev/sdc

This is a great way to visually identify and confirm which mount point is your eMMC which will help you quickly deal with unmounting stuff in the next section

7. Unmount the partitions on the eMMC drive

If the drive is ‘fully ejected’ by Ubuntu, you will probably get this error when you run the final flashing command:

bmaptool: ERROR: cannot open destination file ‘/dev/sdc’: [Errno 123] No medium found: ‘/dev/sdc’

A reboot of the device again and putting it into ‘Yumi Mode’ again might fix it for you if you are lucky – once this worked for me – but that was it. I do not believe this can be done reliably and thus you should proceed with the command line method. It’s really not that hard if you work together with the Disks utility.

The reason why the ‘eject’ button in File Manager (Nautilus) doesn’t work for this purpose is because ‘it uses udisks ctl which both unmounts and ejects the partition’. We only want unmount, not eject, you see. So, we must ‘terminally unmount’ these as follows:

First, run the mount command which will show you (truthfully) what drives are (actually) mounted on the system. For me these were all located at the very bottom of the terminal output list.

You can, however, in the Disks utility, click through each partition and see at the bottom ‘mounted’ or ‘not mounted` or ‘unkown’ and compare against the terminal output to gain further confidence that you are unmounting and flashing to the right place. The Pinephone image has a mixture of all of these, it seems, so probably better to just manually unmount everything with the terminal. It’s really easy once you identify the actually-mounted drives you just run:

sudo umount /dev/sdc2' sudo umount /dev/sdc4′
etc
etc

**Tip **: If while running the final flashing commands you get this error:

bmaptool: ERROR: the image file ‘/home/wt/Downloads/ubuntu-touch-pinephone.img.xz’ has size 826.3 MiB and it will not fit the block device ‘/dev/sdc3’ which has 1.0 KiB capacity

You are probably writing to a partition like I did instead of the actual device. You probably put in /dev/sdc3 instead of /dev/sdc as an example.

8. Run the flashing command

This assumes you have alread set up and read and understand my blog above.

Format:

sudo bmaptool copy --bmap ~/path/where/your/bmap/file/is/located /path/where/your/image/is/located /path/to/memory/device

My actual example:

sudo bmaptool copy --bmap ~/Downloads/pphone.bmap ~/Downloads/ubuntu-touch-pinephone.img.xz /dev/sdc

Worked for me! Hope it works for you too 🙂

Categories
Technology Tutorial Ubuntu Touch

How to do an Ubuntu Touch Video Screen Cast Recording

Making a video screen cast of your Ubuntu Touch (“UT”) device is a bit difficult as of the date of this blog post, however, thankfully, there is a way to do it with a bunch of scary terminal commands.

This is pretty technical, but is probably the only way (for now) to do this. Special thanks to Amolith who forwarded to Joe (“in here”) who then forwarded it to me. The power of free software communities at work!

First, I’ll just give you the commands in case you are already familiar enough with terminals and commands. Then, I will provide detailed how-to to follow.

Record a big raw video file in interesting .raw format

EDIT 20/06/21
This first command has been updated to reduce ‘terminal weirdness’. Now it works quietly in the terminal. Special thanks to Rodney for that excellent improvement.

adb exec-out timeout 120 mirscreencast -m /run/mir_socket --stdout --cap-interval 2 -s 384 640 > ubuntu_touch.raw

Convert it to ‘normal’ format (mp4) with ffmpeg tool

ffmpeg -f rawvideo -pix_fmt rgba -s:v 384x640 -i ubuntu_touch.raw -filter:v "setpts=2*PTS" ubuntu_touch.mp4

I plan to give a few more how-to details next by editing this blog post but for now I at least wanted it logged somewhere where myself and others can easily find it.

Enjoy

Tutorial – How to actually do it.

Before you begin

I would recommend creating a directory / folder just for doing this stuff. Then, you will navigate in your terminal to this directory. That makes sure that all the video is dumping in a place where you’ll be able to find it and work with it easier. Otherwise, your terminal might autonomously dump it an undesired location (your Home directory if you left everything default…). Once you have created this directory, navigate to it with the terminal’s ‘cd’ command. If you don’t know how to do that, take a few minutes to search and learn? It’s a good life skill and you can brag about it at the coffee machine or water cooler…

Now that you have the scary command line codes above ready to copy and paste, here’s how you do it and what to expect.

First, you’ll have to make sure you have adb setup on your ‘production machine’ (the machine that is recording the Ubuntu Touch output video. You should be ok to just do the usual sudo apt install adb and then perhaps you’ll need to be in ‘Developer mode’ to do all this. You might find that your system already has adb. If so, it will tell you that your version is up to date, etc and you can continue. If you need either of these or find it’s not working right, this blog has a lot of good info in one place. Most should be current still at the time of this post.

Next, plug in your UT device and get ready to record. Probably a quick test video is wise, by the way, before you start recording a long meaningful video.

Next, run the first command above by copying/pasting into your terminal. You will see this (or something very similar) in the terminal. Just pretend this means “your raw video is now recording to your production machine” because that’s what’s happening even though you can’t see it:

daemon not running; starting now at tcp:5037

daemon started successfully

When you are done recording, go back to your terminal and press ‘control C’ in to stop the process. You will see absolutely nothing except your ^C. Just pretend this means ‘Your raw video file has now stopped recording and is sitting in the directory where you started it”.

Finally, you’ll need to convert the raw video to a human-usable format – and probably mp4 is what you’re looking for which is why the above command is setup the way it is. Note that if you want to do any other million different things with your video work, you could study the power of ffmpeg and do whatever you like with formats, resolutions, etc, etc….

Now, in your terminal after you run the converting command, you are going to see a lot of ‘stuff’ in your terminal. I’m not going to even paste it here because there is so much. I’m also not going to pretend I know what any of of it means. Just be aware this is ‘normal’.

Once complete you should now have a .raw video and a .mp4 video in your screen casting directory.

Double click your .mp4 file to make sure it’s working and enjoy your new Ubuntu Touch video screen recording.

Categories
Tutorial Ubuntu Ubuntu Touch

Flashing Ubuntu Touch onto SD Card for Pinephone Braveheart Installation

EDIT 20/06/19
I have done a fairly extensive post about how to use BMAP properly so here is a link to my post. You should probably read this to know that the true benefits of speed from Bmap tools comes from following the instructions in my other blog. Otherwise, you might as well just use ‘dd’ or other flashing techniques. Bmap is indeed faster!

EDIT: 20/06/14

I tried with Etcher and had problems booting (not sure this was actually the cause) so now I’m trying with a tool recommended bmap-tools by someone in the Pinephone Telegram group. This tutorial includes instructions for getting set up and using this bmap tools tool.

This tutorial assumes you are running Ubuntu on your desktop/pc/laptop…

It’s a command line tool, it seems so yeah. No GUI. Hopefully my commands and instructions will remove the CLI mystique…

Apparently bmap-tools also automatically unzips/uncompresses your ubuntu-touch-pinephone.img.xz image as well, so you don’t have to do that step before.

  1. Get Ubuntu Touch image currently here
  2. Install to ubuntu: sudo apt install bmap-tools
  3. Confirm the source of your ubuntu-touch-pinephone.img.xz file which you have on your computer from this instructional page your source and destination addresses. In my case it’s coming from my download directory and going to my SD card so my source location looks like this:

~/Downloads/ubuntu-touch-pinephone.img.xz

  1. Confirm the destination path of your SD card. This step is important because if you goof this you risk (probably) writing your image to the wrong drive and killing it. How I do this is
    a) Hit the super key to the left of the space bar
    b) Type ‘disks’ to open the Disks utility
    c) Click my SD card on the left pane (graphically)
    d) Take the path from the ‘Device’ path. In my case it looks like this “Device dev/mmcblk0p1” You can actually just highlight it and copy it from there
  • path: /dev/mmcblk0

Important note on this last step: I had a lot of annoyances in the terminal related to ‘memory errors’ and it was because I had copied the entire item. In my case it looked like this: mmcblk0p1. Make sure that you do not have anything like ‘p1’ or ‘p2’ on the end of your destination path. These are for ‘partitions’ and is the incorrect path. should be just : /dev/mmcblk0not something like this –> /dev/mmcblk0p1. If you run it with the latter you will get those memory errors like me.

Just to leave it as reference the errors caused by the mistake above look like this:

bmaptool: info: no bmap given, copy entire image to '/dev/mmcblk0'
bmaptool: WARNING: failed to enable I/O optimization, expect suboptimal speed (reason: cannot switch to the 'noop' I/O scheduler: [Errno 22] Invalid argument)
/
bmaptool: info: synchronizing '/dev/mmcblk0'
bmaptool: info: copying time: 17m 13.1s, copying speed 13.5 MiB/sec
  1. Run the command
    Pre-cautionary step 1: remove all external drives before doing any of this.
    Pre-cautionary step 2: Other tutorials I read did not explain that you should unmount your drive before beginning. So in your Nautilus just go through and ‘eject’ anything showing up as ‘ejectable’.

As a reference, this tutorial was helpful for tool usage but still not quite clear enough so I’ll go even slower…

EDIT 20/06/14 – Apparently this next bit of my advice is bad and slows down the process. Apparently you should just make sure you run the command in the same directory as the image, and then it will work faster and without the need for the –nobmap tag. I will leave this here as a reference just in case you need it but as of today it was advised to not follow it:

—-

With bmaptool when you are doing straight flashing you can just add the --nobmap tag to the command, which I think means ‘just do this thing without routing through other specific instruction file’. So that’s what I’m going to do.

—-

I am still not 100% sure if this step is required, but it helped me so I’m leaving it as a reference: I also got some ‘no space left on device’ errors so I decided to first format the drive with Disk tools before trying again. I did this by opening the ‘Disks’ graphical utility again by clicking the SD card I wanted to format and then selecting ‘format disk’ from the top right hamburger menu. Takes about 2 seconds to wipe whatever is on there… after doing this step everything finally started working better. I created a linux ext4 partition next to see if that helped. I made the first partition with 21GB (for the image) and then a trailing 10GB for ‘whatever’. These were just choices I made thinking that I could maybe use the trailing 10GB for phone storage.

Here are, therefore, the steps, assuming you have done all of the above:

  1. Open the terminal
  2. Make sure you have navigated (with terminal commands) to the directory where your image is
  3. Type the following command replacing the source and path with whatever is correct from your device as per instructions above:

bmaptool -E copy /path/to/ubuntu-touch-pinephone.img.xz /path/to/SD/card

My example that finally worked looked like this for your reference:

sudo -E bmaptool copy ~/Downloads/ubuntu-touch-pinephone.img.xz /dev/mmcblk0

Boot it

Apparently just inserting the SD card and turning the power on should do it, but yeah. Depends on a ‘few things’ as to whether this will be your experience 😉

This was actually harder than I thought. I’m not sure if this was the cause of my pain but I’m going to list it anyways. I had to do about 100 reboots and it still wasn’t working. I couldn’t seem to get past the ubuntu purple splash startup screen. I ‘think’ I had interrupted a process the first time so i did all of the above steps againb but this time I held down the power button until the green indicator light came on and then everything started as expected and I was able to start using Ubuntu Touch. Members of the community indicated it may be related to a faulty build and to try other build numbers to see if that helps. We shall see.

Issues flashing cards

I had an interesting issue where I couldn’t unmount a card. System said ‘not mounted’ when I tried umount command. Amazingly, just a reboot of computer allowed the ‘Disks’ utility to start working again as normal. Others were reporting that one should consider using gparted tools instead of Disks utility just as another related tip if you are interested.

I hope this helps and have a great day

Resources

Pinephone images for Ubuntu Touch here

How to telnet into the device here

My bmap tools tutorial here

Categories
PrestaShop Technology Tutorial

Fixing PrestaShop child theme upload fail

Just a quick post. To be totally honest, I haven’t had time to investigate if this is a filed bug or not, but I’m going to post this here to save others some headaches and also hopefully serve as a reference link for someone else if they want to file the bug officially (sorry, my bad).

I tried to upload a child theme in the prestashop theme section but kept getting this message in the ‘upload child theme’ feature:

Oops… Upload failed.
What happened?
Try again

However, when I clicked the ‘what happened’ link it only told me that the file wasn’t valid (in this case I was uploading a .zip which it instructed me to do) so the file was valid.

To make a long story short, what I had to do to get it working was this in the Theme & Logo / Advanced Customization area:

  1. Switch back from my already-uploaded first-attempt child theme to the original parent theme
  2. Delete my first child theme upload attempt with same name
  3. Upload the new Child theme

If I’m correct in my assumption that the ‘technical name’ of my first uploaded theme is conflicting with the new upload attempt, this should be clearly laid out in the upload area and a few other areas so that the user knows ‘ah! i should delete any conflicting child themes first!”

Again, I haven’t tested this more than twice but hopefully this helps the devs and some users

Categories
Life Skills Technology Tutorial

How to Import Shopify Data into Prestashop with CSV

Brutal. I spent probably 3 hours trying to figure this out so I thought I should spend about 10 minutes and write this quick blog post for anyone else who might hit this.

I was testing out Prestashop (looking good so far!) and the aim was to move a new shopify account over to Prestashop to see how it goes.

First thing I did was had the Shopify product data exported as .csv file.

Next I followed the instructions on the documentation page for importing into Prestshop. Unfortunately, though, there seemed to be no detailed instructions about how to set up data. I think this is because there are a lot of migration companies that make some cash doing this so fair enough.

Anyways, what I did was opened up both Shopify .csv and Prestashop demo .csv for products and noticed that they both have different data separator formats.

Shopify uses commas whereas Prestashop uses semi colon.

So, all I had to do was manually type in a comma into the field that says ‘Field Separator’ in the Prestashop import module and everything started working and I could start mapping the fields and database tables as expected and as explained in documentation.

Hope this tiny, one second tip helps you save 3 hours and some cash.