Root many android linux

/4te.me

Быстроman как получить root-права на Android смартфоне. Я буду использовать OnePlus 3 и Android 8.0, но инструкция должна подойти и к другим устройствам.

Предисловие

Все действия вы выполняете на свой страх и риск. При неправильной последовательности, можно потерять данные или превратить телефон в кирпич. Также, важно понимать, что рутованный девайс, кроме некоторых удобств, несет в себе риски безопасности. Будьте внимательны.

Подготовка

Для начала, надо на компьютер установить adb и fastboot. Это утилитки из Android SDK для работы с подключенным по USB телефоном.

Для Windows есть удобный установщик adb, fastboot — https://forum.xda-developers.com/showthread.php?t=2317790

Вот здесь официальные дистрибутивы под все платформы — https://developer.android.com/studio/#downloads

Далее качаем TWRP. Это что-то типа livecd для телефона. Образ некой системы, в которой загрузится телефон, и в ней мы установим приложение Magisk.

TWRP (я брал версию 3.1.0-0-twrp.img) — https://dl.twrp.me/twrp/

Если у вас OnePlus, вот TWRP для них — https://eu.dl.twrp.me/oneplus3/ (надо брать этот twrp если вылетает ошибка dtb not fount)

Magisk — это open source приложение, которое дает рут права на телефон, и позволяет скрывать наличие рута от других приложений, чтобы работал Android Pay. Также, обновления системы, которые прилетают “по воздуху”, не должны сломаться. Лучше использовать Magisk, а не SuperSU.

Теперь включим режим разработчика на телефоне. Для этого в настройках, в разделе “О телефоне”, надо несколько раз нажать на “Номер сборки”. После раза 10-го, появится сообщение “Теперь вы разработчик”, и в настройках появится новый пункт “Для разработчиков”.

Разблокировка загрузчика

Разблокировка загрузчика удаляет все данные с телефона и sd-карты

Также, разблокировка загрузчика, без установленного далее Magisk, может сломать Android Pay.

В настройках “Для разработчиков” включаем “Отладка по USB”, “Заводская разблокировка” и “Варианты перезагрузки”

Загружаемся в fastboot mode. Для этого зажимаем кнопку выключения, выбираем “Перезагрузка” и далее “Загрузчик” Второй способ — выключить телефон, зажать клавишу громкости вверх и клавишу включения. Через несколько секунд появится fastboot mode

Подключаем телефон по USB-кабелю. И проверяем что устройство доступно в системе. Для этого выполняем:

ПОСЛЕ ЭТОЙ КОМАНДЫ ТЕЛЕФОН ПЕРЕЗАГРУЗИТСЯ И ВСЕ ДАННЫЕ БУДУТ УДАЛЕНЫ. Делайте бэкапы всех данных до этого шага.

Теперь загрузчик разблокирован.

Получение root

  1. Подключаем телефон к компьютеру в режиме передачи файлов MTP
  2. Заливаем на телефон zip-файл Magisk, скачанный выше из github
  3. Загружаемся в TWRP. Для этого перезагружаем телефон в fastboot mode (см. пункт 2 инструкции выше как разблокировать загрузчик) и на компьютере выполняем:

Все, теперь с помощью Magisk Manager можно выдавать root-овые права приложениям, которые их запрашивают, а также скрывать от других приложений, что этот девайс рутованный, чтобы не сломать Android pay.

Источник

Root many android linux

Краткое описание:
Установка Linux на Android в Termux без рут-прав

Andronix lets you install a Linux system on your Android Device without root. We found out that using Linux on Android is quite useful and lets you do many heavy tasks on your Android device.

This app lets you install various popular Linux distributions on your Android device by using Termux and PRoot functionality on the Android system. The application also provides you a graphics layer or Desktop environment (Xfce, MATE, LXDE, LXQT and KDE) on the top of the Linux shell which makes the user experience much better than working on a Linux command line.

* Manjaro is now available with xfce, lxqt, lxde and mate.

* Ubuntu KDE is now available which is great success.

* KDE Performance optimization — Better performance.

* Added multiple Window manager — Better look in KDE.

* Prinstalled softwares and themes — Makes a better aesthetic.

* AndroNix Premium — We have released AndroNix Premium with tons of features.

* Dark Mode — Use AndroNix at night comfortably.

* AndroNix Commands — A special addition to the family of AndroNix. It’s all you need to manage your commands throughout your life. Just copy and paste!

