postmarketOS

主步骤

#以下全程插入usb线
fastboot devices 
fastboot getvar all
fastboot erase  userdata
fastboot erase  system
fastboot erase  cache

pmbootstrap init
pmbootstrap install

pmbootstrap flasher flash_rootfs --partition userdata
pmbootstrap flasher flash_kernel
fastboot reboot  #启动完最终停在postmarketOS界面不动,但实际上此时Linux已经正常启动了
ssh [email protected]  #usb线插好,即可ssh连接Linux

连接wifi

sudo nmtui

其他

sudo apk add htop
sudo apk add curl

docker安装

sudo apk upgrade
sudo apk update
sudo apk add docker
sudo addgroup z  docker
  • 文件 /etc/docker/daemon.json 内容如下:
{
  "iptables": false
}

sudo rc-update add docker boot
sudo service docker start
sudo service docker status 

拉取 clash 镜像、并启动



#clash ui 参考:https://blog.csdn.net/hfcaoguilin/article/details/128866731
#clash ui :
sudo mkdir /clash-home
sudo chown -R z /clash-home/
cd /clash-home/ && wget https://codeload.github.com/haishanh/yacd/zip/refs/heads/gh-pages
mv gh-pages ui.zip && unzip ui.zip ui
#ls /clash-home/ui/index.html

#准备clash 配置文件: config.yaml

#启动clash容器:
sudo docker pull dreamacro/clash
sudo docker run -itd --name dreamacro_clash --network=host -v /clash-home/:/root/.config/clash/ dreamacro/clash

关闭防火墙

sudo rc-update del nftables
#sudo rc-update nftables stop
sudo reboot


#再次启动docker、容器clash
sudo service docker start
sudo docker start dreamacro_clash

curl 10.0.4.114:9090
#10.0.4.114 本地ip(连wifi后获得的地址)

外部浏览器访问: http://10.0.4.114:9090/ui/#/proxies

外部浏览器 switch proxy omega配置: 10.0.4.114 9090, 报错 PR_END_OF_FILE_ERROR,可能是由于docker实例clash内的时区不对 但调整后 依然报此错, 正修复中 todo

按这里 Modem 操作,居然说没有modem. 但是nexus5 声称sms是work的,TODO, 有可能是因为没有插手机SIM卡

补充

步骤"pmbootstrap init" 中 用户界面 user interface 选 fbkeyboard 很保险

参考:

  1. Home Assistant on old Smartphone (Nexus5) with PostmarketOS and Docker
  2. Alpine Linux 安装 Docker

空间没用上问题解决

userdata 32GB空间没用上 , 问题描述, 问题可能答案

实际尝试后,该问题有解决如下:

解决1

  1. git仓库 ~/.local/var/pmbootstrap/cache_git/pmaports/ 切换到提交 f7e12b210dd6bba0f964a63db53afbc265a5384a

再进行以上操作可以正常识别到32GB空间。 注意此时 “pmbootstrap install” 下载了armv7 gcc交叉编译工具,但没有直观看到作了编译动作。

df -h
"""Filesystem                Size      Used Available Use% Mounted on
/dev/mapper/userdata2
                         25.0G    183.3M     23.5G   1% /
/dev/dm-0               225.7M     38.4M    175.2M  18% /boot
tmpfs                   376.6M    524.0K    376.1M   0% /run
dev                      10.0M         0     10.0M   0% /dev
shm                     941.4M         0    941.4M   0% /dev/shm
"""

解决2 (估计和解决1是一样的)

  1. 对master作rebase关于initramfs-log-to-kmsg ,结果居然和1一样。

master : 40aa8e911f958e18a4c5a4bbbe3afd3d171ce901

initramfs-log-to-kmsg: f7e12b210dd6bba0f964a63db53afbc265a5384a

切换到分支master, 右击分支master , 弹出菜单中 选择 : rebase initramfs-log-to-kmsg onto master, 有58个提交被rebase到master上了


其他

  • ui选 lxqt 或 gnome 在步骤 会受到错误 FAILED (remote: ‘data too large’)
pmbootstrap flasher flash_rootfs --partition userdata
[22:39:15] (native) flash rootfs image
[22:39:16] (native) install android-tools
Sending 'userdata' (1520640 KB)                    FAILED (remote: 'data too large')  #lxqt
Sending 'userdata' (1761280 KB)                    FAILED (remote: 'data too large')  #gnome

