# Cannot escape from cu utility



## IPTRACE (Jun 17, 2017)

After restarting FreeBSD11.0p10_amd64 and then connecting to one of the bhyve guest machine for testing purpose I encountered the problem with escaping from the cu() command.
The following commands do not work. Terminal puts char ~ and new line only without escaping, I use Putty v0.69.

```
~^D or ~.
             Drop the connection and exit.  Only the connection is dropped –
             the login session is not terminated.
```
Did somebody meet similar problem?


----------



## obsigna (Jun 17, 2017)

On many non-US keyboards, the key which generates the *~* is a so-called dead key, i.e. it is used to generate accented characters. Perhaps this might be your problem. I experience the same behaviour wich you described with cu from the Terminal of a macOS computer. However on my keyboard I can generate the non-dead *~* by using the key combination <alt>-*~* and this one works with cu as expected.

If this does not help, perhaps you can change the term settings, some of which do influence the behaviour of certain characters as well. You can verify the effective setting by submitting `$ echo $TERM` on the remote machine via Putty. For me xterm-256color does work best.


----------



## tingo (Jun 19, 2017)

It works for me. Note that the '~.' sequence might need to be on a new line.


----------



## SirDice (Jun 19, 2017)

It works for me too but sometimes you have to do it multiple times. Especially if the VM is at the login prompt. Hitting a bunch of CTRL-D first seems to help, that temporarily freezes the login and the ~ is then easier to register with cu(1).


----------



## IPTRACE (Jun 19, 2017)

SirDice said:


> It works for me too but sometimes you have to do it multiple times. Especially if the VM is at the login prompt. Hitting a bunch of CTRL-D first seems to help, that temporarily freezes the login and the ~ is then easier to register with cu(1).


It worked for me as well but It doesn't now.
Please look at how it looks like now.

```
Connected


FreeBSD/amd64 (vm) (ttyu0)

login:

FreeBSD/amd64 (vm) (ttyu0)

login:

FreeBSD/amd64 (vm) (ttyu0)

login: ~

FreeBSD/amd64 (vm) (ttyu0)

login: ~

FreeBSD/amd64 (vm) (ttyu0)

login: ~

FreeBSD/amd64 (vm) (ttyu0)

login: ~
```
When I'm logged in.

```
user@vm:~ % ~
/home/user: Permission denied.
user@vm:~ % ~
/home/user: Permission denied.
user@vm:~ % ~
/home/user: Permission denied.
```
What version of Putty do you use? After Windows reinstalling I've instaled the newest.
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html


----------



## SirDice (Jun 19, 2017)

Yeah, it's sometimes difficult. Can't remember what version of PuTTY I have but I keep things diligently up to date so I assume I have the latest too. But I don't think it's PuTTY related, it's just that cu(1) sometimes passes ~ too quickly. I've thought about changing cu(1) and use comms/minicom instead. If I recall correctly the console is a configuration setting and could be changed to a different application.


----------



## rab (Sep 18, 2019)

the documentation is confusing. They all state that it should be ~+ctrl-D. It should be ~+cntrl-d.


----------



## SirDice (Sep 18, 2019)

rab said:


> They all state that it should be ~+ctrl-D. It should be ~+cntrl-d.


Look at the character that's printed on your keyboard. Does it say 'd' or 'D'? If the shift key was required the key combination would be '~ + ctrl-shift-D'. This is a common convention of printing key combinations in manuals.


----------

