SDRausty / TermuxArch

You can use setupTermuxArch.bash 📲 to install Arch Linux in Amazon, Android, Chromebook and Windows. https://sdrausty.github.io/TermuxArch/docs/install
https://sdrausty.github.io/TermuxArch/
Other
1.4k stars 162 forks source link

Error installing sudo (works incorrectly) #237

Closed petkar closed 4 years ago

petkar commented 4 years ago

I get this error while installing sudo :

[root20:51home]$ pacman -S sudo
warning: sudo-1.9.1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) sudo-1.9.1-1

Total Installed Size:  4.21 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                       [################################################] 100%
(1/1) checking package integrity                                                     [################################################] 100%
(1/1) loading package files                                                          [################################################] 100%
(1/1) checking for file conflicts                                                    [################################################] 100%
error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: not enough free disk space
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

Then, I copied /proc/self/mounts from my phone to the root-fs. It managed to install but with some errors. Are they critical or can be ignored?

[root20:42home]$ pacman -S sudo
resolving dependencies...
looking for conflicting packages...

Packages (1) sudo-1.9.1-1

Total Download Size:   0.92 MiB
Total Installed Size:  4.21 MiB

:: Proceed with installation? [Y/n] y
error: could not open file: /etc/mtab: No such file or directory
error: could not determine filesystem mount points
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
[root20:43home]$ cp /data/data/com.termux/files/home/mounts /proc/self/
[root20:44home]$ nano .bashrc 
[root20:45home]$ pacman -S sudo
resolving dependencies...
looking for conflicting packages...

Packages (1) sudo-1.9.1-1

Total Download Size:   0.92 MiB
Total Installed Size:  4.21 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 sudo-1.9.1-1-aarch64                                    940.1 KiB  1610 KiB/s 00:01 [################################################] 100%
(1/1) checking keys in keyring                                                       [################################################] 100%
(1/1) checking package integrity                                                     [################################################] 100%
(1/1) loading package files                                                          [################################################] 100%
(1/1) checking for file conflicts                                                    [################################################] 100%
(1/1) checking available disk space                                                  [################################################] 100%
:: Processing package changes...
(1/1) installing sudo                                                                [################################################] 100%
:: Running post-transaction hooks...
(1/3) Reloading system manager configuration...
  Skipped: Current root is not booted.
(2/3) Creating temporary files...
[/usr/lib/tmpfiles.d/journal-nocow.conf:26] Failed to resolve specifier: uninitialized /etc detected, skipping
All rules containing unresolvable specifiers will be skipped.
fchmod() of /var/lib/dhcpcd failed: No such file or directory
fchmod() of /run/dhcpcd failed: No such file or directory
fchmod() of /run/systemd/netif failed: No such file or directory
fchmod() of /run/systemd/netif/links failed: No such file or directory
fchmod() of /run/systemd/netif/leases failed: No such file or directory
fchmod() of /run/systemd/netif/lldp failed: No such file or directory
fchmod() of /var/log/wtmp failed: No such file or directory
fchmod() of /var/log/btmp failed: No such file or directory
fchmod() of /var/log/lastlog failed: No such file or directory
ACL operation on "/var/log/journal" failed: No such file or directory
Failed to re-open '/var/log/journal': No such file or directory
fchmod() of /var/log/journal failed: No such file or directory
Failed to re-open '/var/log/journal/remote': No such file or directory
error: command failed to execute correctly
(3/3) Arming ConditionNeedsUpdate...

Another issue is that I have to copy /proc/self/mounts to the root-fs every time I run startarch/or as a user from Termux. I added it to copy every time it starts up in .bashrc. I'm not sure if it's the proper solution. What is the cause of this? Is it because /proc/stat on the phone is unreadable?

The problem is that when I use sudo (as a regular user) to install gcc, it runs into errors and the installation fails, although it installs perfectly when run as root (from startarch). (even fails when I su from the regular user). Here's the error message :

[realzink21:09~]$ sudo pacman -S gcc
resolving dependencies...
looking for conflicting packages...

Packages (6) binutils-2.34-2  elfutils-0.180-1  libelf-0.180-1  libmicrohttpd-0.9.71-1  libmpc-1.1.0-2  gcc-9.3.0-1

Total Download Size:    32.67 MiB
Total Installed Size:  146.19 MiB
Net Upgrade Size:      143.29 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 libmicrohttpd-0.9.71-1-aarch64                          194.9 KiB   261 KiB/s 00:01 [################################################] 100%
 libelf-0.180-1-aarch64                                  412.7 KiB   339 KiB/s 00:01 [################################################] 100%
 elfutils-0.180-1-aarch64                                527.4 KiB   463 KiB/s 00:01 [################################################] 100%
 binutils-2.34-2-aarch64                                   5.3 MiB   837 KiB/s 00:06 [################################################] 100%
 libmpc-1.1.0-2-aarch64                                   65.7 KiB  3.21 MiB/s 00:00 [################################################] 100%
 gcc-9.3.0-1-aarch64                                      26.2 MiB  1839 KiB/s 00:15 [################################################] 100%
(6/6) checking keys in keyring                                                       [################################################] 100%
(6/6) checking package integrity                                                     [################################################] 100%
(6/6) loading package files                                                          [################################################] 100%
(6/6) checking for file conflicts                                                    [################################################] 100%
(6/6) checking available disk space                                                  [################################################] 100%
:: Processing package changes...
(1/6) installing libmicrohttpd                                                       [################################################] 100%
(2/6) upgrading libelf                                                               [################################################] 100%
(3/6) installing elfutils                                                            [################################################] 100%
(4/6) installing binutils                                                            [################################################] 100%
warning: warning given when extracting /usr/bin/ld.bfd (Can't create '/usr/bin/ld.bfd')
(5/6) installing libmpc                                                              [################################################] 100%
(6/6) installing gcc                                                                 [################################################] 100%
warning: warning given when extracting /usr/bin/aarch64-unknown-linux-gnu-g++ (Can't create '/usr/bin/aarch64-unknown-linux-gnu-g++')
warning: warning given when extracting /usr/bin/aarch64-unknown-linux-gnu-gcc-9.3.0 (Can't create '/usr/bin/aarch64-unknown-linux-gnu-gcc-9.3.0')
warning: warning given when extracting /usr/bin/c++ (Can't create '/usr/bin/c++')
warning: warning given when extracting /usr/bin/g++ (Can't create '/usr/bin/g++')
warning: warning given when extracting /usr/bin/gcc (Can't create '/usr/bin/gcc')
warning: warning given when extracting /usr/bin/gcc-ar (Can't create '/usr/bin/gcc-ar')
warning: warning given when extracting /usr/bin/gcc-nm (Can't create '/usr/bin/gcc-nm')
warning: warning given when extracting /usr/bin/gcc-ranlib (Can't create '/usr/bin/gcc-ranlib')
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...

Is this because sudo was incorrectly installed? If so, is it fixable? Or is it a completely unrelated issue? My phone is an Android 10 Mi Note 8 Pro.

github-actions[bot] commented 4 years ago

Thank you for contributing to make this project better😎 Keep up and follow to solve this issue.

petkar commented 4 years ago

Here's my sysinfo:

Begin TermuxArch 2.0.18 system information.

dpkg --print-architecture result:

aarch64

uname -a results:

Linux localhost 4.14.141-g13103ee #1 SMP PREEMPT Tue Jun 16 01:38:29 CST 2020 aarch64 Android

BASH_VERSINFO[0] = 5
BASH_VERSINFO[1] = 0
BASH_VERSINFO[2] = 17
BASH_VERSINFO[3] = 1
BASH_VERSINFO[4] = release
BASH_VERSINFO[5] = aarch64-unknown-linux-android

cat /proc/cpuinfo results:

processor   : 0
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 1
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 2
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 3
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 4
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 5
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part    : 0xd05
CPU revision    : 0

processor   : 6
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part    : 0xd0b
CPU revision    : 0

processor   : 7
BogoMIPS    : 26.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x3
CPU part    : 0xd0b
CPU revision    : 0

Hardware    : MT6785V/CC

Download directory information results:

/sdcard/Download exists
/storage/emulated/0/Download exists
~/downloads not found
/data/data/com.termux/files/home/storage/downloads exists

Device information results:

/dev/ashmem exists
/dev/ashmem is readable
/dev/shm does not exist
/dev/shm is not readable
/proc/stat does not exit
/proc/stat is not readable

getprop results:

[getprop gsm.sim.operator.iso-country]: [in]
[getprop net.bt.name]: [Android]
[getprop net.dns1]: []
[getprop net.dns2]: []
[getprop net.dns3]: []
[getprop net.dns4]: []
[getprop persist.sys.locale]: [en-IN]
[getprop ro.build.target_country]: []
[getprop ro.build.version.release]: [10]
[getprop ro.build.version.preview_sdk]: [0]
[getprop ro.build.version.sdk]: [29]
[getprop ro.com.google.clientidbase]: [android-xiaomi]
[getprop ro.com.google.clientidbase.am]: []
[getprop ro.com.google.clientidbase.ms]: []
[getprop ro.product.device]: [begoniain]
[getprop ro.product.cpu.abi]: [arm64-v8a]
[getprop ro.product.first_api_level]: [28]
[getprop ro.product.locale]: [en-GB]
[getprop ro.product.manufacturer]: [Xiaomi]
[getprop ro.product.model]: [Redmi Note 8 Pro]

Disk report 20165784 on /data Tue Jul 14 21:20:28 IST 2020

df /data/data/com.termux/files/home/arch results:

Filesystem                                      1K-blocks     Used Available Use% Mounted on
/dev/block/platform/bootdevice/by-name/userdata  53893572 33695024  20165780  63% /data

df results:

Filesystem                                      1K-blocks     Used Available Use% Mounted on
/dev/block/dm-0                                   3555292  3398372    140536  97% /
tmpfs                                             2814644     1768   2812876   1% /dev
none                                              2814644        0   2814644   0% /sys/fs/cgroup
tmpfs                                             2814644        0   2814644   0% /mnt
tmpfs                                             2814644        0   2814644   0% /apex
/dev/block/dm-1                                   1523628   922160    585084  62% /vendor
/dev/block/platform/bootdevice/by-name/userdata  53893572 33695024  20165780  63% /data
/dev/block/platform/bootdevice/by-name/cache       412104     5016    393824   2% /cache
/dev/block/bootdevice/by-name/cust                 822168   407684    389584  52% /cust
/data/media                                      53893572 33695024  20165780  63% /storage/emulated
/mnt/media_rw/0403-0201                          30547968 14195392  16352576  47% /storage/0403-0201

du -hs /data/data/com.termux/files/home/arch results:

974M    /data/data/com.termux/files/home/arch

ls -al /data/data/com.termux/files/home/arch results:

total 156
drwx------ 16 u0_a636 u0_a636 4096 Jul 14 21:20 .
drwx------  9 u0_a636 u0_a636 4096 Jul 14 21:20 ..
lrwxrwxrwx  1 u0_a636 u0_a636   18 May 23 09:17 bin -> usr/bin
drwxr-xr-x  2 u0_a636 u0_a636 4096 Jul 14 20:36 boot
drwxr-xr-x  2 u0_a636 u0_a636 4096 Jun 11 18:17 dev
drwxr-xr-x 37 u0_a636 u0_a636 4096 Jul 14 21:10 etc
drwxr-xr-x  4 u0_a636 u0_a636 4096 Jul 14 21:05 home
lrwxrwxrwx  1 u0_a636 u0_a636   18 May 23 09:17 lib -> usr/lib
drwxr-xr-x  2 u0_a636 u0_a636 4096 May 23 09:17 mnt
drwxr-xr-x  2 u0_a636 u0_a636 4096 May 23 09:17 opt
dr-xr-xr-x  2 u0_a636 u0_a636 4096 Jun 11 18:17 proc
drwxr-x---  4 u0_a636 u0_a636 4096 Jul 14 21:05 root
drwxr-xr-x 11 u0_a636 u0_a636 4096 Jul 14 20:45 run
lrwxrwxrwx  1 u0_a636 u0_a636   18 May 23 09:17 sbin -> usr/bin
drwxr-xr-x  4 u0_a636 u0_a636 4096 Jun 11 18:17 srv
-rwx------  1 u0_a636 u0_a636 8314 Jul 14 20:31 startarch
dr-xr-xr-x  2 u0_a636 u0_a636 4096 Jun 11 18:17 sys
drwxrwxrwt  3 u0_a636 u0_a636 4096 Jul 14 21:20 tmp
drwxr-xr-x  8 u0_a636 u0_a636 4096 Jul 14 21:10 usr
drwxr-xr-x 13 u0_a636 u0_a636 4096 Jul 14 20:36 var

End `setupTermuxArchSysInfo532f.log` 2.0.18 system information.

This might be slightly off-topic but although it says /proc/stat is not readable, I was able to install and run htop which to my surprise showed the processes the same way as termux did. When I tired running htop with other distros like ubuntu, it denied permission to /proc/stat. I'm not sure how y'all got it working on arch but I definitely appreciate it. Any insight on how this was done would also be appreciated. Back on topic, is this issue because of Android 10 or the vendor, or can it be resolved?

SDRausty commented 4 years ago

This message crops up on Arch Linux x86_64 in QEMU PRoot in Termux:

$ startarch s user sudo
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

I do not know why it stopped working as expected since sudo was resolved.

Does this link https://github.com/SDRausty/Termux-Archlinux/issues?q=is%3Aissue+sudo help?

SDRausty commented 4 years ago

htop ... not sure how y'all got it working on arch but I definitely appreciate it.

Here https://github.com/termux/proot/issues/32 is where this work around was created.

SDRausty commented 4 years ago

Is this issue because of Android 10 or the vendor, or can it be resolved?

@petkar you might want to repeat this question again https://github.com/termux/proot/issues here.

petkar commented 4 years ago

A google search showed that accessing /proc/stat not possible with the API Levels 26 or higher. Google has restricted this to non-system apps. That concludes why top wasn't accessible. (basically because of android) I got sudo to run normally on ubuntu proot, but the main issue with sudo here on arch still remains unresolved.

SDRausty commented 4 years ago

Any insight on how [htop] was done would also be appreciated.

See functions from _ADDfbindprocstat_ to _ADDfbinds_ in file archlinuxconfig.bash.

SDRausty commented 4 years ago

on arch still remains unresolved.

Was resolved https://github.com/SDRausty/termux-archlinux/issues/4 here, and https://github.com/SDRausty/TermuxArch/issues?q=is%3Aissue+sudo here, too. It would be nice to see sudo resolved once more.

SDRausty commented 4 years ago

can it be resolved?

got sudo to run normally on ubuntu proot, but

@petkar consider reaching out to Arch Linux arm groups too.

petkar commented 4 years ago

I tried adding the link2symlink option to the user account in the startarch file and this fixed the problem with gcc not installing with sudo on the user account. I don't know what other issues this could bring up. Please do let me know. Unfortunately, this still didn't fix the problem with the sudo and sudo still gets installed incorrectly with errors. Here's the installation after adding link2symlink :

[realzink23:15~]$ sudo pacman -S gcc
resolving dependencies...
looking for conflicting packages...

Packages (5) binutils-2.34-2  elfutils-0.180-1  libmicrohttpd-0.9.71-1  libmpc-1.1.0-2  gcc-9.3.0-1

Total Installed Size:  143.29 MiB

:: Proceed with installation? [Y/n] y
(5/5) checking keys in keyring                                                       [################################################] 100%
(5/5) checking package integrity                                                     [################################################] 100%
(5/5) loading package files                                                          [################################################] 100%
(5/5) checking for file conflicts                                                    [################################################] 100%
(5/5) checking available disk space                                                  [################################################] 100%
:: Processing package changes...
(1/5) installing libmicrohttpd                                                       [################################################] 100%
(2/5) installing elfutils                                                            [################################################] 100%
(3/5) installing binutils                                                            [################################################] 100%
(4/5) installing libmpc                                                              [################################################] 100%
(5/5) installing gcc                                                                 [################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
petkar commented 4 years ago

I reinstalled a fresh copy to troubleshoot after purging, and some previously unnoticed errors caught my attention. Notice the highlighted errors:

u0_a636@localhost:~$ bash setupTermuxArch.sh

 🕛 > 🕛 TermuxArch 2.0.18 shall attempt to install Linux in /data/data/com.termux/files/home/arch.  Arch Linux in Termux PRoot shall be available upon successful completion.  To run this BASH script again, use `!!`.  Ensure background data is not restricted.  Check the wireless connection if you do not see one o'clock 🕐 below.  Checking prerequisites…

Found download tool `curl`: Continuing…

Using curl to manage downloads.

 🕛 > 🕧 Prerequisites: OK  Downloading TermuxArch…

[1/2]: https://raw.githubusercontent.com/TermuxArch/TermuxArch/master/setupTermuxArch.sha512 --> setupTermuxArch.sha512
--_curl_--https://raw.githubusercontent.com/TermuxArch/TermuxArch/master/setupTermuxArch.sha512
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   153  100   153    0     0    255      0 --:--:-- --:--:-- --:--:--   255

[2/2]: https://raw.githubusercontent.com/TermuxArch/TermuxArch/master/setupTermuxArch.tar.gz --> setupTermuxArch.tar.gz
--_curl_--https://raw.githubusercontent.com/TermuxArch/TermuxArch/master/setupTermuxArch.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30548  100 30548    0     0  55846      0 --:--:-- --:--:-- --:--:-- 55744

 🕛 > 🕐 TermuxArch download: OK

 🕛 > 🕜 TermuxArch 2.0.18 integrity: OK

Setting locales to: Language >> en_IN << Region

 🕛 > 🕝 Detected aarch64 Android operating system.

 🕛 > 🕒 Activating termux-wake-lock: DONE  

 🕛 > 🕞 Contacting worldwide mirror https://os.archlinuxarm.org: DONE  

 🕛 > 🕓 Downloading the checksum file and ArchLinuxARM-aarch64-latest.tar.gz from the geographically local mirror http://sg.mirror.archlinuxarm.org.  If contact with the local mirror is not successful, run bash setupTermuxArch.bash again.  Should the worldwide mirror not provide another geographically nearby server after a couple of attempts, use bash setupTermuxArch.bash manual after locating a local mirror from the Internet; See bash setupTermuxArch.bash help for additional options.  Download of ArchLinuxARM-aarch64-latest.tar.gz pending Internet connection:

[1/2]: http://sg.mirror.archlinuxarm.org//os/ArchLinuxARM-aarch64-latest.tar.gz.md5 --> ArchLinuxARM-aarch64-latest.tar.gz.md5
--_curl_--http://sg.mirror.archlinuxarm.org//os/ArchLinuxARM-aarch64-latest.tar.gz.md5
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    69  100    69    0     0    370      0 --:--:-- --:--:-- --:--:--   368

[2/2]: http://sg.mirror.archlinuxarm.org//os/ArchLinuxARM-aarch64-latest.tar.gz --> ArchLinuxARM-aarch64-latest.tar.gz
--_curl_--http://sg.mirror.archlinuxarm.org//os/ArchLinuxARM-aarch64-latest.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  527M  100  527M    0     0  2146k      0  0:04:11  0:04:11 --:--:-- 2680k

 🕛 > 🕠 Checking download integrity with md5sum.  This may take a little while:

 🕛 > 🕕 System image file download integrity: OK

 🕛 > 🕡 Unpacking ArchLinuxARM-aarch64-latest.tar.gz into /data/data/com.termux/files/home/arch.  The option to create Arch Linux system users is available through addauser.  Arch Linux user login from Termux with startarch is now implemented.  See Ability for Scripts to Launch Commands for Arch Linux in Termux PRoot on Device https://github.com/sdrausty/TermuxArch/issues/54 for more information about these brand new options.  

While waiting, you can use df, du -hs, htop, ps, top and watch in a new Termux session to watch the unpacking while this session completes.  Use info query and man query to learn more about your Linux system in the palm of your hand.  See The Linux Documentation Project http://tldp.org to learn more about Linux and CLI commands.  Unpacking ArchLinuxARM-aarch64-latest.tar.gz will take a long time; Be patient…

 🕛 > 🕘 Cleaning up installation files: DONE  

 🕛 > 🕤 Arch Linux in Termux PRoot is installed.  Configuring and updating Arch Linux 📲

To generate locales in a preferred language use Settings > Language & Keyboard > Language in Android; Then run setupTermuxArch.sh r for a quick system refresh; For full system refresh you can use setupTermuxArch.sh re[fresh].

==> Generating locales...
Generation complete.

:: Removing redundant packages for Termux PRoot installation…
checking dependencies...
:: base optionally requires linux: bare metal support

Packages (2) linux-aarch64-5.7.1-1  linux-firmware-20200519.8ba6fa6-1

Total Removed Size:  677.16 MiB

:: Do you want to remove these packages? [Y/n] 
:: Processing package changes...
(1/2) removing linux-aarch64                                                         [################################################] 100%
(2/2) removing linux-firmware                                                        [################################################] 100%
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating module dependencies...

==> Running TermuxArch keys archlinux-keyring archlinuxarm-keyring ca-certificates-utils 2.0.105…

When gpg: Generating pacman keyring master key appears on the screen, the installation process can be accelerated.  The system desires a lot of entropy at this part of the install procedure.  To generate as much entropy as possible quickly, watch and listen to a file on your device.  

The program pacman-key will want as much entropy as possible when generating keys.  Entropy is also created through tapping, sliding, one, two and more fingers tapping with short and long taps.  When gpg: Generating pacman keyring master key appears on the screen, use any of these simple methods to accelerate the installation process if it is stalled.  Put even simpler, just do something on device.  Browsing files will create entropy on device.  Slowly swiveling the device in space and time will accelerate the installation process.  This method alone might not generate enough entropy (a measure of randomness in a closed system) for the process to complete quickly.  Use bash ~/arch/bin/we in a new Termux session to and watch entropy on device.

==> Running pacman-key --init…
gpg: /etc/pacman.d/gnupg/trustdb.gpg: trustdb created
gpg: no ultimately trusted keys found
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
gpg: Generating pacman keyring master key...
gpg: key D86CDF42C71DE604 marked as ultimately trusted
gpg: directory '/etc/pacman.d/gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/etc/pacman.d/gnupg/openpgp-revocs.d/8F1AC4C4A29648DC33EDD37AD86CDF42C71DE604.rev'
gpg: Done
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
==> Appending keys from archlinuxarm.gpg...
==> Locally signing trusted keys in keyring...
  -> Locally signing key 69DD6C8FD314223E14362848BF7EEF7A9C6B5765...
  -> Locally signing key 02922214DE8981D14DC2ACABBC704E86B823CD25...
  -> Locally signing key 9D22B7BB678DC056B1F7723CB55C5315DCD9EE1A...
==> Importing owner trust values...
gpg: setting ownertrust to 4
gpg: inserting ownertrust of 4
gpg: setting ownertrust to 4
==> Updating trust database...
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   3  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   3  signed:   1  trust: 0-, 0q, 0n, 3m, 0f, 0u
gpg: depth: 2  valid:   1  signed:   0  trust: 1-, 0q, 0n, 0m, 0f, 0u

==> Running pacman -S archlinux-keyring archlinuxarm-keyring ca-certificates-utils --noconfirm --color=always…
warning: archlinuxarm-keyring-20140119-1 is up to date -- reinstalling
warning: ca-certificates-utils-20181109-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (3) archlinux-keyring-20200603-1  archlinuxarm-keyring-20140119-1  ca-certificates-utils-20181109-3

Total Download Size:   0.90 MiB
Total Installed Size:  1.27 MiB
Net Upgrade Size:      1.23 MiB

:: Proceed with installation? [Y/n]  

error: could not open file: /etc/mtab: No such file or directory error: could not determine filesystem mount points error: failed to commit transaction (unexpected error) Errors occurred, no packages were upgraded.

When Appending keys from archlinux.gpg appears on the screen, the installation process can be accelerated.  The system desires a lot of entropy at this part of the install procedure.  To generate as much entropy as possible quickly, watch and listen to a file on your device.  

The program pacman-key will want as much entropy as possible when generating keys.  Entropy is also created through tapping, sliding, one, two and more fingers tapping with short and long taps.  When Appending keys from archlinux.gpg appears on the screen, use any of these simple methods to accelerate the installation process if it is stalled.  Put even simpler, just do something on device.  Browsing files will create entropy on device.  Slowly swiveling the device in space and time will accelerate the installation process.  This method alone might not generate enough entropy (a measure of randomness in a closed system) for the process to complete quickly.  Use bash ~/arch/bin/we in a new Termux session to watch entropy on device.

==> Running pacman-key --populate…
==> Appending keys from archlinuxarm.gpg...
==> Locally signing trusted keys in keyring...
  -> Locally signing key 69DD6C8FD314223E14362848BF7EEF7A9C6B5765...
  -> Locally signing key 02922214DE8981D14DC2ACABBC704E86B823CD25...
  -> Locally signing key 9D22B7BB678DC056B1F7723CB55C5315DCD9EE1A...
==> Importing owner trust values...
==> Updating trust database...
gpg: no need for a trustdb check

==> Running pacman -Ss keyring --color=always…
core/archlinux-keyring 20200603-1
    Arch Linux PGP keyring
core/archlinuxarm-keyring 20140119-1 [installed]
    Arch Linux ARM PGP keyring
extra/gnome-keyring 1:3.36.0-1 (gnome)
    Stores passwords and encryption keys
extra/libgnome-keyring 3.12.0+13+g4f8ab73-3
    GNOME keyring client library (deprecated)
extra/python2-gnomekeyring 2.32.0-18
    Python bindings for libgnome-keyring
community/debian-archive-keyring 2019.1-1
    GnuPG archive keys of the Debian archive
community/jetring 0.27-1
    gpg keyring maintenance using changesets
community/python-keyring 21.2.1-4
    Store and access your passwords safely
community/python-keyrings-alt 1:3.4.0-1
    Alternate keyring implementations
community/ubuntu-keyring 2020.02.11.2-1
    GnuPG keys of the Ubuntu archive

TermuxArch keys archlinux-keyring archlinuxarm-keyring ca-certificates-utils 2.0.105: DONE 🏁  

==> Running TermuxArch pci  2.0.105 …

:: Synchronizing package databases...
 core                                                    194.2 KiB   545 KiB/s 00:00 [################################################] 100%
 extra                                                     2.2 MiB  2.01 MiB/s 00:01 [################################################] 100%
 community                                                 4.7 MiB  1714 KiB/s 00:03 [################################################] 100%
 alarm                                                    49.2 KiB  6.01 MiB/s 00:00 [################################################] 100%
 aur is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (24) ca-certificates-mozilla-3.54-1  curl-7.71.1-1  dbus-1.12.20-1  dhcpcd-9.1.4-2  file-5.39-1  glib2-2.64.4-1  gnupg-2.2.21-1
              gnutls-3.6.14-2  haveged-1.9.13-1  iana-etc-20200707-1  keyutils-1.6.3-1  krb5-1.18.2-1  libcap-2.36-1  libelf-0.180-1
              libgcrypt-1.8.6-1  libldap-2.4.50-2  libnftnl-1.1.7-1  pacman-5.2.2-1  perl-5.32.0-1  popt-1.18-1  sqlite-3.32.3-1
              systemd-245.6-8  systemd-libs-245.6-8  systemd-sysvcompat-245.6-8

Total Download Size:    33.85 MiB
Total Installed Size:  153.57 MiB
Net Upgrade Size:        2.12 MiB

:: Proceed with installation? [Y/n] 

error: could not open file: /etc/mtab: No such file or directory error: could not determine filesystem mount points error: failed to commit transaction (unexpected error) Errors occurred, no packages were upgraded. error: no operation specified (use -h for help)

 TermuxArch WARNING:  Generated script signal 1 near or at line number 69 by !

TermuxArch pci  2.0.105: DONE 🏁  

error: could not open file: /etc/mtab: No such file or directory error: could not determine filesystem mount points error: failed to commit transaction (unexpected error) error: no operation specified (use -h for help)

 TermuxArch WARNING:  Generated script signal 201 near or at line number 55 by 
==> Running TermuxArch pci  2.0.105 …

:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 alarm is up to date
 aur is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (24) ca-certificates-mozilla-3.54-1  curl-7.71.1-1  dbus-1.12.20-1  dhcpcd-9.1.4-2  file-5.39-1  glib2-2.64.4-1  gnupg-2.2.21-1  gnutls-3.6.14-2  haveged-1.9.13-1  iana-etc-20200707-1  keyutils-1.6.3-1  krb5-1.18.2-1  libcap-2.36-1  libelf-0.180-1  libgcrypt-1.8.6-1  libldap-2.4.50-2  libnftnl-1.1.7-1  pacman-5.2.2-1  perl-5.32.0-1  popt-1.18-1  sqlite-3.32.3-1  systemd-245.6-8  systemd-libs-245.6-8  systemd-sysvcompat-245.6-8

Total Download Size:    33.85 MiB
Total Installed Size:  153.57 MiB
Net Upgrade Size:        2.12 MiB

:: Proceed with installation? [Y/n] 
Errors occurred, no packages were upgraded.

 TermuxArch WARNING:  Generated script signal 1 near or at line number 69 by !

TermuxArch pci  2.0.105: DONE 🏁  

!

finishsetup.bash  2.0.18 [Exit Signal 201]: DONE  🏁 

 🕛 > 🕙 Releasing termux-wake-lock: DONE  

 🕛 > 🕥 Use startarch to launch Arch Linux in Termux PRoot.  Alternatively, run ~/arch/startarch in a BASH shell to start Arch Linux in Termux PRoot for future sessions.  See startarch help for usage information.

 🕛 > 🕦 startarch copied to /data/data/com.termux/files/usr/bin.

 🕛 = 🕛 Information about "Starting Arch Linux from Termux?" at https://github.com/sdrausty/TermuxArch/issues/25.  Use tour to run a very short tour to get to know the new Arch Linux in Termux PRoot environment you just set up a little bit better.  If there was more than one error during the update procedure and you would like to refresh the installation, use setupTermuxArch.bash refresh.  This will update and recreate the configuration provided.  The TermuxArch command keys helps install and generate Arch Linux keyring keys.

If error ` env ... not found ` is found, ensure that all the software is up to date.  After updating, reference these links in order to find a resolution if updating Termux app and Termux packages was unsuccessful:

  * https://github.com/termux/proot/issues?q="env"+"not+found"

  * https://github.com/termux/termux-packages/issues?q="not+found"+"proot"

Arch Linux in Termux PRoot is installed in /data/data/com.termux/files/home/arch.  This project is in active development.  Contributions to this project are welcome; See https://sdrausty.github.io/TermuxArch/CONTRIBUTORS for information.  The documentation repository for TermuxArch https://sdrausty.github.io/TermuxArch/docs/ is a Termux Arch submodule that is located at https://github.com/sdrausty/docsTermuxArch.  Pull requests and contributions through the issues pages are open to improve the ux (user experience) and this Termux PRoot installation script. 

Use ~/arch/startarch and startarch in a BASH shell to launch Arch Linux in Termux PRoot for future sessions.  If you are new to *nix, http://tldp.org has *nix documentation.  

See https://archlinuxarm.org/forum/ for available Arch Linux ARM Forums.

bash: warning: setlocale: LC_COLLATE: cannot change locale (en_IN.UTF-8): No such file or directory
bash: warning: setlocale: LC_CTYPE: cannot change locale (en_IN.UTF-8): No such file or directory
bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_IN.UTF-8): No such file or directory
bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_IN.UTF-8): No such file or directory
bash: warning: setlocale: LC_TIME: cannot change locale (en_IN.UTF-8): No such file or directory

Welcome to Arch Linux in Termux!
Install a package: pacman -S package
More  information: pacman -[D|F|Q|R|S|T|U]h
Search   packages: pacman -Ss query
Upgrade  packages: pacman -Syu

Chat:  https://wiki.termux.com/wiki/Community
Help:  info query and man query
Forum: https://archlinuxarm.org/forum

bash: warning: setlocale: LC_COLLATE: cannot change locale (en_IN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (en_IN.UTF-8)
bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_IN.UTF-8)
bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_IN.UTF-8)
bash: warning: setlocale: LC_TIME: cannot change locale (en_IN.UTF-8)

These are the same errors that I get while installing packages from pacman. The workaround to this was to copy /proc/self/mounts from my android to /proc/self/mounts arch rootfs. I probably have to edit the script to copy the mounts file right after the rootfs is extracted and then proceed with the other installation parts. Edit : ~~Could you please instruct me on how I could edit the script so I could run cp /proc/self/mounts ~/arch/proc/self/ right after the rootfs is unpacked? (or before the errors are encountered) I don't think I can do it from termux, and will probably have to execute it from within arch because of the way permissions are set up. How do I edit the script to copy mounts (from within arch) before the error packages are installed? Or is it just alright if I add cp /data/data/com.termux/files/home/mounts /proc/self/ to bashrc and update after the installation?~~ Edit 2: Nevermind, it's an error with automatic upgrade and can be resolved after the installation itself. It doesn't affect the sudo issue in any way. Please ignore this message.

petkar commented 4 years ago

Okay I'm really happy that I was able to resolve the sudo issue and get it running clean. Here's what worked for me :

While I'm glad this worked out for me, I'm also concerned about the issues that might come up due to enabling --link2symlink to the user. One problem I noticed is that the default directory the root user logs into (by startarch) has changed from /root to /data/data/com.termux/files/home. Although this issue is resolved, I'm still open to discuss the problems these changes might bring up and appreciate any input.

SDRausty commented 4 years ago

@petkar thank you for the update.

error: could not open file: /etc/mtab: No such file or directory error: could not determine filesystem mount points error: failed to commit transaction (unexpected error)

Disable CheckSpace in pacman.conf. It does not work in chroots.

From https://bbs.archlinux.org/viewtopic.php?id=129661

SDRausty commented 4 years ago

This commit https://github.com/TermuxArch/TermuxArch/commit/9cd376d663616df1ea2c6367ea92c183117b013e resolves the pacman Errors occurred, no packages were upgraded error.

petkar commented 4 years ago

Okay I reinstalled arch to test this. Thankfully this did work and I was able to install packages normally after disabling checkspace. It would be really nice if checkspace was automatically commented since the installation of keyring and full update fails during the initial installation of Arch (which is why I reinstalled to test it out). Uncommenting the detected locale from locale.gen and executing locale-gen automatically during the installation would also be pretty neat. (which does not happen yet but I'm eagerly looking forward to) Edit : My bad, didn't realize it was was a different repository. Pulled and installed it. It fixed the pacman installation error.

petkar commented 4 years ago

Okay I'm really happy that I was able to resolve the sudo issue and get it running clean. Here's what worked for me :

* Keep a copy of `/proc/self/mounts` from the android system in the termux home directory. Start the `setupTermuxArch.sh` script and open a new Termux session while it downloads the tarball. cd into the `arch` directory and run `mkdir proc/self/ -p && cp ~/mounts proc/self/` ones it begins unpacking the tarball.

* Once the installation is complete, exit into termux and open `/data/data/com.termux/files/usr/bin/startarch` file in an editor and edit line 90 and 109 in startarch to have the `--link2symlink` after `--kill-on-exit`.

* Run `startarch` and `addauser user`. Set passwords for both and install sudo. It should successfully install now.  Run `chmod +s /usr/bin/sudo;chmod +s /usr/bin/su;echo "Set disable_coredump false" >> /etc/sudo.conf` and finally add `user    ALL=(ALL:ALL) ALL` by running visudo, uncomment `%wheel ALL=(ALL) ALL` and add user to wheel by 'usermod -aG wheel user`.

* exit and `startarch u user` to finally test sudo by installing gcc (which now successfully installed)

While I'm glad this worked out for me, I'm also concerned about the issues that might come up due to enabling --link2symlink to the user. One problem I noticed is that the default directory the root user logs into (by startarch) has changed from /root to /data/data/com.termux/files/home. Although this issue is resolved, I'm still open to discuss the problems these changes might bring up and appreciate any input.

Thanks to you I can completely skip the first step now. Unfortunately, when I installed sudo, it ran into the same errors as the first time (won't install sudo correctly and fails to install gcc). It gets fixed only with the second step (adding link2symlink in startarch) Edit : For some reason adding the link2symlink option doesn't fix sudo or gcc installation in this repo. Switching back to this repo.

SDRausty commented 4 years ago

This commit https://github.com/TermuxArch/TermuxArch/commit/9cd376d663616df1ea2c6367ea92c183117b013e resolves the pacman Errors occurred, no packages were upgraded error.

*This commit https://github.com/TermuxArch/TermuxArch/commit/d52484322e2809e7c6f7acc4e8cc47d45ec822de resolves the pacman Errors occurred, no packages were upgraded error.

The repository was update with https://github.com/TermuxArch/TermuxArch/blob/master/.scripts/maintenance/do.sums.bash but should have been updated with https://github.com/TermuxArch/TermuxArch/blob/master/.scripts/maintenance/tgen.bash which rebuilds the install script.

can completely skip the first step now.

Now you should be able to; it's automated.

adding link2symlink in startarch

This can be done in https://github.com/TermuxArch/TermuxArch/blob/master/knownconfigurations.bash#L120 by removing this fragment of code //--link2symlink from PROOTSTMNTU="${PROOTSTMNT//--link2symlink } ".

installation in this repo. Switching back to this repo.

The command bash setupTermuxArch.bash bloom creates a small directory ~/TermuxArchBloom with a complete code set of the install script. At present the most up to date code is at this https://github.com/TermuxArch/TermuxArch git repository.

SDRausty commented 4 years ago

fragment of code

Another way to edit the PRoot init statements is bash setupTermuxArch.bash manual re which is described in file https://github.com/TermuxArch/TermuxArch/blob/master/knownconfigurations.bash#L67

Appending to the PRoot statement can be accomplished on the fly by creating a *.prs file in /var/binds. The format is straightforward, PROOTSTMNT+="option command ". The space is required before the last double quote. Commands info proot and man proot have more information about what can be configured in a proot init statement. The command setupTermuxArch.bash manual refresh will refresh the installation globally. The command setupTermuxArch.bash manual re will refresh the installation and update locales. If more suitable configurations are found, share them at https://github.com/TermuxArch/TermuxArch/issues to improve TermuxArch.

@petkar thank you for sharing your progress here.

petkar commented 4 years ago

This can be done in https://github.com/TermuxArch/TermuxArch/blob/master/knownconfigurations.bash#L120 by removing this fragment of code //--link2symlink from PROOTSTMNTU="${PROOTSTMNT//--link2symlink } ".

Thank you very much. This does the job. Everything seems to be resolved now. I've been testing on the updated repository and I'm really glad it's working without issues now. One thing to note is that it ran into the same errors when I installed by following this step. The fix was running mkdir proc/self -p && cp /proc/self/mounts proc/self in the arch directory in another termux session while the tarball was being downloaded. The good news is that I only had to do it the first time. After this, I did not run into any errors regarding this issue. Edit : There was one issue. tmux doesn't start and returns the error open terminal failed : not a terminal on my phone. However it does work when I ssh into termux and startarch. I'm not sure what caused this but it's specific to the updated repo. (I used to be able to start it on this repo eariler and had it to startup by default in bashrc) Edit 2 : It was this step from the installation which which caused the error. I don't know why it always fails here (could be a regional issue)

==> Running pacman -S archlinux-keyring archlinuxarm-keyring ca-certificates-utils --noconfirm --color=always…
warning: archlinuxarm-keyring-20140119-1 is up to date -- reinstalling
warning: ca-certificates-utils-20181109-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (3) archlinux-keyring-20200603-1  archlinuxarm-keyring-20140119-1  ca-certificates-utils-20181109-3

Total Download Size:   0.90 MiB
Total Installed Size:  1.27 MiB
Net Upgrade Size:      1.23 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages...
error: failed retrieving file 'archlinux-keyring-20200603-1-any.pkg.tar.xz' from sg.mirror.archlinuxarm.org : The requested URL returned error: 404
warning: failed to retrieve some files
 archlinuxarm-keyring-20140119-1-any                      12.2 KiB  2.97 MiB/s 00:00 [################################################] 100%
 ca-certificates-utils-20181109-3-any                      7.9 KiB  1983 KiB/s 00:00 [################################################] 100%
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

Only the archlinux-keyring fails, and not archlinuxarm-keyring or ca-certificates-utils. Running it again fixed the open terminal failed error.

SDRausty commented 4 years ago

Thank you very much. This does the job.

You are welcome. It is a pleasure working with you @petkar

Running it again fixed

If at first you don't succeed, Try, try, try again; I have noticed this when using QEMU. It works, but it is not a one tap install...

petkar commented 4 years ago

I'm thankful for your developments on making it stable. This might be a bit off topic but it does affect this issue indirectly. Whenever I run the installation script on my phone, it always fails to download the archlinux keyring and returns a 404 error only for the first time. I couldn't determine the reason as to why this happens but I'll test this again with VPN and a different device.

SDRausty commented 4 years ago

This https://github.com/TermuxArch/TermuxArch/commit/161eaba60cedcd687f7d6282d5ee1a2a292e902d commit automates adding sudo users.

printf "%s\\n" "\$1 ALL=(ALL) ALL" >> /etc/sudoers
sed -i "s/\$1:x/\$1:/g" /etc/passwd