* AndroNix Web App — We have also released our web app to compliment AndroNix commands on Android, so you can now access Commands on any internet connected device.

* AndroNix Feed — We saw that since the last release you guys were really happy about the blogs we posted. So now we have a dedicated blog feed to make a better use of Linux and the power it offers.

* Offline Downloads — Internet can be unpredictable sometimes, but don’t worry we’re introducing offline support of Linux distros, though you’ll be still needing internet to download some files depending upon your device at the time of installing.

* Robust Documentation — We’ve been working on writing some documentations for weeks now. This will enable you to help yourself without waiting for us to reply.

* Priority Support — AndroNix Premium bring priority support with it at no extra cost. IF you’re an AndroNix Premium member just enjoy the blazing fast support, on the platform you like!

* Communities budding — We now support official AndroNix communities on Telegram and WhatsApp. We will soon expand to other platforms as well.

* UI overhaul — We’ve redisgned almost every element the our app and worked on user experience more than ever

* Automation Added — If you choose AndroNix Premium, we’ll handle everything for you. Just login and forget the rest.

* Profile Tab Added — Profile let’s you see your current status (Premium or not). If you’re a premium member, profile section has many things for you.

Читайте также:  Smart tv android full hd 1080p

* Termux is now available offline — We now offer an offline copy of Termux within
AndroNix.

If you are new to Linux, we provide you easy and hassle-free instructions which makes your first impression of Linux a lot better. In case you still face some issues you can easily contact us on various platforms mentioned in the app. We ensure you that we will contact you as soon as possible.

— No root permissions required.
— Distros we support:

* Manjaro
* Ubuntu
* Kali Linux
* Debian
* Parrot OS
* Fedora
* Arch Linux

— Desktop environments we support:
* KDE
* LXDE
* LXQT
* MATE
* XFCE

— One click install/uninstall feature.
— Features multiboot linux system.

— Termux in required.

— Android version should be at least 5.1

— Device architecture supported: ARMv7, ARM64, x64.

Требуется Android: 5.1 и выше
Русский интерфейс: Нет

Источник

AnLinux: простой способ установить Linux-окружение на Android-телефон без рута

Любой телефон или планшет, работающий на Android, — это устройство, которое управляется ОС Linux. Да, очень модифицированной ОС, но все же основа Android — ядро Linux. Но, к сожалению, для большинства телефонов опция «снести Android и поставить дистрибутив по своему вкусу» недоступна.

Поэтому, если хочется Linux на телефоне, приходится покупать специализированные гаджеты вроде PinePhone, о котором мы уже писали в одной из статей. Но есть еще один способ получить Linux-окружение практически на любом смартфоне, причем без root-доступа. Поможет в этом инсталлятор, который называется AnLinux.

Что такое AnLinux?

Это специализированное ПО, которое дает возможность использовать Linux на телефоне при помощи монтирования образа, содержащего root-файловую систему любого из дистрибутивов, включая Ubuntu, Kali, Fedora, CentOS, OpenSuse, Arch, Alpine и многих других. Инсталлятор использует PRoot для эмуляции root-доступа.

PRoot перехватывает все выполняемые пользователем вызовы, которые требуют в обычной ситуации root-доступа, и обеспечивает их работоспособность в обычных условиях. В PRoot используется системный вызов ptrace для отладки ПО, который помогает достичь цели. С PRoot все это можно сделать как с chroot, но без root-прав. Кроме того, PRoot предоставляет фейковый доступ пользователю для пседвофайловой системы.

AnLinux — небольшая программа. Но этого достаточно, ведь единственное ее предназначение — установка образов систем и запуск скриптов, поднимающих пользовательское окружение. Когда все сделано, пользователь получает вместо смартфона Linux-ПК, причем Android продолжает работать на фоне. Подключаемся к устройству при помощи VNC-вьювера или терминала, и можно работать.

Конечно, это не идеальный вариант «завести» Linux на смартфоне, но он вполне рабочий.

С чего начать?

Основное — Android-смартфон с версией ОС не ниже Lollipop. Кроме того, пойдет и 32-битное или 64-битное ARM или x86-устройство. Кроме того, потребуется солидный объем свободного файлового пространства. Для этого можно использовать карту памяти или просто устройство с большим объемом внутренней памяти.

Кроме того, потребуется:

  • AnLinux (вот ссылка на Google Play).
  • Termux (снова понадобится Google Play).
  • VNC Client (VNC Viewer — хороший вариант).
  • Bluetooth-клавиатура (опционально).
  • Bluetooth-мышь (опционально).
  • HDMI кабель для мобильного телефона (опционально).

