[APP] midnight-commander 4.7.0.3 for Android (updated to 4.7.5.4, with APK Installer)

Search This thread

disq

Member
Mar 30, 2010
45
15
I prepared an addon.d script to keep the file across ROM updates, works with CyanogenMod. Unpack this in your /system/addon.d/ (you'll have to adb remount first) and set permissions to 755 (chmod 755 74-mc.sh)

The only problem seems to be that, the backup script won't detect symlinks so it will waste about 10 megabytes more. (mcdiff, mcedit and mcview should be symlinks to mc.real, but it restores them as regular files)
 

Attachments

  • 74-mc.sh.gz
    1.1 KB · Views: 380

KeyCat

Member
Mar 17, 2006
28
4
First of all thanks for the port!

mc works on HTC Flyer, F-keys works as they should but I can not get my terminal settings to display proper chars! I've been thru testing every option in SecureCRT and as well as tried using exporting different TERM in /system/xbin/mc also added "export LANG=en_US.UTF-8" and I see mc is using the correct code page (see screenshot) but still not getting it to show correct characters when I connect thru SSH (HTC Flyer running SSHDroid)?

I also tried the same settings in terminal as I use for my Debian which works there but fails on my HTC Flyer (see screen shots), any ideas???
 

Attachments

  • mc_android.jpg
    mc_android.jpg
    81.1 KB · Views: 915
  • mc_debian.jpg
    mc_debian.jpg
    79.1 KB · Views: 881

SysGhost

Senior Member
Jul 8, 2010
251
90
Stockholm
OnePlus 6
What does the Log textarea say ?

Do you have the latest version ? If so, there could be several reasons:
a) the generic mount command might not work (and thus the /system partition remains read only and extraction will fail). You could try to mount it in RW mode using Root Explorer or some shell commands specific to your phone.
b) You might not have enough free disk space - please check
c) Other reasons (busybox missing, etc)

Anyway, the Installer does two things, which you can also do manually:
a) mount /system partition in RW mode.
b) extract the mc archive.

If you use 7Zip on PC, you can look inside the APK file for the mc-XXXXXX.jet file and extract it to your pc.
You then rename the .jet file to .tar.gz (still on PC) and then copy the newly renamed file to your /sdcard

Then, on the phone, using Terminal Emulator (or adb on PC) you can execute the command:

Code:
cd /
tar xf /sdcard/mc-XXXXXXX.tar.gz

Make sure you mount the /system in RW mode before you do the tar unpacking.

