offensive-security / kali-nethunter

The Kali NetHunter Project
https://github.com/offensive-security/kali-nethunter/wiki
3.47k stars 891 forks source link

System partition full when installing on Nexus 5 from Git - "kali" shell not working in nethunter terminal #560

Closed wiking-at closed 8 years ago

wiking-at commented 8 years ago

Device:

Nexus 5

OS version (KitKat/Lollipop/Marshmallow/Nougat):

Marshmallow

Built from repo (date and build command) or downloaded from website (links):

From Repo: nethunter-hammerhead-marshmallow-kalifs-full-20160903_132014 Install on top of freshly installed Android Stock Rom: MOB30Y (Marshmallow August 2016)

Output of cat /proc/version in adb shell or NetHunter Terminal:

Linux version 3.4.0-g5e6aa13 (root@nhbuild-box) (gcc version 4.7 (GCC) ) #3 SMP PREEMPT Sat Apr 2 20:23:25 CDT 2016

Issue:

After the install i noticed that in the Nethunter Terminal the "kali" shell was always crashing. I took a look in git and saw that it should run "/system/bin/bootkali_login".

"ls /system/bin/boot*" showed:

/system/bin/bootanimation
/system/bin/bootkali
/system/bin/bootkali_bash
/system/bin/bootkali_init

so i tried to create the symlink for it manually:

mount -o remount,rw /system /system                                            <
ln -s /data/data/com.offsec.nethunter/files/scripts/bootkali_login /system/bin/bootkali_login 

and got the following error

ln: cannot create symbolic link from '/data/data/com.offsec.nethunter/files/scripts/bootkali_login' to '/system/bin/bootkali_login': No space left on device

a df showed also that there are 0 bytes free on the system partition.

so it seems that the system partition of a newly flashed nexus 5 gets completely full with the current nethunter git install.

i deleted a ringtone on the system partition to get some space and did the symlink again. now the "kali" option in nethunter terminal works.

i opened this issue because i don't know where the problem with the too small system partition is coming from and to give people with this problem on there nexus 5 a google hit ;-) . i also don't know if there is something else on the system partition missing now. my nethunter install seems to work without any other problems though.

jcadduono commented 8 years ago

so what we can do for this is create a script in devices/marshmallow/hammerhead/patch.d called 00-free-space that removes items from system to make room. any suggestions on what would be a good thing to remove?

edit: ok this won't work as kernel installer works last, maybe we need to return the freespace script in update zip but change the items it removes....

binkybear commented 8 years ago

Maybe we can move apps to /data instead?

jcadduono commented 8 years ago

OK. So @wiking-at can you please try moving a few non-essential apps from system to data and see which might break and which won't?

Also, a copy paste of output from:

find /system/app

Just so we have the right paths to work with for entering in the free space script

jcadduono commented 8 years ago

jumobile system app remover (ROOT) is a good app for that task if you don't want to use shell for moving apps, and can be downloaded as apk from their site if not in the play store

(why doesnt github have an edit option on mobile site lol)

wiking-at commented 8 years ago
root@hammerhead:/ # find /system/app
/system/app
/system/app/BasicDreams
/system/app/BasicDreams/BasicDreams.apk
/system/app/BasicDreams/oat
/system/app/BasicDreams/oat/arm
/system/app/BasicDreams/oat/arm/BasicDreams.odex
/system/app/Bluetooth
/system/app/Bluetooth/Bluetooth.apk
/system/app/Bluetooth/lib
/system/app/Bluetooth/lib/arm
/system/app/Bluetooth/lib/arm/libbluetooth_jni.so
/system/app/Bluetooth/oat
/system/app/Bluetooth/oat/arm
/system/app/Bluetooth/oat/arm/Bluetooth.odex
/system/app/BluetoothMidiService
/system/app/BluetoothMidiService/BluetoothMidiService.apk
/system/app/BluetoothMidiService/oat
/system/app/BluetoothMidiService/oat/arm
/system/app/BluetoothMidiService/oat/arm/BluetoothMidiService.odex
/system/app/Books
/system/app/Books/Books.apk
/system/app/CalculatorGoogle
/system/app/CalculatorGoogle/CalculatorGoogle.apk
/system/app/CalculatorGoogle/oat
/system/app/CalculatorGoogle/oat/arm
/system/app/CalculatorGoogle/oat/arm/CalculatorGoogle.odex
/system/app/CalendarGooglePrebuilt
/system/app/CalendarGooglePrebuilt/CalendarGooglePrebuilt.apk
/system/app/CaptivePortalLogin
/system/app/CaptivePortalLogin/CaptivePortalLogin.apk
/system/app/CaptivePortalLogin/oat
/system/app/CaptivePortalLogin/oat/arm
/system/app/CaptivePortalLogin/oat/arm/CaptivePortalLogin.odex
/system/app/CertInstaller
/system/app/CertInstaller/CertInstaller.apk
/system/app/CertInstaller/oat
/system/app/CertInstaller/oat/arm
/system/app/CertInstaller/oat/arm/CertInstaller.odex
/system/app/Chrome
/system/app/Chrome/Chrome.apk
/system/app/Chrome/lib
/system/app/Chrome/lib/arm
/system/app/Chrome/lib/arm/libchromium_android_linker.so
/system/app/CloudPrint2
/system/app/CloudPrint2/CloudPrint2.apk
/system/app/DMAgent
/system/app/DMAgent/DMAgent.apk
/system/app/DocumentsUI
/system/app/DocumentsUI/DocumentsUI.apk
/system/app/DocumentsUI/oat
/system/app/DocumentsUI/oat/arm
/system/app/DocumentsUI/oat/arm/DocumentsUI.odex
/system/app/DownloadProviderUi
/system/app/DownloadProviderUi/DownloadProviderUi.apk
/system/app/DownloadProviderUi/oat
/system/app/DownloadProviderUi/oat/arm
/system/app/DownloadProviderUi/oat/arm/DownloadProviderUi.odex
/system/app/Drive
/system/app/Drive/Drive.apk
/system/app/EditorsDocsStub
/system/app/EditorsDocsStub/EditorsDocsStub.apk
/system/app/EditorsSheetsStub
/system/app/EditorsSheetsStub/EditorsSheetsStub.apk
/system/app/EditorsSlidesStub
/system/app/EditorsSlidesStub/EditorsSlidesStub.apk
/system/app/FaceLock
/system/app/FaceLock/FaceLock.apk
/system/app/FaceLock/lib
/system/app/FaceLock/lib/arm
/system/app/FaceLock/lib/arm/libfacelock_jni.so
/system/app/FaceLock/oat
/system/app/FaceLock/oat/arm
/system/app/FaceLock/oat/arm/FaceLock.odex
/system/app/FitnessPrebuilt
/system/app/FitnessPrebuilt/FitnessPrebuilt.apk
/system/app/GoogleCamera
/system/app/GoogleCamera/GoogleCamera.apk
/system/app/GoogleContactsSyncAdapter
/system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk
/system/app/GoogleContactsSyncAdapter/oat
/system/app/GoogleContactsSyncAdapter/oat/arm
/system/app/GoogleContactsSyncAdapter/oat/arm/GoogleContactsSyncAdapter.odex
/system/app/GoogleEars
/system/app/GoogleEars/GoogleEars.apk
/system/app/GoogleEars/oat
/system/app/GoogleEars/oat/arm
/system/app/GoogleEars/oat/arm/GoogleEars.odex
/system/app/GoogleHindiIME
/system/app/GoogleHindiIME/GoogleHindiIME.apk
/system/app/GoogleHome
/system/app/GoogleHome/GoogleHome.apk
/system/app/GooglePinyinIME
/system/app/GooglePinyinIME/GooglePinyinIME.apk
/system/app/GoogleTTS
/system/app/GoogleTTS/GoogleTTS.apk
/system/app/GoogleTTS/oat
/system/app/GoogleTTS/oat/arm
/system/app/GoogleTTS/oat/arm/GoogleTTS.odex
/system/app/HTMLViewer
/system/app/HTMLViewer/HTMLViewer.apk
/system/app/HTMLViewer/oat
/system/app/HTMLViewer/oat/arm
/system/app/HTMLViewer/oat/arm/HTMLViewer.odex
/system/app/Hangouts
/system/app/Hangouts/Hangouts.apk
/system/app/KeyChain
/system/app/KeyChain/KeyChain.apk
/system/app/KeyChain/oat
/system/app/KeyChain/oat/arm
/system/app/KeyChain/oat/arm/KeyChain.odex
/system/app/KoreanIME
/system/app/KoreanIME/KoreanIME.apk
/system/app/LatinImeGoogle
/system/app/LatinImeGoogle/LatinImeGoogle.apk
/system/app/LatinImeGoogle/lib
/system/app/LatinImeGoogle/lib/arm
/system/app/LatinImeGoogle/lib/arm/libjni_keyboarddecoder.so
/system/app/LatinImeGoogle/lib/arm/libjni_latinimegoogle.so
/system/app/LatinImeGoogle/oat
/system/app/LatinImeGoogle/oat/arm
/system/app/LatinImeGoogle/oat/arm/LatinImeGoogle.odex
/system/app/LiveWallpapersPicker
/system/app/LiveWallpapersPicker/LiveWallpapersPicker.apk
/system/app/LiveWallpapersPicker/oat
/system/app/LiveWallpapersPicker/oat/arm
/system/app/LiveWallpapersPicker/oat/arm/LiveWallpapersPicker.odex
/system/app/Maps
/system/app/Maps/Maps.apk
/system/app/MediaShortcuts
/system/app/MediaShortcuts/MediaShortcuts.apk
/system/app/MediaShortcuts/oat
/system/app/MediaShortcuts/oat/arm
/system/app/MediaShortcuts/oat/arm/MediaShortcuts.odex
/system/app/Music2
/system/app/Music2/Music2.apk
/system/app/NewsstandStub
/system/app/NewsstandStub/NewsstandStub.apk
/system/app/NfcNci
/system/app/NfcNci/NfcNci.apk
/system/app/NfcNci/lib
/system/app/NfcNci/lib/arm
/system/app/NfcNci/lib/arm/libnfc_nci_jni.so
/system/app/NfcNci/oat
/system/app/NfcNci/oat/arm
/system/app/NfcNci/oat/arm/NfcNci.odex
/system/app/PacProcessor
/system/app/PacProcessor/PacProcessor.apk
/system/app/PacProcessor/lib
/system/app/PacProcessor/lib/arm
/system/app/PacProcessor/lib/arm/libjni_pacprocessor.so
/system/app/PacProcessor/oat
/system/app/PacProcessor/oat/arm
/system/app/PacProcessor/oat/arm/PacProcessor.odex
/system/app/PartnerBookmarksProvider
/system/app/PartnerBookmarksProvider/PartnerBookmarksProvider.apk
/system/app/PartnerBookmarksProvider/oat
/system/app/PartnerBookmarksProvider/oat/arm
/system/app/PartnerBookmarksProvider/oat/arm/PartnerBookmarksProvider.odex
/system/app/Photos
/system/app/Photos/Photos.apk
/system/app/PlayGames
/system/app/PlayGames/PlayGames.apk
/system/app/PlusOne
/system/app/PlusOne/PlusOne.apk
/system/app/PrebuiltBugleStub
/system/app/PrebuiltBugleStub/PrebuiltBugleStub.apk
/system/app/PrebuiltDeskClockGoogle
/system/app/PrebuiltDeskClockGoogle/PrebuiltDeskClockGoogle.apk
/system/app/PrebuiltExchange3Google
/system/app/PrebuiltExchange3Google/PrebuiltExchange3Google.apk
/system/app/PrebuiltGmail
/system/app/PrebuiltGmail/PrebuiltGmail.apk
/system/app/PrebuiltKeepStub
/system/app/PrebuiltKeepStub/PrebuiltKeepStub.apk
/system/app/PrebuiltNewsWeather
/system/app/PrebuiltNewsWeather/PrebuiltNewsWeather.apk
/system/app/PrintSpooler
/system/app/PrintSpooler/PrintSpooler.apk
/system/app/PrintSpooler/lib
/system/app/PrintSpooler/lib/arm
/system/app/PrintSpooler/lib/arm/libprintspooler_jni.so
/system/app/PrintSpooler/oat
/system/app/PrintSpooler/oat/arm
/system/app/PrintSpooler/oat/arm/PrintSpooler.odex
/system/app/Stk
/system/app/Stk/Stk.apk
/system/app/Stk/oat
/system/app/Stk/oat/arm
/system/app/Stk/oat/arm/Stk.odex
/system/app/SunBeam
/system/app/SunBeam/SunBeam.apk
/system/app/TimeService
/system/app/TimeService/TimeService.apk
/system/app/TimeService/oat
/system/app/TimeService/oat/arm
/system/app/TimeService/oat/arm/TimeService.odex
/system/app/UpdateSetting
/system/app/UpdateSetting/UpdateSetting.apk
/system/app/UpdateSetting/oat
/system/app/UpdateSetting/oat/arm
/system/app/UpdateSetting/oat/arm/UpdateSetting.odex
/system/app/UserDictionaryProvider
/system/app/UserDictionaryProvider/UserDictionaryProvider.apk
/system/app/UserDictionaryProvider/oat
/system/app/UserDictionaryProvider/oat/arm
/system/app/UserDictionaryProvider/oat/arm/UserDictionaryProvider.odex
/system/app/Videos
/system/app/Videos/Videos.apk
/system/app/Wallet
/system/app/Wallet/Wallet.apk
/system/app/WebViewGoogle
/system/app/WebViewGoogle/WebViewGoogle.apk
/system/app/YouTube
/system/app/YouTube/YouTube.apk
/system/app/iWnnIME
/system/app/iWnnIME/iWnnIME.apk
/system/app/iWnnIME/lib
/system/app/iWnnIME/lib/arm
/system/app/iWnnIME/lib/arm/libEnjemailuri.so
/system/app/iWnnIME/lib/arm/lib_dic_en_USUK.conf.so
/system/app/iWnnIME/lib/arm/lib_dic_en_tablet_USUK.conf.so
/system/app/iWnnIME/lib/arm/lib_dic_ja_JP.conf.so
/system/app/iWnnIME/lib/arm/lib_dic_morphem_ja_JP.conf.so
/system/app/iWnnIME/lib/arm/libennjcon.so
/system/app/iWnnIME/lib/arm/libennjubase1.so
/system/app/iWnnIME/lib/arm/libennjubase1gb.so
/system/app/iWnnIME/lib/arm/libennjubase1us.so
/system/app/iWnnIME/lib/arm/libennjubase2.so
/system/app/iWnnIME/lib/arm/libennjubase3.so
/system/app/iWnnIME/lib/arm/libennjyomi.so
/system/app/iWnnIME/lib/arm/libiwnn.so
/system/app/iWnnIME/lib/arm/libnjaddress.so
/system/app/iWnnIME/lib/arm/libnjcon.so
/system/app/iWnnIME/lib/arm/libnjemoji.so
/system/app/iWnnIME/lib/arm/libnjexyomi.so
/system/app/iWnnIME/lib/arm/libnjexyomi_plus.so
/system/app/iWnnIME/lib/arm/libnjfzk.so
/system/app/iWnnIME/lib/arm/libnjkaomoji.so
/system/app/iWnnIME/lib/arm/libnjname.so
/system/app/iWnnIME/lib/arm/libnjtan.so
/system/app/iWnnIME/lib/arm/libnjubase1.so
/system/app/iWnnIME/lib/arm/libnjubase2.so
/system/app/qcrilmsgtunnel
/system/app/qcrilmsgtunnel/oat
/system/app/qcrilmsgtunnel/oat/arm
/system/app/qcrilmsgtunnel/oat/arm/qcrilmsgtunnel.odex
/system/app/qcrilmsgtunnel/qcrilmsgtunnel.apk
/system/app/shutdownlistener
/system/app/shutdownlistener/oat
/system/app/shutdownlistener/oat/arm
/system/app/shutdownlistener/oat/arm/shutdownlistener.odex
/system/app/shutdownlistener/shutdownlistener.apk
/system/app/talkback
/system/app/talkback/talkback.apk
root@hammerhead:/ #
wiking-at commented 8 years ago

this might also be a good posibility to free 15 megs:

ls -la /system/media/bootanimation.zip                                         
-rw-r--r-- root     root     15466496 2016-01-01 13:15 bootanimation.zip
wiking-at commented 8 years ago

@jcadduono with the jumobile app you mentioned i can only delete apps - not move them to another folder. at least i can't find a option for it. should i copy the .apk file from /system/app to /data/app and then delete the original? or are there additional steps necessary to get them work in the other folder?

jcadduono commented 8 years ago

YouTube, Books, Maps, Hangouts, Drive, PlayGames, Music2, Photos, Videos

these should all be safe to move to /data.

i think this is what we should do, in pseudo code:

apps=YouTube Books Maps Hangouts Drive PlayGames Music2 Photos Videos
loop app through $apps:
  if exists /system/app/$app/:
    if exists /data/app/$app/:
      delete /system/app/$app/
    else:
      move /system/app/$app/ to /data/app/$app/
until freespace > 50 MB:

if freespace < 50 MB:
  abort mission!
webcoderz commented 8 years ago

Try titanium pro

On Sep 4, 2016 2:10 PM, "wiking-at" notifications@github.com wrote:

@jcadduono https://github.com/jcadduono with the jumobile app you mentioned i can only delete apps - not move them to another folder. at least i can't find a option for it. should i copy the .apk file from /system/app to /data/app and then delete the original? or are there additional steps necessary to get them work in the other folder?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/offensive-security/kali-nethunter/issues/560#issuecomment-244622785, or mute the thread https://github.com/notifications/unsubscribe-auth/AS9ogd0Ak8R7nKTXOpW8joVrdYw_uPEjks5qmxepgaJpZM4J0lQD .

wiking-at commented 8 years ago

@jcadduono ok - i try to compile your pseudo code in my brain and do the steps manually ;-) .

concerning my original problem/setup: are there any steps involving the /system partition after the shell symlinks? anything i should manually repair?

in the mean time - here the output how the resource usage under /system looks like before starting with the steps.

root@hammerhead:/system # du -cks * | sort -rn | head
1014136 total
424452  app
217296  priv-app
103440  framework
94468   lib
63120   vendor
46512   usr
32096   fonts
18400   media
8668    bin
root@hammerhead:/system #
jcadduono commented 8 years ago

df -h /system might give you a good idea

you can reflash the nethunter installer (3.1.0 or newer), built from github or on my mirror at any time to fill in any possible gaps. the installer has flash-over-at-anytime in mind.

wiking-at commented 8 years ago

i moved via adb shell:

/system/app/YouTube/
/system/app/Books/
/system/app/Maps/
/system/app/Hangouts/

now 64 megs free under /system. all the apps could at least be started without problems after the move.

wiking-at commented 8 years ago

if i reflash nethunter - will my chroot get overwritten? i've done lots of modifications in kali and would like too keep it.

jcadduono commented 8 years ago

just remove kalifs-full.tar.xz from whatever zip you flash before flashing and the installer won't touch the chroot

jcadduono commented 8 years ago

https://github.com/offensive-security/kali-nethunter/commit/8ebf4d9c3193a107dca873c12e37c2e217283ffc

couldnt test this since my current phone isnt happy with modifications atm, so let me know how it rips

@binkybear if it has any issues feel free to fix :D sorry

wiking-at commented 8 years ago

@jcadduono i built a new nethunter zip (./build.py -d hammerhead -m) and flashed it again. now 8 megs more are used and everything seems to work without any problem.

also an error concerning supersu which wants to update (and is unable to) is now gone.

thanks for the lightning speed fast support and for providing this great android os version.

webcoderz commented 8 years ago

I think it is untarring ur kali chroot in the sdcard which will make it appear as if it is taking up space I had it saved there the first time and it took like all the storage on my phone