#+TITLE: Installing Mobian on PinePhone #+SHORT-TITLE: mobian #+TOC-KEYWORDS: PinePhone #+KEYWORDS: PinePhone, Mobian #+DESCRIPTION: Mobian on PinePhone #+BEGIN(menu):left [[toc][]] #+END * Related pages - [[https://wiki.mobian.org/][read about mobian]] - [[pine][PinePhone is not a phone]] * Installing mobian I assume that we have [[pine][Manjaro running]] on our PinePhone and we have connected it to a /normal/ computer so we can use /normal/ keyboard and /normal/ screen. Also I assume that we have an SDHC card installed in the phone, and we want to install [[https://wiki.mobian.org/][mobian]] onto this SDHC card. In order to install [[https://mobian-project.org/][mobian]], we need to copy one of [[https://wiki.mobian.org/doku.php?id=install-linux][pre-built images]] to the SDHC card inside PinePhone. #+BEGIN(src) shell time bmaptool copy https://mobian-image.img.gz /dev/mmcblk0 #+END where [[src:mobian-image.img.gz]] should be replaced by the actual (long) address of the image. After that, if we are lucky, we can reboot from Manjaro into Mobian. Mobian creators (used to) produce daily images, and not all of them are going to work. In case the image does not work, I pull the SDHC card out of the PinePhone, insert it into my desktop and run #+BEGIN(src) shell dd if=/dev/zero of=/dev/sdX bs=8k seek=1 count=4 #+END where [[src:/dev/sdX]] is the name of the SDHC card on the desktop. * Small SDHC card Suppose we use a 16gb SDHC card. Before running [[src:bmaptool]] its partition table was #+BEGIN(src) shell fdisk -l /dev/mmcblk0 Disk /dev/mmcblk0: 14.73 GiB, 15819866112 bytes, 30898176 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 * 2048 30898175 30896128 14.7G c W95 FAT32 (LBA) #+END Then, after running [[src:bmaptool]] it was changed to #+BEGIN(src) shell fdisk -l /dev/mmcblk0 Disk /dev/mmcblk0: 14.73 GiB, 15819866112 bytes, 30898176 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x3b1d2aeb Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 * 16384 1048575 1032192 504M 83 Linux /dev/mmcblk0p2 1048576 7421874 6373299 3G 83 Linux #+END We see that most part of the SDHC is now unused. I do not remember how did I fix this problem, probably I've just extended the second partition, please [[mailto:oleg@chalaev.com][share your experience]]. * Problem with large SDHC card In 2021 I had problems with starting Mobian on a larger (256gb) SDHC card. When booting into fresh-new Mobian, first I saw a message "resizing file system during initial boot". Then I got thousands of messages like #+BEGIN(src) shell [migrate_block: 56] Migrate node block XXXX -> YYYYY #+END for about 2 minutes. After that: #+BEGIN(src) shell Not enough spase to migrate blocks Try to do defragment: Skip [migrate_main: 199] Info: Done to migrate main area: main_blkaddr = 0x2200 -> 0x2d400 [migrate_ssa: ...] ... [migrate_nat: ...] ... [migrate_sit: ...] ... .... mounting /dev/mmcblk0p2 on /root failed: Structure needs cleaning #+END Then I receive several more alarming (at the level of panic) messages, and the system freezes. * Vague: how did I fix it Preparing SDHC card on desktop: #+BEGIN(src) shell wget https://mobian-image.img.gz time ( zcat mobian-image.img.gz | dd bs=64k of=/dev/sdX status=progress ) #+END After that the partition table is #+BEGIN(src) shell fdisk -l /dev/sdX Disk /dev/sdX: 238.8 GiB, 256355860480 bytes, 500695040 sectors Disk model: Card Reader Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x72b2302e Device Boot Start End Sectors Size Id Type /dev/sdX1 * 16384 1048575 1032192 504M 83 Linux /dev/sdX2 1048576 7421874 6373299 3G 83 Linux #+END where (ext4-formatted) [[src:/dev/sdX1]] contains #+BEGIN(src) shell System.map-5.10-sunxi64 config-5.10-sunxi64 dtb-5.10-sunxi64 extlinux initrd.img-5.10-sunxi64 lost+found vmlinuz-5.10-sunxi64 #+END and [[src:/dev/sdX2]] is almost (96%) full. As far as I remember, I [[https://forum.pine64.org/showthread.php?tid=13461&pid=93846#pid93846][followed this advice]] doing "resizepart 2 50%", "resizepart 2 90%". "resizepart 2 100%" in [[src:parted]]. * First steps in fresh-new Mobian #+BEGIN(src) shell apt-get --no-install-recommends -y install aptitude aptitude install screen #+END