fastboot: error: Command failed
[22:39:17] NOTE: The failed command's output is above the ^^^ line in the log file: /home/z/.local/var/pmbootstrap/log.txt
[22:39:17] ERROR: Command failed (exit code 1): (native) % fastboot flash userdata /home/pmos/rootfs/lg-hammerhead.img
[22:39:17] See also: 

Run 'pmbootstrap log' for details.

Before you report this error, ensure that pmbootstrap is up to date.
Find the latest version here: https://git.sr.ht/~postmarketos/pmbootstrap/refs
Your version: 2.0.0



fastboot oem disable-verity

pmbootstrap init #选择如下:
[14:10:48] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[14:10:48] Work path [/home/z/.local/var/pmbootstrap]: 
[14:10:49] NOTE: pmaports path: /home/z/.local/var/pmbootstrap/cache_git/pmaports
[14:10:49] Choose the postmarketOS release channel.
[14:10:49] Available (8):
[14:10:49] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
[14:10:49] * v23.06: Latest release / Recommended for best stability
[14:10:49] * v22.12: Old release (unsupported)
[14:10:49] Channel [edge]: 
[14:10:50] NOTE: pmaports is on master branch, copying git hooks.
[14:10:50] Choose your target device vendor (either an existing one, or a new one for porting).
[14:10:50] Available vendors (80): acer, alcatel, amazon, amediatech, apple, ark, arrow, asus, beelink, bq, cubietech, cutiepi, dongshanpi, essential, fairphone, finepower, fly, generic, goclever, google, gp, hisense, htc, huawei, inet, infocus, jolla, klipad, kobo, lark, leeco, lenovo, lg, mangopi, medion, meizu, microsoft, mobvoi, motorola, nextbit, nobby, nokia, nvidia, odroid, oneplus, oppo, ouya, pegatron, pine64, planet, purism, qemu, radxa, raspberry, samsung, semc, sharp, shift, sipeed, sony, sourceparts, surftab, t2m, tablet, thundercomm, tokio, tolino, trekstor, valve, vernee, videostrong, volla, wexler, wiko, wileyfox, xiaomi, xunlong, yu, zte, zuk
[14:10:50] Vendor [lg]: 
[14:10:52] Available codenames (26): bullhead, c50, d285, d722, d802, d851, d855, dory, e610, h815, hammerhead, judyln, judyp, lenok, m216, madai, mako, mmh4x, p700, p880, p895, us996, vee3e, vee7e, w5, w7
[14:10:52] Device codename [hammerhead]: 
[14:10:52] This device has proprietary components, which trade some of your freedom with making more peripherals work.
[14:10:52] We would like to offer full functionality without hurting your freedom, but this is currently not possible for your device.
[14:10:52] device-lg-hammerhead-nonfree-firmware: WiFi, GPU, Modem and ADSP firmware
[14:10:52] Enable this package? (y/n) [y]: 
[14:10:55] Username [z]: 
[14:10:58] Available user interfaces (18): 
[14:10:58] * none: Bare minimum OS image for testing and manual customization. The "console" UI should be selected if a graphical UI is not desired.
[14:10:58] * asteroid: (Wayland) Smartwatch UI from AsteroidOS
[14:10:58] * console: Console environment, with no graphical/touch UI
[14:10:58] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support
[14:10:58] * gnome: (Wayland) Gnome Shell
[14:10:58] * gnome-mobile: (Wayland) Gnome Shell patched to adapt better to phones (Experimental)
[14:10:58] * i3wm: (X11) Tiling WM (keyboard required)
[14:10:58] * kodi: (GBM) 10-foot UI useful on TV's
[14:10:58] * lxqt: (X11) Lightweight Qt Desktop Environment (stylus recommended)
[14:10:58] * mate: (X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)
[14:10:58] * phosh: (Wayland) Mobile UI developed for the Librem 5
[14:10:58] * plasma-desktop: (X11/Wayland) KDE Desktop Environment (works well with tablets)
[14:10:58] * plasma-mobile: (Wayland) Mobile variant of KDE Plasma (does not run without hardware acceleration)
[14:10:58] * shelli: Plain console with touchscreen gesture support
[14:10:58] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION!)
[14:10:58] * sxmo-de-dwm: Simple Mobile: Mobile environment based on SXMO and running on dwm
[14:10:58] * sxmo-de-sway: Simple Mobile: Mobile environment based on SXMO and running on sway
[14:10:58] * weston: (Wayland) Reference compositor (demo, not a phone interface)
[14:10:58] * xfce4: (X11) Lightweight desktop (stylus recommended)
[14:10:58] User interface [gnome]: fbkeyboard
[14:11:04] Additional options: extra free space: 0 MB, boot partition size: 256 MB, parallel jobs: 17, ccache per arch: 5G, sudo timer: False, mirror: http://mirror.postmarketos.org/postmarketos/
[14:11:04] Change them? (y/n) [n]: n
[14:11:15] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[14:11:15] Extra packages [none]: 
[14:11:18] Your host timezone: Asia/Shanghai
[14:11:18] Use this timezone instead of GMT? (y/n) [y]: 
[14:11:21] Choose your preferred locale, like e.g. en_US. Only UTF-8 is supported, it gets appended automatically. Use tab-completion if needed.
[14:11:21] Locale [zh_CN]: 
[14:11:22] Device hostname (short form, e.g. 'foo') [lg-hammerhead]: 
[14:11:23] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[14:11:23] Build outdated packages during 'pmbootstrap install'? (y/n) [y]: 
[14:11:24] Zap existing chroots to apply configuration? (y/n) [y]: 
[14:11:25] Unregister qemu binfmt (arm)
[14:11:25] % rm -rf /home/z/.local/var/pmbootstrap/chroot_native
[14:11:25] % rm -rf /home/z/.local/var/pmbootstrap/chroot_rootfs_lg-hammerhead
[14:11:25] Cleared up ~2511 MB of space
[14:11:25] WARNING: The chroots and git repositories in the work dir do not get updated automatically.
[14:11:25] Run 'pmbootstrap status' once a day before working with pmbootstrap to make sure that everything is up-to-date.
[14:11:25] DONE!

