10

A friend of mine just showed me a neat built-in utility called screen that, long story short, allows you to create instances of the terminal.

I am running Windows 10 and trying to use this utility with Bash on Ubuntu on Windows, but since it was a built-in utility, I didn't expect any problems. After playing with it on a different computer, I went to start an instance on mine with screen -S hello and all I got back was

Cannot make directory '/var/run/screen': Permission denied

I googled the error and the first thing that came up was this site which said to try

sudo /etc/init.d/screen-cleanup start

which I did with little luck. Now with the same screen command all that happens is

[screen is terminating]
[11:44:25 ~]> _

with no other explanation. I made sure that there were no instances left running with screen -ls and got No Sockets found in /home/daniel/.screen.. I went back to google to then fix this issue but all of the questions / answers I found were for CentOS (which I'm not running, and just to be clear, cat /etc/issue returns Ubuntu 14.04.4 LTS \n \l). I did try some of their suggestions anyway, trying all of these:

sudo chmod 2775 /usr/bin/screen
sudo chmod 755 /usr/bin/screen
sudo chmod 777 /usr/bin/screen
sudo chmod u+s /usr/bin/screen
sudo chmod 755 /var/run/screen

as well as chmod 700 ~/.screen after creating and exporting a new SCREENDIR.

I'm not trying to use any special programs, not trying to ssh, just want to use screen natively on my bash/Ubuntu console.

Any help is appreciated!

muru
  • 207,970
  • Have you tried starting screen without the parameters? If it opens, then split the terminal with Ctrl-a S. – bashBedlam Aug 30 '16 at 17:31
  • @bashBedlam same result, just terminates. – Metomorphose Aug 30 '16 at 18:57
  • Can toy try inserting the line shell /bin/bash in ~/.screenrc ? – stalet Sep 19 '16 at 06:07
  • Try command screen bash. If that fails and you feel confident examining failed system calls you could try strace -f -o trc -v screen bash and then examine file trc. More info on strace is available here: https://wiki.ubuntu.com/Strace – sмurf Sep 19 '16 at 06:31
  • Oops, strace does not work well with screen. Workaround: http://unix.stackexchange.com/questions/93892/screen-is-terminating – sмurf Sep 19 '16 at 06:36
  • @stalet No command 'shell' found. @smurf same thing again and oh gosh stack tracing... Maybe I'll try it after some sleep... – Metomorphose Sep 19 '16 at 06:46
  • 1
    I'm pretty certain Dustin Kirkland said screen and tmux don't work. – muru Sep 20 '16 at 07:50
  • @muru https://blogs.msdn.microsoft.com/commandline/2016/06/08/tmux-support-arrives-for-bash-on-ubuntu-on-windows/ – Rinzwind Sep 20 '16 at 09:06
  • You need at least Windows 10 build 14361 to use tmux. – Rinzwind Sep 20 '16 at 09:07
  • @Rinzwind that's still Insider-only, I think. Beta software. – muru Sep 20 '16 at 09:17
  • +1 (post surprisingly had -1): this is valid question, well described, and any questions regarding "weirdness of windows ubuntu subsystem" are valid, because it is a new product and there's a lot of unknowns) – Dimitry K Feb 25 '17 at 15:36
  • @Dimitry K, thanks, I was wondering why it was getting negative votes myself lol – Metomorphose Feb 25 '17 at 15:46

3 Answers3

3

I googled the error and the first thing that came up was this site which said to try

Use Windows Bash Shell sources for Windows Bash Shell, not native Ubuntu. The 2 systems are not interchangeable. Regarding Bash itself you can get away with it but tools like "screen" and "tmux" have specific needs that Windows Bash Shell just does not have (yet!). Any command you use in Ubuntu is bound to fail on Windows Bash Shell.

I'm not trying to use any special programs, not trying to ssh, just want to use screen natively on my bash/Ubuntu console.

Yes, you do: "screen" IS a special program.

You wont succeed to get this running unless you can hack your way around software. "screen" is not supported in Windows Bash Shell (yet!). Windows 10 build 14361 will introduce "tmux" (and I assume "screen" will then work too) and that version seems to be an "insider preview build", not released yet to the general public.

Rinzwind
  • 310,127
  • though strange earlier I was able to build and run screen successfully in bash inside windows. But now in another system after a month I am not able to do with the latest windows 10 build. – user2760375 Oct 25 '16 at 05:44
2

I received the same error trying to start screen for first time:

Cannot make directory '/var/run/screen': Permission denied'  

Ran:

sudo screen

and was then able to run screen (although my usage is somewhat limited)

Zanna
  • 72,471
0

tmux works in Windows 10 bash. It is the same as screen, like so:

tmux      # starts a new tmux session

ctrl-b c  # new tab

ctrl-b 0  # switch to tab 0

ctrl-b d  # detach

tmux a    # re-attach to your previous session

ctrl-b ?  # for help
RHT
  • 132