0

I want to install chroot in a custom directory.

I am using kali-nethunter in my Android 6.0. Problem is I am running out of internal storage. So can't install more packages. Nethunter is installed in a chroot in /data/local/nhsystem/ (as default)

I have a 16 GB SD card as ext3 format. It's located in /mnt/expand/d94616e4-3795-49d4-9ecf-f3aad7ec76b5/

How do I install chroot in /mnt/expand/d94616e4-3795-49d4-9ecf-f3aad7ec76b5/

Please don't say off topic. I have asked this question in stack overflow. They told me my question was off topic and suggested me to ask here. I have been searching for this answers about 5 days. I am new with Linux.

  • 1
    Maybe I'm missing something, but why not just mv it there? – Tigger Nov 9 '17 at 11:12
  • I am beginner. Could you please give me the step by step commands? – Nafi Shahriyar Nov 9 '17 at 11:14
  • Could you please give me the step by step commands to move chroot in my desired director? – Nafi Shahriyar Nov 9 '17 at 11:17
  • 3
    Personally, if you do not know what mv is then there is a high chance that Kali NetHunter is not really for you. – Tigger Nov 9 '17 at 11:22
  • I agree with @Tigger. I would be very careful if I were you. The Linux command-line can ruthlessly destroy your data if you don't know what you're doing. – igal Nov 9 '17 at 12:01
1

Ok, I have got my solution. I have looked into all the directory from root (actually not all of them from parent to child as it wasn't necessary) and found 3 folder contains about 90% of total data.

My solution was easy.

Answer 1. First install app2sd pro from anywhere you want.

  1. SD card must be in ext4 format. Open app2sd pro and choose partition SD card adoptable Set 1st pertinent 10 MB and rest should be 2nd pertinent as ext4. But after this process, all data of SD card will be deleted and total SD card will be ext4 2nd partition.

  2. Install root browser and folder mount apk.

  3. From any root browser, go to /mnt/expand/fersj-hhek5-.... This is your SD card. You can move any file here. Creat a folder named "kali-armhf"

  4. Now open my specified root browsers and go to /data/local/nhsystem/kali-armhf

Copy var folder to /mnt/expand/eheh-dhhdh....../kali-armhf and paste here. Here creat a folder named "usr"

Now again go to /data/local/nhsystem/kali-armhf/usr/ and move lib and share folder to /mnt/expand/(your SD card)/kali-armhf/usr/

  1. Warning: copy process takes long Time (about 30 mnt) and not shown by root browser. Monitor this from setting > storage and USB Be sure all files were copied.

After moving theme to SD card, their size increases keep minimum 8 GB storage before starting this process

  1. You might noticed that we have moved 3 files. Change var name into var.x lib into lib.x share into share.x We have done it to backup them

  2. Now creat a blank folder named var in /data/local/nhsystem/ kali-armhf

Creat lib and share folder in /data/local/nhsystem /kali-armhf

Link this 3 balnk folder with 3 folder that we have moved to SD card with folder mount

In folder mount tap the + sign Then name them as I did in above screen shot

Source folder is our newly created balnk folder and Target folder is out moved folder in SD card

  1. Start them from folder mount Every time Android reboots, links are stopped. Just don't forget to open folder mount and turn on links.

  2. You can move more folders this way. Just use your brain.

  3. I am not responsible for any damage. But I think your internal storage data (not apps) is at risk. You might want to backup them. But it didn't do any problem to me. Delete .x folders when you see everything working great.

That's all. I am sorry that I couldn't explain it very clearly but main idea is there. You can make it work with a little effort. Using this method, I have installed all metapack of Kali Linux in my Android and it took about 12.5 GB space.

0

I don't know much about Android or Kali Linux specifically, but in general if you just want to move that directory from the one location to the other, then you could use this command:

mv -i \
/data/local/nhsystem \
-t /mnt/expand/d94616e4-3795-49d4-9ecf-f3aad7ec76b5/

The -i flag will prompt you before overwriting any files and the -t flag explicitly forces the target path to be treated as a directory.

Alternatively, you might want to copy it over first instead of moving it:

cp -ir
/data/local/nhsystem \
-t /mnt/expand/d94616e4-3795-49d4-9ecf-f3aad7ec76b5/

The -i and -t flags for cp serve the same function as they do for mv. The -r flag (recursive) is required by cp when copying directories.

You would then delete the source directory after the copy completes successfully:

rm -ir /data/local/nhsystem

The -i and -r flags play the same role for rm as they do for cp.

Either way, after moving the directory you might want to add a symlink to point the old directory to the new location:

ln -s \
/data/local/nhsystem \
/mnt/expand/d94616e4-3795-49d4-9ecf-f3aad7ec76b5

All of that said, I'd like to echo the concern expressed by another user in the comments: if you don't know about the mv command then you may want to step back and learn some basic Unix/Linux commands before proceeding. You could very easily end up inadvertently destroying all your data.

It might be a little bit dated, but I think that the Bash Beginner's Guide might still be a good place to start.

  • @igel, I can't directly move chroot there. When I have linux installed in chroot, it can't access files outside chroot. Another problem is my internal storage and Android system is linked with chroot. Actual chroot size is about 2 GB but it shows more that 8 GB – Nafi Shahriyar Nov 10 '17 at 1:42
  • @igel, actually I install kalifs.full.tar.xz with nethunter app. Install process is done automatically. How do I install kalifs.full.tar.xz manually in a user-defined directory? – Nafi Shahriyar Nov 10 '17 at 1:46
  • I don't follow you. You can't log into the device without chroot? – igal Nov 10 '17 at 2:16
  • No. My Android is working just fine. I can access chroot by nethunter terminal. Also in a regular terminal by su and bootkali command. chroot is like a jail. Any linux distro installed in chroot can't access outside chroot. chroot is for testing new tools and experiment. But I can fix it by linking a folder inside chroot with my sd card. But main problem is chroot is linked with my internal storage and Android system. This might be very complicated to unlink and relink them one by one. I think my best chance is to reinstall chroot directly in sd card. – Nafi Shahriyar Nov 10 '17 at 3:53
  • Now all I need to know is how to install kaifs.full.tar.xz manually in sdcard – Nafi Shahriyar Nov 10 '17 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.