Termux и VNC нужны для получения доступа к своему «компьютеру на Linux». Последние три элемента требуются лишь для того, чтобы обеспечить комфортную работу с телефоном и установщиком. HDMI-кабель нужен только в том случае, если пользователю удобнее работать с большим экраном, а не вглядываться в дисплей телефона.

Что же, приступим

Как только установлен Termux, получаем полноценную консоль. Да, рута нет (если телефон не рутован), но ничего страшного. Следующий шаг — установка образа для дистрибутива Linux.

Теперь нужно открыть AnLinux и затем — выбрать Dashboard из меню. Всего есть три кнопки, но выбрать можно лишь одну, первую. После этого появляется меню выбора дистрибутива. Можно выбрать даже не один, а несколько, но в этом случае понадобится большой объем свободного файлового пространства.

После выбора дистрибутива активируются две другие кнопки. Вторая позволяет загрузить в буфер обмена команды, необходимые для загрузки и установки Linux. Обычно это pkg, wget команды и скрипт для их выполнения.

Третья кнопка запускает Termux, так что команды можно вставлять в консоль. Как только все сделано, запускается скрипт, позволяющий загрузить окружение дистрибутива. Для вызова дистрибутива нужно каждый раз запускать скрипт, но установку проводим только один раз.

А что с графической оболочкой?

Если она нужна, то следует лишь выбрать меню для десктопного окружения и использовать больше кнопок — появится не три, а больше. Кроме самого дистрибутива, нужно выбрать еще и оболочку, например, Xfce4, Mate, LXQt или LXDE. В целом, ничего сложного.

Потом кроме скрипта, который запускает дистрибутив, потребуется еще один — он активирует сервер VNC. В целом, весь процесс простой и понятный, он вряд ли способен вызвать затруднения.

После запуска сервера VNC подключаемся со стороны клиента, воспользовавшись вьювером. Требуется знать порт и localhost. Все это сообщает скрипт. Если все сделано правильно, то пользователь получает доступ к своей виртуальной Linux-системе. Производительность современных телефонов на высоте, так что особых проблем не будет. Конечно, вряд ли смартфон сможет полностью заменить десктоп, но, в целом, все это работает.

Этот способ может пригодиться, если вдруг нужно срочно подключиться к серверу, а вы в машине, без ноутбука (конечно, в этом случае все описанные выше операции с AnLinux уже должны быть выполнены). Виртуальная Linux-машина позволяет подключиться к рабочему или домашнему серверу. А если в автомобиле по какой-то причине оказался дисплей и беспроводная клавиатура, то за считанные секунды в салоне можно организовать рабочий кабинет.

Источник

  • ChrootOnAndroid

Debian install apps on Android

There are a number of free and non-free apps and scripts for Android that allow you to run a Debian chroot on an Android device.

Maintained

Termux: Debian/Ubuntu environment without root access

MaruOS: uses Linux containers

AnLinux-App: downloads pre-built installs, uses proot

Unmaintained

Lil’ Debi: uses cdebootstrap to run the full install process on the Android device, then manage starting and stopping the chroot. It aims to provide a single Debian install in parallel with Android while touching the Android internals as little as possible. It provides a complete Debian install process and transparent boot integration. The app includes the debian-keyring.gpg so cdebootstrap fully verifies the packages it downloads from the beginning. It calls /etc/init.d/rc 2 on boot and /etc/init.d 0 on shutdown to provide boot integration.

DebianKit: installs Debian in same location as Android. This is possible since Android uses almost none of the standard UNIX paths, so Debian can just be copied directly onto the same file system. The one notable exception is that Android has a symlink to /system/etc at /etc, and there are a few files in /system/etc.

Читайте также:  Детективы донцовой для андроида

DebKit (different from DebianKit) (unmaintained)

GNURoot: lets you install a limited Debian environment without root access

Manual installation in a chroot

Root your phone

Side-loading z4root might be an option.

There maybe other options depending on your phone.

Install community Android variant

Vendor Android builds often have proprietary drivers/apps, anti-features, spyware or telemetry preinstalled. It is recommended to switch to a community maintained open source variant of Android.

Potentially useful tweaks