sudo fdisk -l   /dev/mmcblk0

/dev/mmcblk0p28  3969024 61071315 57102292 27.2G Microsoft basic data

sudo fdisk -x   /dev/mmcblk0

Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 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: gpt
Disk identifier: 98101B32-BBE2-4BF2-A06E-2BB33D000C20
First usable LBA: 34
Last usable LBA: 61071326
Alternative LBA: 61071359
Partition entries starting LBA: 2
Allocated partition entries: 32
Partition entries ending LBA: 9

Device             Start      End  Sectors Type-UUID                            UUID                                 Name     Attrs
/dev/mmcblk0p1      1024   132095   131072 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 80D6FA5F-1B26-C0FE-49F2-C78E7F3D88FC modem    GUID:60
/dev/mmcblk0p2    132096   134143     2048 DEA0BA2C-CBDD-4805-B4F9-F428251C3E98 35854BF3-B7BA-4E91-858E-FEC12B8EF02B sbl1     
/dev/mmcblk0p3    134144   135167     1024 098DF793-D712-413D-9D4E-89D711772228 671CADA6-A8E9-A98E-E0AC-66C72488B768 rpm      
/dev/mmcblk0p4    135168   136191     1024 A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4 C4907B28-F846-7D32-9C6A-B254EF4B552B tz       
/dev/mmcblk0p5    136192   137215     1024 D4E0D938-B7FA-48C1-9D21-BC5ED5C4B203 E2B27CC4-A377-ABB8-2287-55ED8DD115C4 sdi      
/dev/mmcblk0p6    137216   138239     1024 400FFDCD-22E0-47E7-9A23-F16ED9382388 C5BB54C7-E9F5-2CF8-389F-4150E0081392 aboot    
/dev/mmcblk0p7    138240   142335     4096 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 1D93F383-FF91-84C6-D848-F77A740B162A pad      
/dev/mmcblk0p8    142336   144383     2048 6952B77A-8259-4864-9D66-40A6793CE737 68EBD5CC-3C4B-9585-3BA5-F20AE752F13D sbl1b    
/dev/mmcblk0p9    144384   145407     1024 80F07C88-5C6D-48D3-8EA6-B984F7EDD622 81759FF7-0B8D-7D8F-BA8C-C1787608DF94 tzb      
/dev/mmcblk0p10   145408   146431     1024 F1FC4C90-0705-4830-ADBD-291E78BD2E2A 07D78183-8EC2-6B11-CC74-B20EC7BA4F2D rpmb     
/dev/mmcblk0p11   146432   147455     1024 0B8202FA-26A5-468F-B356-952D5EC60CEC 62CDE8B3-A46B-A98E-21B8-7BC72350032C abootb   
/dev/mmcblk0p12   147456   153599     6144 EBBEADAF-22C9-E33B-8F5D-0E81686A68CB D1B2D502-6E25-D960-BB33-3E45D96A8330 modemst1 
/dev/mmcblk0p13   153600   159743     6144 0A288B1F-22C9-E33B-8F5D-0E81686A68CB 4D8B6E3B-2A92-FF15-2416-88A213E9F186 modemst2 
/dev/mmcblk0p14   159744   160767     1024 8DA63339-0007-60C0-C436-083AC8230908 431AA331-1209-D428-4699-7433A24D2ED4 metadata 
/dev/mmcblk0p15   160768   193535    32768 6CD30554-5F5D-40EF-82FE-1092359F92EE 9971DD9C-D384-4BA8-76AC-D412940089E4 misc     
/dev/mmcblk0p16   193536   226303    32768 0FC63DAF-8483-4772-8E79-3D69D8477DE4 C4C6FCFE-D6B2-21F1-ACF2-AB09186201E1 persist  
/dev/mmcblk0p17   226304   232447     6144 51E36039-8392-41D8-9423-BF9CF8BBAD00 2CBF08B6-A53B-1A06-5864-01AC4551E229 imgdata  
/dev/mmcblk0p18   232448   277503    45056 98523EC6-90FE-4C67-B50A-0FC59ED6F56D F4BB3087-4B3B-C8A6-693E-5F7BFB1FDCCB laf      
/dev/mmcblk0p19   277504   322559    45056 20117F86-E985-4357-B9EE-374BC1D8487D 824C1A8D-4FE8-E0A7-2559-EC23E5BB7D54 boot     GUID:60
/dev/mmcblk0p20   322560   367615    45056 20117F86-E985-4357-B9EE-374BC1D8487D 6B33096B-753B-33E0-F973-2BCDA0D1699F recovery GUID:60
/dev/mmcblk0p21   367616   373759     6144 638FF8E2-22C9-E33B-8F5D-0E81686A68CB 423BBF5E-F80D-72A2-D175-9CCF3771BD7A fsg      GUID:60
/dev/mmcblk0p22   373760   374783     1024 57B90A16-22C9-E33B-8F5D-0E81686A68CB 7FB6B15A-A955-3497-5552-BD3E6607A514 fsc      
/dev/mmcblk0p23   374784   375807     1024 2C86E742-745E-4FDD-BFD8-B6A7AC638772 4FF27D6E-8895-D172-2015-D33C38FF08A9 ssd      
/dev/mmcblk0p24   375808   376831     1024 20A0C19C-286A-42FA-9CE7-F64C3226A794 35D8D7CC-7232-A10A-8A50-E3D109BF9BE9 DDR      GUID:60
/dev/mmcblk0p25   376832  2473983  2097152 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 2DE7DCF7-15A2-5A85-7862-1FEDB20F9D18 system   GUID:60
/dev/mmcblk0p26  2473984  2535423    61440 19CC541E-CEF7-45E4-98FD-A2D897E663D2 95F18A70-2AAF-ACDF-DE44-A79757D45C2C crypto   
/dev/mmcblk0p27  2535424  3969023  1433600 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 9BF89DE3-D2A4-C02D-C2F0-61387EB3AE3C cache    GUID:60
/dev/mmcblk0p28  3969024 61071315 57102292 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 AD97A115-BDE3-4A21-1C88-F9946B6805CA userdata GUID:60
/dev/mmcblk0p29 61071316 61071326       11 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 756B0981-38D1-1DA6-1583-5529D8E0D488 grow     GUID:60




df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/dm-1               299.4M    280.3M         0 100% /
/dev/dm-0               225.7M     38.3M    175.3M  18% /boot
tmpfs                   376.6M    540.0K    376.0M   0% /run
dev                      10.0M         0     10.0M   0% /dev
shm                     941.4M         0    941.4M   0% /dev/shm

你可能感兴趣的:(postmarketos,linux)