Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Gentoo in chroot - Temporary failure in name resol.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Mon Aug 16, 2021 6:29 pm    Post subject: [Solved] Gentoo in chroot - Temporary failure in name resol. Reply with quote

Hello everyone,

I'm new user in Gentoo, I come from ArchLinux. (ArchLinux user since 2013).
On all my devices I have ArchLinux (including the smartphone), and I am considering moving to Gentoo.
I love Gentoo.

My first try is to use this distribution on Android device.
I have downloaded the stage3 tarball and followed the steps in the handbook.

The
Code:
emerge-webrsync
works, but the next step
Code:
emerge --ask --verbose --update --deep --newuse @world
doesn't work.
The error is:

Code:

>>> Emerging (1 of 22) dev-libs/libpcre-8.45::gentoo
>>> Downloading 'http://distfiles.gentoo.org/distfiles/layout.conf'
--2021-08-16 20:18:25--  http://distfiles.gentoo.org/distfiles/layout.conf
Resolving distfiles.gentoo.org... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘distfiles.gentoo.org’
!!! Couldn't download '.layout.conf.distfiles.gentoo.org'. Aborting.
>>> Downloading 'http://distfiles.gentoo.org/distfiles/pcre-8.45.tar.bz2'
--2021-08-16 20:18:25--  http://distfiles.gentoo.org/distfiles/pcre-8.45.tar.bz2
Resolving distfiles.gentoo.org... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘distfiles.gentoo.org’
>>> Downloading 'https://download.sourceforge.net/pcre/pcre-8.45.tar.bz2'
--2021-08-16 20:18:25--  https://download.sourceforge.net/pcre/pcre-8.45.tar.bz2
Resolving download.sourceforge.net... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘download.sourceforge.net’
>>> Downloading 'ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.45.tar.bz2'
--2021-08-16 20:18:25--  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.45.tar.bz2
           => ‘/var/cache/distfiles/pcre-8.45.tar.bz2.__download__’
Resolving ftp.csx.cam.ac.uk... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘ftp.csx.cam.ac.uk’
>>> Downloading 'https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.bz2'
--2021-08-16 20:18:25--  https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.bz2
Resolving ftp.pcre.org... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘ftp.pcre.org’
!!! Couldn't download 'pcre-8.45.tar.bz2'. Aborting.
 * Fetch failed for 'dev-libs/libpcre-8.45', Log file:
 *  '/var/tmp/portage/dev-libs/libpcre-8.45/temp/build.log'


More info:
Code:

cat /etc/resolv.conf
nameserver 8.8.8.8

ls -l /etc/resolv.conf
-rw-r--r-- 1 root root 19 Aug 16 06:34 /etc/resolv.conf

ping google.com
PING google.com (142.250.184.14) 56(84) bytes of data.
64 bytes from mad41s10-in-f14.1e100.net (142.250.184.14): icmp_seq=1 ttl=119 time=16.9 ms

curl distfiles.gentoo.org
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
                <HTML>
                 <HEAD>
                    <script>
...


I tried it without domain name:
Code:

GENTOO_MIRRORS="http://195.181.167.20/" emerge --ask --update --deep --newuse @world
...
>>> Downloading 'http://195.181.167.20/distfiles/layout.conf'
--2021-08-16 20:26:39--  http://195.181.167.20/distfiles/layout.conf
Connecting to 195.181.167.20:80... failed: Permission denied.
Retrying.

--2021-08-16 20:26:40--  (try: 2)  http://195.181.167.20/distfiles/layout.conf
Connecting to 195.181.167.20:80... failed: Permission denied.
Retrying.

--2021-08-16 20:26:42--  (try: 3)  http://195.181.167.20/distfiles/layout.conf
Connecting to 195.181.167.20:80... failed: Permission denied.
Giving up.

!!! Couldn't download '.layout.conf.195.181.167.20'. Aborting.
>>> Downloading 'http://195.181.167.20/distfiles/pcre-8.45.tar.bz2'
--2021-08-16 20:26:42--  http://195.181.167.20/distfiles/pcre-8.45.tar.bz2
Connecting to 195.181.167.20:80... failed: Permission denied.
Retrying.
...


I would appreciate your collaboration to solve this problem.