Set CPU to 710 MHz with the interactiveX governor. YMMV

  • Side-loaded SSHDroid
  • Choose Android devices architecture

    Almost all Android devices have ARM processors and can use one of the Debian ports to ARM.

    Modern high-end devices have 64-bit ARMv8 processors and can use the Debian arm64 architecture.

    Some lower-end or older devices have 32-bit ARMv7 processors and can use the armhf architecture.

    Some very old devices have very old 32-bit ARM processors and can only use the armel architecture.

    Some rare devices have 64-bit x86 processors and can use the Debian amd64 architecture.

    To find out which Debian architecture to use, look up the device, chip and processor on Wikipedia to see which version of ARM it supports and chose the appropriate port from the list above.

    Choose install device, tool and location

    The Debian install can be created directly on the Android device or on a second device running Linux such as a laptop or desktop.

    To create the installation on the Android device you will have to be using an install tool that supports running under Android. Probably only debootstrap supports this. You will need to copy the script over to the Android device and then run it there, probably via the adb shell.

  • To create the installation on another device it is recommended that it run Debian, but some other distributions may contain the needed tools.
  • You can use debootstrap, mmdebstrap or other system build tools to create a minimal Debian installation.

    • Most tools will require root on the device where the install is created.

    Most modern Android devices do not have a µSD card slot so the install will probably be placed on the internal storage.

    • When installing to the internal storage of the Android device from a second device, you will need create the install in a directory on your Linux device and then transfer it over to the Android device.
    • When using a µSD card, you will plug the µSD card into the workstation (possibly via an adapter), create the install on the µSD card, unplug the µSD card and plug the µSD card into your Android device.

    Preparation

    If creating the install on a second device, install the install creation tool that you chose above, using the Debian packages if the second device is running Debian.

    If creating the install from a second device that doesn’t use an ARM processor and then transferring it to an Android device that uses an ARM processor, install the qemu-user-static package to enable emulation of ARM programs. If the device you are running on cannot run binaries for the processor of the Android device natively or emulated, then you will need to use the debootstrap tool, specify the --foreign option when creating the install, transfer the install to the Android device and finalise the install in a second stage on the Android device before using the install.

    Most methods of creating a Debian install require root. Gain root using the right tool for the device where you will be creating the install. On Debian and Linux systems that is probably sudo -i. When using adb to connect to an Android device, use adb root and then adb shell to get a root shell.

    Parameters

    Set the parameters for the install based on the choices made above:

    Set the appropriate Debian mirror. If you have a local mirror, replace the URL below with your local mirror.

    Set the appropriate Debian release:

    Set the appropriate Debian install variant. Use minbase for the most minimal option. For a slightly larger install, omit the variant option when creating the install.

    Set the directory that will contain the Debian install and the location of the Debian install itself.

    Create install

    The tools to create Debian installs are usually run like this:

    Read the documentation for the tool you are using to ensure this is correct.

    If the device you are running on cannot run binaries for the processor of the Android device natively or emulated, then the --foreign option will be needed here and after the transfer is done, a second-stage step will be needed.

    Transfer install to internal storage

    Create an archive of the Debian install:

    Transfer the Debian install over to the device:

    Create the directory where the install will be stored:

    Unpack the Debian install archive:

    Advanced option using less temporary storage

    If you don’t have enough space on either the Android device or the second device to archive, transfer and unpack the Debian archive, you can use this section to transfer without using additional storage.

    Set the location for the scripts and Debian install:

    Create a shell script called adb_shell.sh containing this:

    Create a shell script called unpack using this command:

    Transfer it to the device:

    Transfer the chroot using tar:

    Convenience run-debian tool

    Create a script called run-debian for entering the Debian chroot, running a command and cleaning up afterwards:

    Transfer it to the device:

    Finalise install

    If you used the debootstrap tool and the --foreign option above, you will need to finalise the install with a second stage. Most of the time this isn’t needed.

    Using the installation

    Use the run-debian tool to get a bash shell:

    Then you can install needed Debian packages as you normally would with a minimal Debian install.

    Читайте также:  Промокоды кроссаут 2020 андроид

    Using SSHDroid you can get a chroot from the Android user interface rather than via adb shell.

    Running Debian binaries outside the chroot

    If you need to run binaries from inside the chroot outside the chroot, you can use ld.so:

    Available memory

    Android pre-loads applications (in some case that the user has never started) when there is free memory. This reduces the memory available to applications in a chroot.

    It looks like the *_MEM properties in /init.rc along with the /sys/module/lowmemorykiller/parameters/minfree could help.

    Zygote starts SystemServer and SystemServer restarts zygote, so simply killing one of them won’t work. The Android-native way of getting rid of zygote and all that descends from it is to just use the ‘stop’ command (in a script or through a remote (root) shell), to restart the whole Android environment you’d use the ‘start’ command:

    The display is now blank and ready for SDL. The input devices only partly work with SDL on the 8120 (write your own code to read /dev/input/event*) but graphics work well.

    Group privileges on Android

    Android uses predefined groups to control permissions. You will likely have to add these groups within your virtualized Linux environment to grant permission for your user to do useful things. For example, if you want to access the /sdcard storage area on your device, you will need to add yourself to group 1015 aid_sdcard_rw.

    Refer to the official AOSP source for the complete list of users and groups. Here is the list for Marshmallow. The package android-permissions automatically sets up all groups used in an Android system (although you still have to manually add users to groups).

    AF_INET privileges

    On Android, you will need to add at least one group 3003 aid_inet for those processes which require access to creating sockets (other security guarded systems particular to Android may need addressing for other applications, search for 3003 aid_inet on the web for more detail).

    APT privilege dropping on Android

    The program apt-get (and all the other APT programs) drops privileges when doing network requests, thus fails because it does not have the inet group. One workaround is to add the user _apt to the group inet (3003) and also set it as the primary group for user _apt (because APT deliberately relinquish all groups except the primary one).

    exim4 and mailman chroot on Android

    As well as altering inet access, the Debian-exim user will have to be added to group 3003. Further, if you experience trouble in the exim mainlog for creating sockets during DNS, try dropping privileges by adding «deliver_drop_privilege=true» to the exim4.conf.template file. For mailman, the standard setup is required, as per the README.Debian file in /usr/share/doc. However the user list must also be added to the group 3003 to allow it to send mail.

    Running GUI along side Android

    You can also try running GUI apps and desktop environments along side Android. There are a number of X11 Server apps on the Google Play store that do a great job. One such X11 app is «XServer XSDL» which is free in the Google Play store.

    An example of how to get this working. Start the chroot, start the X11 Server app, add «export DISPLAY=127.0.0.1:0» to your running chroot, then start your app or desktop environment, at this point you should see it open in the X11 Server app. YMMV though, not all Android devices have the ram or cpu to run this.

    Integrate the Debian boot process

    Debian gives you a huge array of server software to install and run on your Android device in a chroot. It is possible to start and stop everything using the rc scripts that all daemons in Debian install. If you don’t want the shutdown procedure to halt/power-off your phone, you need to remove some rc init scripts. This doesn’t always work, so when you run stop in Debian, it might poweroff your phone. We got it working on Blandroid by running these commands in the debian shell (via ssh is probably the easiest):

    On ?CyanogenMod, we had to remove a lot more scripts to prevent it from shutting down, like sendsigs. But then /etc/init.d/rc 0 no longer shutdown all of the Debian services.

    You probably want to remove all of the networking stuff from your Debian chroot and let Android handle it, otherwise you might have Debian and Android fighting over the network config. Also, you need to replace the Debian call to kill all processes, because it will also kill all Android processes. Instead projects like Lil’ Debi and Crouton (Debian chroot for ChromeOS) have a custom script to kill all processes running in the chroot.

    The scripts to call to start and stop everything automatically:

    start: /etc/init.d/rc 2

    handling /dev

    As of version Lil’ Debi v0.4.4, Android /dev/ is not bind-mounted in chroot. This means no /dev/block/, /dev/log/, /dev/graphics/ and such. Bind-mounting it there results in conflict between Android logger and syslog, so syslog users should not do that, unless they have workaround. Additionally, if /dev/ isn’t bind-mounted some Android executables, such as *am*, *dalvikvm*, *logcat* and many others won’t run from inside chroot.

    Important Android Environment Variables

    Android is a very limited environment, so there are some odd hacks in it. For example, Android does not support rpath for finding shared libraries. Android will only look in the hard-coded system path, i.e. /system/lib and /data/app-lib/com.myapp.packagename. You can make Android look for shared libraries in other paths using the env var LD_LIBRARY_PATH, and some Android apps with native executables rely on that hack.

    Using **su -l** to login into the chroot may result in unsetting of some important Android variables, such as BOOTCLASSPATH and LD_LIBRARY_PATH.

    Booting into Debian instead of Android

    Download the zImage for your version of the Linux kernel that runs on your Android device to your laptop and run fastboot something like this:

    Источник

    Оцените статью