按下 Tab 键进行自动完成后远程主机关闭连接

按下 Tab 键进行自动完成后远程主机关闭连接

我正在使用 putty 连接到 Ubuntu 15.10 的虚拟盒安装:

Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-22-generic x86_64)

如果这样做,只需cd folde [tab]打开一个窗口

"Connection closed by remote host"

我完全不知道哪里出了问题、如何解决这个问题以及这个问题是从哪里突然出现的。

编辑:新信息:这似乎不会以 root 身份发生。


到目前为止我已经尝试过:

  • 升级 ubuntu
  • 测试了 mobaxterm 和 simple putty
  • 将 Putty 安装在任何其他机器上均可正常工作
  • 这不是由于内存不足:MemTotal:9996524 kB,MemFree:9422540 kB,MemAvailable:9830548 kB
  • 使用 exec bash 启动另一个 bash 将使问题出现的频率降低。

beginner@avalon:~$ sudo tail -100f /var/log/syslog
[sudo] password for beginner:
Dec 21 10:50:44 avalon whoopsie[574]: [10:50:44] online
Dec 21 10:50:48 avalon NetworkManager[623]: <info>  WiFi hardware radio set enabled
Dec 21 10:50:48 avalon NetworkManager[623]: <info>  WWAN hardware radio set enabled
Dec 21 10:50:52 avalon ntpdate[865]: no server suitable for synchronization found
Dec 21 10:51:02 avalon ntpdate[1035]: no server suitable for synchronization found
Dec 21 10:52:08 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device/start timed out.
Dec 21 10:52:08 avalon systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device.
Dec 21 10:52:08 avalon systemd[1]: Dependency failed for /dev/disk/by-uuid/66341dbb-4e46-4bcd-89ad-9b40aa873fe6.
Dec 21 10:52:08 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.swap: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.swap/start failed with result 'dependency'.
Dec 21 10:52:08 avalon systemd[1]: Startup finished in 9.395s (kernel) + 3min 519ms (userspace) = 3min 9.914s.
Dec 21 10:52:08 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device/start failed with result 'timeout'.
Dec 21 11:04:03 avalon systemd[1]: Starting Cleanup of Temporary Directories...
Dec 21 11:04:03 avalon systemd-tmpfiles[1074]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
Dec 21 11:04:03 avalon systemd[1]: Started Cleanup of Temporary Directories.
Dec 21 11:08:14 avalon systemd[1]: Created slice user-1001.slice.
Dec 21 11:08:14 avalon systemd[1]: Starting User Manager for UID 1001...
Dec 21 11:08:14 avalon systemd[1]: Started Session 1 of user beginner.
Dec 21 11:08:14 avalon systemd[1084]: Reached target Paths.
Dec 21 11:08:14 avalon systemd[1084]: Reached target Timers.
Dec 21 11:08:14 avalon systemd[1084]: Reached target Sockets.
Dec 21 11:08:14 avalon systemd[1084]: Reached target Basic System.
Dec 21 11:08:14 avalon systemd[1084]: Reached target Default.
Dec 21 11:08:14 avalon systemd[1084]: Startup finished in 26ms.
Dec 21 11:08:14 avalon systemd[1]: Started User Manager for UID 1001.
Dec 21 11:08:14 avalon systemd[1]: Started Session 2 of user beginner.
Dec 21 11:08:18 avalon systemd[1]: Stopping User Manager for UID 1001...
Dec 21 11:08:18 avalon systemd[1084]: Reached target Shutdown.
Dec 21 11:08:18 avalon systemd[1084]: Starting Exit the Session...
Dec 21 11:08:18 avalon systemd[1084]: Stopped target Default.
Dec 21 11:08:18 avalon systemd[1084]: Stopped target Basic System.
Dec 21 11:08:18 avalon systemd[1084]: Stopped target Sockets.
Dec 21 11:08:18 avalon systemd[1084]: Stopped target Timers.
Dec 21 11:08:18 avalon systemd[1084]: Stopped target Paths.
Dec 21 11:08:18 avalon systemd[1084]: Received SIGRTMIN+24 from PID 1215 (kill).
Dec 21 11:08:18 avalon systemd[1]: Stopped User Manager for UID 1001.
Dec 21 11:08:18 avalon systemd[1]: Removed slice user-1001.slice.
Dec 21 11:08:19 avalon systemd[1]: Created slice user-1001.slice.
Dec 21 11:08:19 avalon systemd[1]: Starting User Manager for UID 1001...
Dec 21 11:08:19 avalon systemd[1]: Started Session 3 of user beginner.
Dec 21 11:08:19 avalon systemd[1223]: Reached target Sockets.
Dec 21 11:08:19 avalon systemd[1223]: Reached target Timers.
Dec 21 11:08:19 avalon systemd[1223]: Reached target Paths.
Dec 21 11:08:19 avalon systemd[1223]: Reached target Basic System.
Dec 21 11:08:19 avalon systemd[1223]: Reached target Default.
Dec 21 11:08:19 avalon systemd[1223]: Startup finished in 14ms.
Dec 21 11:08:19 avalon systemd[1]: Started User Manager for UID 1001.
Dec 21 11:08:20 avalon systemd[1]: Started Session 4 of user beginner.
Dec 21 11:08:39 avalon systemd[1]: Stopping User Manager for UID 1001...
Dec 21 11:08:39 avalon systemd[1223]: Reached target Shutdown.
Dec 21 11:08:39 avalon systemd[1223]: Starting Exit the Session...
Dec 21 11:08:39 avalon systemd[1223]: Stopped target Default.
Dec 21 11:08:39 avalon systemd[1223]: Stopped target Basic System.
Dec 21 11:08:39 avalon systemd[1223]: Stopped target Sockets.
Dec 21 11:08:39 avalon systemd[1223]: Stopped target Timers.
Dec 21 11:08:39 avalon systemd[1223]: Stopped target Paths.
Dec 21 11:08:39 avalon systemd[1223]: Received SIGRTMIN+24 from PID 1308 (kill).
Dec 21 11:08:39 avalon systemd[1]: Stopped User Manager for UID 1001.
Dec 21 11:08:39 avalon systemd[1]: Removed slice user-1001.slice.
Dec 21 11:08:46 avalon systemd[1]: Created slice user-1001.slice.
Dec 21 11:08:46 avalon systemd[1]: Starting User Manager for UID 1001...
Dec 21 11:08:46 avalon systemd[1]: Started Session 5 of user beginner.
Dec 21 11:08:46 avalon systemd[1318]: Reached target Paths.
Dec 21 11:08:46 avalon systemd[1318]: Reached target Sockets.
Dec 21 11:08:46 avalon systemd[1318]: Reached target Timers.
Dec 21 11:08:46 avalon systemd[1318]: Reached target Basic System.
Dec 21 11:08:46 avalon systemd[1318]: Reached target Default.
Dec 21 11:08:46 avalon systemd[1318]: Startup finished in 17ms.
Dec 21 11:08:46 avalon systemd[1]: Started User Manager for UID 1001.
Dec 21 11:08:46 avalon systemd[1]: Started Session 6 of user beginner.
Dec 21 11:09:44 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device/start timed out.
Dec 21 11:09:44 avalon systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device.
Dec 21 11:09:44 avalon systemd[1]: Dependency failed for /dev/disk/by-uuid/66341dbb-4e46-4bcd-89ad-9b40aa873fe6.
Dec 21 11:09:44 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.swap: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.swap/start failed with result 'dependency'.
Dec 21 11:09:44 avalon systemd[1]: dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device: Job dev-disk-by\x2duuid-66341dbb\x2d4e46\x2d4bcd\x2d89ad\x2d9b40aa873fe6.device/start failed with result 'timeout'.
Dec 21 11:16:00 avalon systemd[1]: Started Session 7 of user beginner.
Dec 21 11:16:00 avalon systemd[1]: Started Session 8 of user beginner.
Dec 21 11:16:21 avalon systemd[1]: Started Session 9 of user beginner.
Dec 21 11:16:21 avalon systemd[1]: Started Session 10 of user beginner.
Dec 21 11:17:01 avalon CRON[2542]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Dec 21 11:17:54 avalon systemd[1]: Started Session 12 of user beginner.
Dec 21 11:17:54 avalon systemd[1]: Started Session 13 of user beginner.
Dec 21 11:19:42 avalon systemd[1]: Started Session 14 of user beginner.
Dec 21 11:23:41 avalon systemd[1]: Started Session 15 of user beginner.
Dec 21 11:24:27 avalon systemd[1]: Started Session 16 of user beginner.
Dec 21 11:34:47 avalon systemd[1]: Started Session 17 of user beginner.
Dec 21 11:34:47 avalon systemd[1]: Started Session 18 of user beginner.
Dec 21 11:35:49 avalon systemd[1]: Started Session 19 of user beginner.
Dec 21 11:35:49 avalon systemd[1]: Started Session 20 of user beginner.
Dec 21 11:35:53 avalon systemd[1]: Started Session 21 of user beginner.
Dec 21 11:35:53 avalon systemd[1]: Started Session 22 of user beginner.
Dec 21 11:36:23 avalon systemd[1]: Started Session 23 of user beginner.
Dec 21 11:36:23 avalon systemd[1]: Started Session 24 of user beginner.
Dec 21 11:40:10 avalon systemd[1]: Started Session 25 of user beginner.
Dec 21 11:40:10 avalon systemd[1]: Started Session 26 of user beginner.
Dec 21 11:41:17 avalon systemd[1]: Started Session 27 of user beginner.
Dec 21 11:41:17 avalon systemd[1]: Started Session 28 of user beginner.
Dec 21 11:52:24 avalon systemd[1]: Started Session 29 of user beginner.
Dec 21 11:52:24 avalon systemd[1]: Started Session 30 of user beginner.
Dec 21 11:52:29 avalon systemd[1]: Started Session 31 of user beginner.
Dec 21 11:52:29 avalon systemd[1]: Started Session 32 of user beginner.