Last edited by mvasi90 on Wed Aug 18, 2021 1:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Aug 16, 2021 7:00 pm    Post subject: Reply with quote

mvasi90,

Welcome to Gentoo. I suspect you have a typo in make.conf.
Maybe
Code:
emerge --info
will show it?
Post the output.

As a workaround, try
Code:
GENTOO_MIRRORS=""  emerge --ask --verbose --update --deep --newuse @world

Don't make a habit of that. It bypasses the Gentoo mirror system and fetches directly from the source projects own repos.
Its generally a badthing but for testing, its worth trying.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Mon Aug 16, 2021 8:48 pm    Post subject: Reply with quote

Quote:
Welcome to Gentoo.

Thank you!

Quote:
I suspect you have a typo in make.conf.


I copied it from /usr/share/portage/config/repos.conf

Code:

emerge --info
Portage 3.0.20 (python 3.9.6-final-0, default/linux/arm64/17.0, gcc-10.3.0, glibc-2.33-r1, 4.14.83-perf+ armv8l)
=================================================================
System uname: Linux-4.14.83-perf+-armv8l-with-glibc2.33
KiB Mem:     7708380 total,    937640 free
KiB Swap:    1048572 total,    946228 free
Timestamp of repository gentoo: Mon, 16 Aug 2021 00:45:01 +0000
Head commit of repository gentoo: 3fb0c76689b47e4dca1ccecd57eca16b17788654
sh bash 5.1_p8
ld GNU ld (Gentoo 2.35.2 p1) 2.35.2
app-shells/bash:          5.1_p8::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          3.9.6::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.35.2::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:
    sync-rsync-verify-max-age: 24

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl arm64 bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pam pcre readline seccomp split-usr ssl tcpd unicode xattr zlib" ADA_TARGET="gnat_2018" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS


Same result:
Code:

GENTOO_MIRRORS=""  emerge --ask --verbose --update --deep --newuse @world

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-libs/libpcre-8.45:3::gentoo  USE="bzip2 cxx jit readline recursion-limit (split-usr) (unicode) zlib -libedit -pcre16 -pcre32 -static-libs*" 1542 KiB
[ebuild     U  ] net-libs/libnsl-1.3.0-r2:0/2::gentoo [1.3.0-r1:0/2::gentoo] USE="-static-libs" 314 KiB
[ebuild     U  ] dev-libs/libpcre2-10.37-r2:0/3::gentoo [10.36-r1:0/0::gentoo] USE="bzip2 jit pcre16 readline recursion-limit (split-usr) unicode zlib -libedit -pcre32 -static-libs" 1691 KiB
[ebuild   R    ] dev-libs/openssl-1.1.1k-r1:0/1.1::gentoo  USE="asm -bindist* -rfc3779 -sctp -sslv3 -static-libs -test -tls-compression -tls-heartbeat -vanilla" 9594 KiB
[ebuild     U  ] dev-perl/Module-Build-0.423.100::gentoo [0.422.400::gentoo] USE="-test" 297 KiB
[ebuild     U  ] dev-perl/SGMLSpm-1.1-r2::gentoo [1.1-r1::gentoo] USE="-test%" 112 KiB
[ebuild  N     ] perl-core/Scalar-List-Utils-1.560.0::gentoo  170 KiB
[ebuild     U  ] virtual/perl-Scalar-List-Utils-1.560.0::gentoo [1.550.0-r1::gentoo] 0 KiB
[blocks b      ] >perl-core/Scalar-List-Utils-1.550.0-r999 (">perl-core/Scalar-List-Utils-1.550.0-r999" is blocking virtual/perl-Scalar-List-Utils-1.550.0-r1)
[ebuild   R    ] sys-libs/pam-1.5.1::gentoo  USE="filecaps* (split-usr) (-audit) -berkdb -debug -nis (-selinux)" 1382 KiB
[ebuild     U  ] dev-lang/python-3.9.6_p1:3.9::gentoo [3.9.6:3.9::gentoo] USE="gdbm ipv6 ncurses readline sqlite ssl xml -bluetooth -build -examples (-hardened) -test -tk -verify-sig -wininst" 18618 KiB
[ebuild     U  ] sys-devel/m4-1.4.19::gentoo [1.4.18-r2::gentoo] USE="nls%* -examples" 1617 KiB
[ebuild     U  ] sys-apps/kmod-29::gentoo [28::gentoo] USE="lzma (tools) zlib -debug -doc -pkcs7 -python -static-libs -zstd" PYTHON_TARGETS="python3_9 -python3_8" 548 KiB
[ebuild     U  ] sys-apps/iproute2-5.13.0-r1::gentoo [5.10.0-r1::gentoo] USE="iptables ipv6 -atm -berkdb -bpf% -caps -elf -libbsd -minimal (-selinux)" 826 KiB
[ebuild     U  ] net-misc/curl-7.78.0-r1::gentoo [7.77.0-r1::gentoo] USE="ftp http2 imap ipv6 openssl pop3 progress-meter smtp ssl tftp -adns -alt-svc -brotli -gnutls -gopher -hsts -idn -kerberos -ldap -mbedtls (-nghttp3) -nss (-quiche) -rtmp -samba -ssh -sslv3 -static-libs -telnet -test -threads (-winssl) -zstd (-metalink%)" CURL_SSL="openssl -gnutls -mbedtls -nss (-winssl)" 2384 KiB
[ebuild     U  ] dev-libs/nettle-3.7.3:0/8-6::gentoo [3.7.2:0/8-6::gentoo] USE="asm gmp -doc -static-libs -test" CPU_FLAGS_ARM="(-neon)" 2329 KiB
[ebuild     U  ] dev-libs/libtasn1-4.17.0:0/6::gentoo [4.16.0:0/6::gentoo] USE="-doc -static-libs -test (-valgrind)" 1862 KiB
[ebuild     U  ] app-portage/portage-utils-0.92::gentoo [0.90::gentoo] USE="nls openmp qmanifest qtegrity -static" 1778 KiB
[ebuild   R    ] net-misc/openssh-8.6_p1-r2::gentoo  USE="pam pie scp ssl -X -X509 (-audit) -bindist* (-debug) -hpn -kerberos (-ldns) -libedit -livecd -sctp -security-key (-selinux) -static -test -xmss" 1745 KiB
[ebuild   R    ] net-misc/iputils-20210202::gentoo  USE="arping filecaps* ipv6 nls ssl -caps -clockdiff -doc -gcrypt -idn -nettle -rarpd -rdisc -static -tftpd -tracepath -traceroute6" 520 KiB
[ebuild     U  ] dev-python/setuptools-57.4.0-r2::gentoo [57.0.0::gentoo] USE="-test" PYTHON_TARGETS="python3_9 (-pypy3) (-python3_10) -python3_8" 2100 KiB
[ebuild     U  ] sys-fs/eudev-3.2.10-r1::gentoo [3.2.10::gentoo] USE="hwdb kmod -introspection -rule-generator (-selinux) -static-libs -test" 1916 KiB
[ebuild     U  ] virtual/udev-217-r3::gentoo [217-r2::gentoo] 0 KiB

Total: 22 packages (16 upgrades, 1 new, 5 reinstalls), Size of downloads: 51334 KiB
Conflict: 1 block

Would you like to merge these packages? [Yes/No]

>>> Verifying ebuild manifests

>>> Running pre-merge checks for dev-lang/python-3.9.6_p1

>>> Running pre-merge checks for net-misc/openssh-8.6_p1-r2

>>> Running pre-merge checks for sys-fs/eudev-3.2.10-r1
 *
 * As of 2013-01-29, eudev-3.2.10 provides the new interface renaming functionality,
 * as described in the URL below:
 * https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
 *
 * This functionality is enabled BY DEFAULT because eudev has no means of synchronizing
 * between the default or user-modified choice of sys-fs/udev.  If you wish to disable
 * this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules
 * exists: touch /etc/udev/rules.d/80-net-name-slot.rules
 *

>>> Emerging (1 of 22) dev-libs/libpcre-8.45::gentoo
>>> Downloading 'https://download.sourceforge.net/pcre/pcre-8.45.tar.bz2'
--2021-08-16 22:27:21--  https://download.sourceforge.net/pcre/pcre-8.45.tar.bz2
Resolving download.sourceforge.net... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘download.sourceforge.net’
>>> Downloading 'ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.45.tar.bz2'
--2021-08-16 22:27:21--  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.45.tar.bz2
           => ‘/var/cache/distfiles/pcre-8.45.tar.bz2.__download__’
