2026年7月,时隔五年重新启动Anlinux

自从termux支持debootstrap后,我发现我可以随时生产最新版的debian arm系统,都弃用繁琐的anlinux, 可是直到2026年7月,发现新版的termux竟改了一些权限,导致在termux下使用debootstrap生成的debian竟然不能生成sudo 用户, systemcrtl也有问题,豆包与deebseek都劝我用proot-distro安装,然而,新版的proot-distro竟然是从docker来拉取linux的rootfs的,我的个天啊,国内这网络环境,对docker天然不友好。于是悲催了,我的手机无法安装linux了。肿么办?翻开老笔记,再结合阿里的通义千问3.7的建议,于是重新拾取了Anlinux

一 安装ubuntu26.04

  1. https://cdimage.ubuntu.com/ubuntu-base/releases/ 下载26.04版的 rootfs ubuntu-base-26.04-base-arm64.tar.gz
  2. 把 ubuntu-base-26.04-base-arm64.tar.gz 放到termux的 ~\目录下
  3. 修改ubuntu2604.sh脚本如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/data/data/com.termux/files/usr/bin/bash
folder=ubuntu-2604
if [ -d "$folder" ]; then
first=1
echo "skipping downloading"
fi
# 定义ubutnu26.04 的 rootfs

tarball="ubuntu-base-26.04-base-arm64.tar.gz"
cur=`pwd`
mkdir -p "$folder"
cd "$folder"
echo "Decompressing Rootfs, please be patient."
proot --link2symlink tar -zxvf ${cur}/${tarball}||:
cd "$cur"

mkdir -p ubuntu-binds
bin=start-ubuntu.sh
echo "writing launch script"
cat > $bin <<- EOM
#!/bin/bash
cd \$(dirname \$0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r $folder"
if [ -n "\$(ls -A ubuntu-binds)" ]; then
for f in ubuntu-binds/* ;do
. \$f
done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b ubuntu-2604/root:/dev/shm"
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
command+=" -b /sdcard"
command+=" -b /storage"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=\$TERM"
command+=" LANG=C.UTF-8"
command+=" /bin/bash --login"
com="\$@"
if [ -z "\$1" ];then
exec \$command
else
\$command -c "\$com"
fi
EOM

echo "fixing shebang of $bin"
termux-fix-shebang $bin
echo "making $bin executable"
chmod +x $bin
echo "removing image for some space"
rm $tarball
echo "You can now launch Ubuntu with the ./${bin} script"
  1. 执行 bash ubuntu2604.sh 脚本,对刚才下载的 ubuntu-base-26.04-base-arm64.tar.gz进行解压,并生成启动脚本 start-ubuntu.sh
  2. 执行 bash start-ubuntu.sh,进入刚才安装的ubuntu26.04
  3. 在root用户名与目录下进行如下操作
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 写入公共 DNS 服务器地址
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 223.5.5.5" >> /etc/resolv.conf
apt update
apt upgrade -y
# 安装最常用的基础工具:sudo、文本编辑器、网络工具、压缩工具等
apt install -y sudo vim wget curl net-tools locales
adduser frank
# 修改 /etc/sudoer文件,增加 frank ALL....
我采用解压,并成功启动ubunt26.04, apt update ,并apt install sudo 然后添加sudo用户frank成功后,采用groups查询,有以下信息,请问需要处理吗?
frank@localhost:~$ groups
groups: cannot find name for group ID 3003
groups: cannot find name for group ID 9997
groups: cannot find name for group ID 20292
groups: cannot find name for group ID 50292
frankli 3003 9997 20292 50292
# 通义千问回答: 结论:完全不需要处理,这不会影响您的任何正常使用。您可以放心地继续使用 frankli 用户,您的 sudo 权限和系统功能都是完全正常的。

二 安装debian13 trixie

在debian官网上没有找到debian的rootfs, 不过可以在电脑上通过我讨厌的docker来拉取,还好有podman这个比docker好用的工具

  1. 在PC电脑上拉取debian的rootfs
1
2
3
4
5
6
7
mkdir trixie
cd trixie
podman pull --platform linux/arm64 debian:trixie-slim
podman create --name temp-debian debian:trixie-slim
podman export temp-debian > debian13-trixie-arm64.tar
ls # 会在本目录下有debian13-trixie-arm64.tar这个文件
podman rm temp-debian # 删除刚才操作所生成的其它文件,但不会删除 debian13-trixie-arm64.tar
  1. 把 debian13-trixie-arm64.tar 放到termux的 ~\目录下
  2. 在手机的termux下执行
1
2
3
4
5
6
# 1. 创建专属目录
mkdir ~/debian13
# 2. 进入该目录
cd ~/debian13
# 3. 执行解压(加上 --preserve-permissions 保留原始权限)
tar -xvf ~/debian13-trixie-arm64.tar --preserve-permissions
  1. 在手机的termux下编写 start-trixie.sh脚本如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/data/data/com.termux/files/usr/bin/bash
cd $(dirname $0)
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r debian13"
if [ -n "$(ls -A ubuntu-binds)" ]; then
for f in ubuntu-binds/* ;do
. $f
done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b debian13/root:/dev/shm"
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
command+=" -b /sdcard"
command+=" -b /storage"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=$TERM"
command+=" LANG=C.UTF-8"
command+=" /bin/bash --login"
com="$@"
if [ -z "$1" ];then
exec $command
else
$command -c "$com"
fi

  1. 在termux下执行 bash start-trixe.sh 进入了debian, 发现拉取的debian是最新版的,并且这个是完整版,己经有了/etc/resolv.conf文件了,所以可以直接 apt update; apt install vim sudo -y就行了。但是修改resolv.conf可以提速,于是还可以如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 1. 修复 DNS(解决无法 ping 通域名的问题)
echo "nameserver 223.5.5.5" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

# 2. 更新软件源并安装您之前需要的 sudo 和用户管理工具
apt update
apt install -y sudo adduser vim-tiny curl wget

# 3. 创建您的普通用户并赋予 sudo 权限
adduser frank
usermod -aG sudo frank

# 4. 切换到 frank用户测试
su - frank
sudo whoami 如果显示为root则为正常

三 proot-distro安装下载的rootfs

1
proot-distro install debian13 --tarball ~/debian13-trixie-arm64.tar