I know it's a bit late, but a correction: The proper tar command should be:
Code:
tar xzf /sdcard/mc-XXXXXXX.tar.gz
In some versions of tar/busybox, the absent "z" will cause an invalid tar magic error. Simply because busybox/tar cannot determine what compression method that has been used. One need to manually tell tar that it is a gzip package (That's what the "z" is for)

To the thread creator: The APK package scripts need to be updated with the "z" option. It doesn't hurt anyway.
 

viulian

Inactive Recognized Developer
Apr 6, 2011
419
411
hex.ro
I also tried the same settings in terminal as I use for my Debian which works there but fails on my HTC Flyer (see screen shots), any ideas???

I'm sorry, I have not tested with SecureCRT, I only use putty .... I will give it a go just try and debug what happens.

To the thread creator: The APK package scripts need to be updated with the "z" option. It doesn't hurt anyway.

Thanks SysGhost, I have tried with busybox versions that some members had which they reported errors with, and it was not the z parameter ... It could be that while the version is the same, busybox is different; I will soon post a new release (but this week I am extremly busy, next week).
 

abbots

Senior Member
Apr 26, 2011
344
48
Sydney
thanks for creating Android mc
after I 'su' and 'mc', I'm getting
'warning can not create /.mc'

what do I need to do ?
 
Last edited:

viulian

Inactive Recognized Developer
Apr 6, 2011
419
411
hex.ro
I am sorry for the late reply:

Try to set the HOME environment variable to /sdcard before starting mc ?

I believe that the SSH server you are using sets the HOME to '/' and it probably doesn't have the rights to create the private folder there (mc creates the .mc folder where it will keep the settings and so on).
 

abbots

Senior Member
Apr 26, 2011
344
48
Sydney
I am sorry for the late reply:

Try to set the HOME environment variable to /sdcard before starting mc ?

I believe that the SSH server you are using sets the HOME to '/' and it probably doesn't have the rights to create the private folder there (mc creates the .mc folder where it will keep the settings and so on).

thanks for reply,
no probs, I got tied up in unrelated stuff anyhow, and, didn't come back


I was on the device, from a terminal app, not using ssh, just local terminal

also, how do I invoke mc from 'adb shell' as not get all the escape codes all over the screen...?
 

alkanbw

Senior Member
Sep 17, 2012
78
27
I have Samsung Galaxy S5 SM-G900F rooted
after I 'su' and 'mc', I'm getting
'warning can not create /.mc'
I am using SSHDroid and set home directory to sdcard
is this problem that in SG5 selinux is set to enforcing mode?
Any other solutions ?
 

spblinux

New member
Apr 14, 2009
3
6
mc working with selinux enforcing mode (lollipop)

Midnight commander runs fine on Android 5.02 (Moto E 2nd with SuperSU):

  • mc: install nativnux installer from play store
  • busybox: install sshelper from play store
  • terminal to run mc on the mobile device: install android terminal emulator from play store
sshelper app comes with busybox (which is required to install mc). Then terminal emulator can run mc or a ssh client like sshjuice can connect to sshelper on 127.0.0.1:2222 (see attachment; a bluetooth keyboard was in use). - Edit: needs selinux policy modification using supolicy (which is part of supersu): see below.

Installation:
Run sshd provided by sshhelper, ssh to the mobile device, switch to user root with command su (confirm SuperSU popup). Then copy busybox to /system/xbin and create symbolic links for awk and tar pointing to busybox.
  • mount -o remount,rw /system
  • cd /data/data/com.arachnoid.sshelper/bin/
  • cp busybox /system/xbin/
  • cd /system/xbin
  • ln -s busybox awk
  • ln -s busybox tar
Next step is to run gui mc installer. - In /system/xbin/mc the last line should end with $@. On the moto e 2nd 4G /sdcard/tmp is a working temporary directory and xterm has been chosen as terminal type.
Code:
#!/system/bin/sh
#!/system/bin/sh
export TMPDIR=/sdcard/tmp
if [ ! -e $TMPDIR ]; then
  mkdir $TMPDIR
fi
# So that F1, ... works
export TERM=xterm 
export TERMINFO=/etc/terminfo
/system/xbin/mc.real $@
Addendum: If mc displays empty directory listings, the binary mc.real is not the current binary available in play store (which is a very reasonably priced non free app).

Enable proper terminal access in selinux enforcing mode:
  • su -c " supolicy --live 'allow untrusted_app untrusted_app_devpts chr_file setattr' "
  • The supolicy command shown above adds the missing permission. - To display the current selinux setting use:
  • su -c " supolicy --dumpav |grep 'untrusted_app-->untrusted_app_devpts' "
  • Workaround, not recommend: disable selinux:
  • Either on the mobile device: Create a connection in juicessh of type local terminal, open this connection, run command su and confirm SuperSU popup to grant privileges. Now run: setenforce 0. (getenforce displays current mode; setenforce 1 restores enforcing mode)
  • From computer: ssh -T -p 2222 ip_of_mobile_device. Then run su -c setenforce 0
You might want to put the following lines into /data/data/com.arachnoid.sshelper/home/.profile and in /data/data/jackpal.androidterm/app_HOME/.profile (terminal emulator settings: startup command: source $HOME/.profile)
Code:
# place user customizations here
# selinux policy already patched?
echo -n "please wait, checking selinux policy for /dev/pts ..."
if ! su -c "supolicy --dumpav |grep 'untrusted_app-->untrusted_app_devpts' |grep -q setattr"; then
  su -c "supolicy --live 'allow untrusted_app untrusted_app_devpts chr_file setattr'"
  echo "****************************************************************************"
  echo "* Log out (might need ctrl+c) and connect again to get a working terminal. *"
  echo "****************************************************************************"
else
  echo "done"
fi
echo $OSDATA                                 
export PS1='$USER@$BOARD:$PWD $( (($USER_ID)) && echo \$ || echo \#) '
sh -i
 

Attachments

  • Screenshot_2015-03-30-00-54-02.png
    Screenshot_2015-03-30-00-54-02.png
    187.8 KB · Views: 320
Last edited:
  • Like
Reactions: mratix and hurray

jib@rmi.ge

Senior Member
Aug 9, 2015
66
12
Tbilisi
Thanks a lot, it works perfectly.

Just out of curiosity - when I go adb shell from a cmd window on pc and then run mc there, understandably I see only lots of codes; I wonder whether there is some terminal-like mode for a Windows window which would display mc correctly? There should be something like that as there are things like e. g. far manager which produce norton-like shells for windows
 

Virnik0

Senior Member
Sep 14, 2010
2,005
461
Prague
blog.nutcracker.cz
try running it in ASCII mode: mc -a

Android shell uses busybox, which is missing ncurses... that is why. It is ok over SSH, because your own terminal will support linux or screen mode.
 

Virnik0

Senior Member
Sep 14, 2010
2,005
461
Prague
blog.nutcracker.cz
Alas - does not work. Codes seem to be different though :D
Hey, what exactly is it printing out? can you provide screenshot of your screen? Because it does work for me running latest CM12.1

PS: Your 'Alas' made me question what are you tried to say, before I realized that I am hearing it a lot from my muslim friends/colleagues at work :) I must be too sleepy yet.
 