Resolving ftp.csx.cam.ac.uk... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘ftp.csx.cam.ac.uk’
>>> Downloading 'https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.bz2'
--2021-08-16 22:27:21--  https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.bz2
Resolving ftp.pcre.org... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘ftp.pcre.org’
!!! Couldn't download 'pcre-8.45.tar.bz2'. Aborting.
 * Fetch failed for 'dev-libs/libpcre-8.45', Log file:
 *  '/var/tmp/portage/dev-libs/libpcre-8.45/temp/build.log'

>>> Failed to emerge dev-libs/libpcre-8.45, Log file:

>>>  '/var/tmp/portage/dev-libs/libpcre-8.45/temp/build.log'

 * Messages for package sys-fs/eudev-3.2.10-r1:

 *
 * As of 2013-01-29, eudev-3.2.10 provides the new interface renaming functionality,
 * as described in the URL below:
 * https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
 *
 * This functionality is enabled BY DEFAULT because eudev has no means of synchronizing
 * between the default or user-modified choice of sys-fs/udev.  If you wish to disable
 * this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules
 * exists: touch /etc/udev/rules.d/80-net-name-slot.rules
 *

 * Messages for package dev-libs/libpcre-8.45:

 * Fetch failed for 'dev-libs/libpcre-8.45', Log file:
 *  '/var/tmp/portage/dev-libs/libpcre-8.45/temp/build.log'