$ sudo crontab -e
[sudo] password for beginner:
no crontab for root - using an empty one

检查文件 /etc/crontab:

$ sudo less /etc/contab
# /etc/crontab: system-wide crontab

# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

#

cron.daily 和 cron.hourly 中的文件

raphael@frankfurt:~$ ls /etc/cron*
/etc/crontab

/etc/cron.d:
anacron

/etc/cron.daily:
0anacron  bsdmainutils      logrotate  passwd                  upstart
apport    cracklib-runtime  man-db     popularity-contest
apt       dpkg              mlocate    update-notifier-common

/etc/cron.hourly:

磁盘空间似乎很好:

Filesystem      Size  Used Avail Use% Mounted on
udev            4.8G     0  4.8G   0% /dev
tmpfs           977M  9.0M  968M   1% /run
/dev/sda1        40G   11G   28G  28% /
tmpfs           4.8G  4.0K  4.8G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           4.8G     0  4.8G   0% /sys/fs/cgroup
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           977M  4.0K  977M   1% /run/user/1001

答案1

问题如下:

我正在寻找一些脚本来设置我的环境。其中一个脚本包含

set -e

任何导致错误的因素都会停止 bash 的执行。

经验教训:永远不要set -e在.bashrc中。


编辑:正如 NicoMinsk 指出的那样,可以在 bashrc 的末尾设置 -e 而不会出现任何问题。

相关内容