jib@rmi.ge

Senior Member
Aug 9, 2015
66
12
Tbilisi
Hey, what exactly is it printing out? can you provide screenshot of your screen?
With pleasure:

Mj1hEiW.png


and after pressing right arrow:

tCbi3HG.png


and now without "-a" (started from the .mc folder in case this matters)

FSYQtTF.png


Because it does work for me running latest CM12.1
Don't think there is a problem on the android side (mc works on terminal emulator there) but mine is slimlp 0.10 by chil360 on u8833 (Huawei Y300-0100)

PS: Your 'Alas' made me question what are you tried to say, before I realized that I am hearing it a lot from my muslim friends/colleagues at work :) I must be too sleepy yet.
Had no idea that alas had any meaning beyond an interjection for "unfortunately" :)
 
Last edited:

Virnik0

Senior Member
Sep 14, 2010
2,005
461
Prague
blog.nutcracker.cz
can you check what kind of terminal your adb uses? also, have you tried to runit under bash instead of busybox? seems like your terminal does not support rich terminal....
 

S5830er

Member
Aug 7, 2014
41
2
Google Pixel 4
Help installing MC needed

When I try to start NativnuxInstaller_1.1.apk I get errors:
Code:
mounting /system read-write
installing ...
done!
sh: <stdin>[2]: awk: not found
grep: write: Briken pipe
tar: chown 1000:1000 `system`:Read-only file system
tar: system/share: can´t create: Read only file system
tar: chown 1000:1000 `system/share`:No such file or directory
tar: system/share: not created
tar: system/share: not created
tar: invalid tar format
cat /proc/mounts delivers:
Code:
...
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,noatime,data=ordered 0 0
/dev/block/loop0 /system/xbin/su ext4 rw,seclabel,noatime,data=ordered 0 0
/dev/block/loop0 /system/xbin/su ext4 rw,seclabel,noatime,data=ordered 0 0
...
So how should my mount-command look like (sorry for not beeing a specialist) as
Code:
mount -o rw,remount -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,relatime 0 0
delivers mount: Max 2 arguments And mount -o rw,remount -t /dev/block/loop0 /system ext4 says mount: 'ext4' not in /proc/mounts
 
Last edited:

sysctl

Senior Member
Oct 19, 2016
79
3
Hi!