(failed reverse-i-search)`make.conf': GENTOO_MIRRORS=""  e^Crge --ask --verbose --update --deep --newuse @world
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Aug 16, 2021 9:11 pm    Post subject: Reply with quote

mvasi90,

Tell us a bit about the hardware and how yon managed to chroot on an arm64 system.
What is the underlying system you are chrootinig from?

As its an arm system it belongs in Gentoo an ARM. I'll move the topic now.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Aug 16, 2021 9:12 pm    Post subject: Reply with quote

Moved from Networking & Security to Gentoo on ARM.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Mon Aug 16, 2021 10:37 pm    Post subject: Reply with quote

Device information
LG Z5 Pro GT
Snapdragon 855 Aarch64
Android 9
root access with Magisk
Terminal emulator: Termux

I'm using this script to chroot:

Code:

#!/bin/bash

# Gentoo chroot on Android
#
# Author: Vasile M.
# 2021-08-16

[[ "`id -u`" -ne 0 ]] && sudo bash "$0" && exit

LOOP="loop6"
CHROOT="/data/gentoo"
IMAGE="/data/data/com.termux/files/home/gentoo.img"


ce() {
   if [[ "$1" -ne 0 ]];then
      echo "$2"
      [[ "$3" ]] && exit $3
   fi
}

# Umouting
um() {
   # kill all processes using the chroot folder
   ps=(`lsof -Fp "$CHROOT" | sed "s/^p//"`)
   for pid in "${ps[@]}"; do
      kill -9 "$pid"
   done

   umount "$CHROOT/dev/pts"
   umount "$CHROOT/dev/shm"
   umount "$CHROOT/dev"
   umount "$CHROOT/data/dalvik-cache"
   umount "$CHROOT/vendor"
   umount "$CHROOT/sys"
   umount "$CHROOT/system"
   umount "$CHROOT/sdcard"
   umount "$CHROOT/proc"
   umount "$CHROOT/tmp"
   umount "$CHROOT/data/data"
   umount "$CHROOT"

   # detaching is not needed. Device is auto detached when the mount point is unmounted
   #losetup -d /dev/block/$LOOP

}

if [[ "$1" != "" ]]; then
   case "$1" in
      umount|exit)
         um
         ;;
      *)
         echo "Allowed options are: umount and exit (both used to umoumt the chroot)."
         ;;

      esac
      exit

fi

grep "$CHROOT" /proc/mounts -q 2>&1 > /dev/null

if [[ "$?" -ne 0 ]]; then

   # preparing chroot
   mkdir -p "$CHROOT"
   ce $? "Error creating $CHROOT" 1
   losetup /dev/block/$LOOP "$IMAGE"
   ce $? "Error attaching $IMAGE to /dev/block/$LOOP" 6
   mount -o noatime,barrier=0,commit=60 /dev/block/$LOOP "$CHROOT"
   ce $? "Error mounting /dev/block/$LOOP to $CHROOT" 7

   # Creating mountpoints
   mkdir -p "$CHROOT/data/data"
   ce $? "Error creating /data/data" 1
   mkdir -p "$CHROOT/dev/shm"
   ce $? "Error creating /dev/shm" 2
   mkdir -p "$CHROOT/data/dalvik-cache"
   ce $? "Error creating /data/dalvik-cache" 3
   mkdir -p "$CHROOT/vendor"
   ce $? "Error creating /vendor" 4
   mkdir -p "$CHROOT/system"
   ce $? "Error creating /system" 5
   mkdir -p "$CHROOT/sdcard"
   ce $? "Error creating /sdcard" 6

   # Mouting
   mount --rbind /dev "$CHROOT/dev"
   ce $? "Error mounting /dev" 7

   mkdir -p "$CHROOT/dev/shm"
   ce $? "Error creating /dev/shm after mounting /dev" 8

   mount -o bind /data/dalvik-cache "$CHROOT/data/dalvik-cache"
   ce $? "Error mounting /data/dalvik-cache" 9
   mount -o bind /vendor "$CHROOT/vendor"
   ce $? "Error mounting /vendor" 11
   mount --rbind /dev/pts "$CHROOT/dev/pts"
   ce $? "Error mounting /dev/pts" 12
   mount -t tmpfs -o nosuid,nodev,noexec shm "$CHROOT/dev/shm"
   ce $? "Error mounting /dev/shm" 13
   mount --rbind /sys "$CHROOT/sys"
   ce $? "Error mounting /sys" 14
   mount --rbind /system "$CHROOT/system"
   ce $? "Error mounting /system" 15
   mount --rbind /sdcard "$CHROOT/sdcard"
   ce $? "Error mounting /sdcard" 16
   #mount --rbind /proc "$CHROOT/proc"
   mount -t proc /proc "$CHROOT/proc"
   ce $? "Error mounting /proc" 17
   mount -t tmpfs tmpfs "$CHROOT/tmp"
   ce $? "Error mounting tmpfs" 18
   mount -o bind /data/data "$CHROOT/data/data"
   ce $? "Error mounting /data/data" 19

   sed "/export ANDROID_DATA=\"\/data\"/d" -i "$CHROOT/etc/profile"
   echo "export ANDROID_DATA=\"/data\"" >> "$CHROOT/etc/profile"
   sed "/export ANDROID_ROOT=\"\/system\"/d" -i "$CHROOT/etc/profile"
   echo "export ANDROID_ROOT=\"/system\"" >> "$CHROOT/etc/profile"
   #sed "/export PREFIX=\"\/data\/data\/com.termux\/files\/usr\"/d" -i "$CHROOT/etc/profile"
   #echo "export PREFIX=\"/data/data/com.termux/files/usr\"" >> "$CHROOT/etc/profile"
   sed "/export DISPLAY=\":1\"/d" -i "$CHROOT/etc/profile"
   echo "export DISPLAY=\":1\"" >> "$CHROOT/etc/profile"

fi

unset LD_PRELOAD
unset PREFIX
export BASH=/usr/bin/bash
export HISTFILE=/dev/null
export SHELL=/usr/bin/bash
export TMPDIR=/tmp
#chroot "$CHROOT" /bin/bash -l -c "su - user"
chroot "$CHROOT" /bin/bash -l

wait

while :; do
   echo -n "Unmount chroot? [Y/n]: "
   read conf
   case "$conf" in
      ""|y|Y)
         um
         break
         ;;
      "n")
         break
         ;;
   esac

done



Note:The script is the same as I use for ArchLinux chroot in the same device.
It can be improved, for example changing the "ce" function and calling it like: mount ... || die "error msg" err_code.
But for now it's okay.

ArchLinux works without these lines. I put them to fix some problems in Gentoo.
Code:

unset LD_PRELOAD
unset PREFIX
export BASH=/usr/bin/bash
export HISTFILE=/dev/null
export SHELL=/usr/bin/bash
export TMPDIR=/tmp
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Mon Aug 16, 2021 11:46 pm    Post subject: Reply with quote

Some important information.
This is the real output of the emerge command:
Code:

Total: 22 packages (16 upgrades, 1 new, 5 reinstalls), Size of downloads: 51334 KiB
Conflict: 1 block

Would you like to merge these packages? [Yes/No]
Sorry, response '               ' not understood. [Yes/No]

>>> Verifying ebuild manifests

>>> Running pre-merge checks for dev-lang/python-3.9.6_p1
Unable to unshare: EINVAL (for FEATURES="pid-sandbox")
Unable to unshare: EINVAL (for FEATURES="ipc-sandbox network-sandbox pid-sandbox")

>>> Running pre-merge checks for net-misc/openssh-8.6_p1-r2
Unable to unshare: EINVAL (for FEATURES="pid-sandbox")
Unable to unshare: EINVAL (for FEATURES="ipc-sandbox network-sandbox pid-sandbox")

>>> Running pre-merge checks for sys-fs/eudev-3.2.10-r1
Unable to unshare: EINVAL (for FEATURES="pid-sandbox")


As you can see, on every package appears the warning: "Unable to unshare: EINVAL..."
To solve that, I'm using this:
Code:

export FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox"


But I don't like it. I am paranoid and everything related to security should not be disabled.

Kernel and Kernel config options:
Code:

uname -a
Linux localhost 4.14.83-perf+ #1 SMP PREEMPT Wed Jul 10 04:58:49 CST 2019 armv8l GNU/Linux

gzip -dc /proc/config.gz  | grep _NS
# CONFIG_UTS_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
CONFIG_NET_NS=y
CONFIG_NF_CONNTRACK_NETBIOS_NS=y
# CONFIG_NET_NSH is not set
# CONFIG_NS83820 is not set
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Tue Aug 17, 2021 12:50 am    Post subject: Reply with quote

The Portage ebuild checks for the namespaces below:
Code:
       local CONFIG_CHECK="~IPC_NS ~PID_NS ~NET_NS ~UTS_NS"

So why are CONFIG_UTS_NS and CONFIG_PID_NS disabled? CONFIG_IPC_NS doesn't even seem to exist? Maybe because 4.14 is quite old....
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Tue Aug 17, 2021 9:16 am    Post subject: Reply with quote

mike155 wrote:
So why are CONFIG_UTS_NS and CONFIG_PID_NS disabled? CONFIG_IPC_NS doesn't even seem to exist? Maybe because 4.14 is quite old....

For now I cannot update Android. The device came with the update option disabled and the bootloader unlocked.
I'll update it when official LineageOS for this model comes out, because I don't have enough time to port it to this device. (Kernel sources are not published).
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Wed Aug 18, 2021 12:59 am    Post subject: Reply with quote

dmesg shows nothing when emerge is running. No SELinux, iptables or any other log.

The iptables default policy is DROP for INPUT, OUTPUT and FORWARD chains because I'm using a whitelist mode. I changed it to ALLOW but emerge keeps giving the same error.

I have added the rule "iptables -A OUTPUT -j LOG --log-uid", but nothins appears in "dmesg -w" (related to emerge).

If ArchLinux works with the same configuration, I think it is Gentoo problem.
I also tested the emerge with --debug and --verbose param, but no relevant information about the error.
Back to top
View user's profile Send private message
mvasi90
n00b
n00b


Joined: 16 Aug 2021
Posts: 19

PostPosted: Wed Aug 18, 2021 1:04 pm    Post subject: Reply with quote

Solved.

The user portage should be added to the aid_inet group.
The aid_inet group (the group name is not important) should be added with the gid 3003 (Android inet).

Code:

groupadd -g 3003 -r aid_inet
usermod -aG aid_inet portage
usermod -aG aid_inet root


Note: There are more groups to be added:
Code:

grep aid /etc/group

aid_net_bt_admin:x:3001:root
aid_net_bt:x:3002:root
aid_inet:x:3003:root,avahi,user
aid_inet_raw:x:3004:root,avahi
aid_inet_admin:x:3005:root,avahi                                                                                                                           aid_sdcard_rw:x:1015:user
aid_media_rw:x:1023:user,root
aid_everybody:x:9997:user


aid_net_bt and aid_net_bt_admin for bluetooth permissions
aid_inet for internet access
aid_inet_raw for network raw access
aid_media_rw for storage permission (/sdcard)
aid_everybody for access some files
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum