termux / proot-distro

An utility for managing installations of the Linux distributions in Termux.
GNU General Public License v3.0
1.8k stars 209 forks source link

[Bug]: can't restore ubuntu by proot-distro #200

Closed lmlforever closed 1 year ago

lmlforever commented 2 years ago

Problem description

can't restore ubuntu by proot-distro

What steps will reproduce the bug?

  1. back ubuntu by proot-distro proot-distro backup ubuntu --output ./storage/downloads/ubuntu-20220302.tar.gz 2.reinstall termux 3.install proot-distro on termux
  2. restore ubuntu by proot-distro,the following error message:

=================================== tar: installed-rootfs/ubuntu/usr/bin/rsh: Cannot create symlink to ‘/etc/alternatives/rsh’: Operation not permitted tar: installed-rootfs/ubuntu/run/shm: Cannot create symlink to ‘/dev/shm’: Operation not permitted tar: installed-rootfs/ubuntu/var/run: Cannot create symlink to ‘/run’: Operation not permitted tar: installed-rootfs/ubuntu/var/spool/mail: Cannot create symlink to ‘../mail’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/dpkg/.l2s.status0001: Cannot create symlink to ‘/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/var/lib/dpkg/.l2s.status0001.0001’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/dpkg/diversions-old: Cannot create symlink to ‘/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/var/lib/dpkg/.l2s.diversions0001’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/dpkg/.l2s.diversions0001: Cannot create symlink to ‘/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/var/lib/dpkg/.l2s.diversions0001.0001’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/dpkg/status-old: Cannot create symlink to ‘/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/var/lib/dpkg/.l2s.status0001’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/mecab/dic/debian: Cannot create symlink to ‘/etc/alternatives/mecab-dictionary’: Operation not permitted tar: installed-rootfs/ubuntu/var/lib/mecab/dic/ipadic/dicrc: Cannot create symlink to ‘/usr/share/mecab/dic/ipadic/dicrc’: Operation not permitted tar: installed-rootfs/ubuntu/var/lock: Cannot create symlink to ‘/run/lock’: Operation not permitted ====================================

What is the expected behavior?

restore ubuntu by proot-distro successful

KevinBlue18 commented 2 years ago

What do you mean by reinstall? Did you mean you ran termux-reset or did you uninstall and reinstall the app?

sylirre commented 2 years ago

proot-distro restore ubuntu.tar.gz is basically this command:

tar -x --auto-compress \
  -f ubuntu.tar.gz \
  --recursive-unlink \
  --preserve-permissions \
  -C /data/data/com.termux/files/usr/etc/proot-distro/../ \
    proot-distro/ \
  -C /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/../ \
    installed-rootfs/

These lines in your log are strange as tar should not write to such paths.

tar: installed-rootfs/ubuntu/usr/bin/rsh: Cannot create symlink to ‘/etc/alternatives/rsh’: Operation not permitted
tar: installed-rootfs/ubuntu/run/shm: Cannot create symlink to ‘/dev/shm’: Operation not permitted
tar: installed-rootfs/ubuntu/var/run: Cannot create symlink to ‘/run’: Operation not permitted

proot-distro restore works for me without issues.


Are you restoring by proot-distro restore ./storage/downloads/ubuntu-20220302.tar.gz?

123777tw commented 2 years ago

i am new to termux. i tried this one after i downloaded the package ubuntu-aarch64-pd-v3.0.1.tar.xz from release page:

proot-distro restore /.../ubuntu-aarch64-pd-v3.0.1.tar.xz

but it said:

[*] Extracting tarball...
tar: proot-distro: Not found in archive
tar: installed-rootfs: Not found in archieve
tar: Exiting with failure status due to previous errors
[!] Failure.

btw, i have tried this many many times:

proot-distro install ubuntu

but it just keep promoting timeout, though i can down the package via my browser very slow.

thanks for any advice.

sylirre commented 2 years ago

You can't restore using regular tarballs. Their directory layout not in expected format.

Rootfs provided on GitHub is raw and must be properly installed first before can be backed up and restored.