What should I do if I have hacker's keyboard but when I press arrow keys in MC it types upper case letters like B to where in command input (where you have green cursor on screenshot) instead of moving selection up or down. It works great wish ssh. When I am just using terminal emulator the arrow keys up and down work fine to navigate between recently used commands but when I run MC only then they start typing upper case letters instead.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 35
    Introduction

    Here's the classic Midnight Commander for Android!

    mc_4.7.0.3-arm.png


    Features

    a) Function keys work (F3 - view, F5 - copy, F8 - delete, F10 - exit, etc...)
    b) Very stable, doesn't crash.
    c) Much easier installation than the previous one version (which needed an additional apt-get clone, named ipkg, etc). More about this below.
    d) comes bundled with xterm (terminfo) and syntax highlighting for major languages.
    e) I kept the wrapper script 4.6.2 but updated it so that function keys work.

    Reasons

    There is an one year old version floating around (version 4.6.2) and even if does start, it crashed every time I pressed the arrow keys in the search panels:

    Code:
    /system/xbin/mc.real: libc/misc/ctype/ctype.c: 290: tolower: Assertion `((((unsigned int)((c) - 0)) <= ((127 * 2 + 1) - 0)) || ((c) == (-1)))' failed.

    Not only this, but I had to restart Putty, since the whole screen became garbled.

    Installation

    You need a rooted phone with busybox.

    Installation is easy:

    click Install and allow root access.​

    If everything is ok, you will see an output like in the screenshot below:

    20111008103603.png


    To use mc, you could connect with a terminal emulator (but it looks ugly). A good alternative is if you use DroidSSHd as SSH server on the phone and Putty as client from your PC (or connect-bot as client on the phone).

    For now, there is no uninstaller for the native MC that is extracted on the phone. Thus, feel free to uninstall the app as you don't need it anymore once MC native is copied to the phone.

    Download

    Use it at your own risk! (License is GPLv2)

    NativnuxInstaller_1.1.apk
    2
    mc working with selinux enforcing mode (lollipop)

    Midnight commander runs fine on Android 5.02 (Moto E 2nd with SuperSU):

    • mc: install nativnux installer from play store
    • busybox: install sshelper from play store
    • terminal to run mc on the mobile device: install android terminal emulator from play store
    sshelper app comes with busybox (which is required to install mc). Then terminal emulator can run mc or a ssh client like sshjuice can connect to sshelper on 127.0.0.1:2222 (see attachment; a bluetooth keyboard was in use). - Edit: needs selinux policy modification using supolicy (which is part of supersu): see below.

    Installation:
    Run sshd provided by sshhelper, ssh to the mobile device, switch to user root with command su (confirm SuperSU popup). Then copy busybox to /system/xbin and create symbolic links for awk and tar pointing to busybox.
    • mount -o remount,rw /system
    • cd /data/data/com.arachnoid.sshelper/bin/
    • cp busybox /system/xbin/
    • cd /system/xbin
    • ln -s busybox awk
    • ln -s busybox tar
    Next step is to run gui mc installer. - In /system/xbin/mc the last line should end with $@. On the moto e 2nd 4G /sdcard/tmp is a working temporary directory and xterm has been chosen as terminal type.
    Code:
    #!/system/bin/sh
    #!/system/bin/sh
    export TMPDIR=/sdcard/tmp
    if [ ! -e $TMPDIR ]; then
      mkdir $TMPDIR
    fi
    # So that F1, ... works
    export TERM=xterm 
    export TERMINFO=/etc/terminfo
    /system/xbin/mc.real $@
    Addendum: If mc displays empty directory listings, the binary mc.real is not the current binary available in play store (which is a very reasonably priced non free app).

    Enable proper terminal access in selinux enforcing mode:
    • su -c " supolicy --live 'allow untrusted_app untrusted_app_devpts chr_file setattr' "
    • The supolicy command shown above adds the missing permission. - To display the current selinux setting use:
    • su -c " supolicy --dumpav |grep 'untrusted_app-->untrusted_app_devpts' "
    • Workaround, not recommend: disable selinux:
    • Either on the mobile device: Create a connection in juicessh of type local terminal, open this connection, run command su and confirm SuperSU popup to grant privileges. Now run: setenforce 0. (getenforce displays current mode; setenforce 1 restores enforcing mode)
    • From computer: ssh -T -p 2222 ip_of_mobile_device. Then run su -c setenforce 0
    You might want to put the following lines into /data/data/com.arachnoid.sshelper/home/.profile and in /data/data/jackpal.androidterm/app_HOME/.profile (terminal emulator settings: startup command: source $HOME/.profile)
    Code:
    # place user customizations here
    # selinux policy already patched?
    echo -n "please wait, checking selinux policy for /dev/pts ..."
    if ! su -c "supolicy --dumpav |grep 'untrusted_app-->untrusted_app_devpts' |grep -q setattr"; then
      su -c "supolicy --live 'allow untrusted_app untrusted_app_devpts chr_file setattr'"
      echo "****************************************************************************"
      echo "* Log out (might need ctrl+c) and connect again to get a working terminal. *"
      echo "****************************************************************************"
    else
      echo "done"
    fi
    echo $OSDATA                                 
    export PS1='$USER@$BOARD:$PWD $( (($USER_ID)) && echo \$ || echo \#) '
    sh -i
    2
    Thanks

    Thanks viulian! I'm planning on donating today. Your MC helped me a lot. I extracted the installation to *.tar.gz archives. Here is the result.

    http://kosiara87.blogspot.com/2014/03/install-midnight-commander-mc-on.html
    1
    I've crosscompiled MC to version 4.7.5.4 (latest) and also created a GUI installer (which requires busybox and needs root access to extract everything to correct locations).

    Please check first post in the this thread.

    As always, I'm very curious for feedback :)

    I've only tested it on my two phones (Arc and X10 mini).
    1
    Just installed your mc using your apk package and got an error of

    Code:
    /system/bin/mc: /system/xbin/mc.real: not found

    After unpacking your tarball from the apk, I located the problem. The fix I found is to edit /system/bin/mc and change the last line from:

    Code:
    /system/xbin/mc.real $*

    to

    Code:
    /system/bin/mc.real $*

    There is no /system/xbin files in your tarball and the mc.real is actually installed to /system/bin. Is it possible to update this apk file with the correct script so we don't have to manually adjust this in the future with installs?

    Thanks again for this, it's awesome to finally have mc working on my phone! It is working great with WiFi ADB and the gnome terminal on debain squeeze.

    -Mike