我有一台服务器,当我从机器注销后,它不显示标准 bash 提示符。
如果我 ssh 到该服务器,我可以在那里执行所有操作(例如 ls、cwd 等)尝试重新安装 bash(sudo apt-get install --reinstall bash)也没有帮助,以及 source bashrc。
这是我目前 ssh 之后得到的输出:
Linux mymachine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
source ~/.bashrc
ls
cd /tmp/
ls
192525856
250675275
873713638
(那里没有显示提示,但我可以在那里输入任何 Linux 命令并直接显示)。
我怎样才能再次显示 bash 提示符?
编辑:使用此命令,我的 bash 提示符再次回来了
bash -i
bash: cannot set terminal process group (4896): Inappropriate ioctl for device
bash: no job control in this shell
mymachine@myuser2:~$ ls
现在我正在尝试找出上述错误,以及为什么尽管出现错误它仍返回提示。
答案1
好的,我找到了问题,/dev/pts 由于某种原因丢失了。安装完所有内容后,它按预期工作:
mount -t devtmpfs -o mode=0755 udev /dev
mount: udev is already mounted or /dev busy
udev is already mounted on /dev
udev is already mounted on /opt/axess_310_TICKET/dev
udev is already mounted on /opt/grafana_test/dev
udev is already mounted on /opt/axess_39/dev
udev is already mounted on /opt/axess_39_TICKET/dev
udev is already mounted on /opt/ACS_DUMP_TEST/dev
mount -t devpts devpts /dev/pts
udevadm trigger
答案2
我在使用 SLURM 的 srun 并忘记 pty 选项时遇到了同样的问题:
srun --partion=my_partion bash
导致此问题。但包括 --pty 可以消除此问题:
srun --pty --partion=my_partion bash
产生一个提示:
yoder@mgmt:~$ srun --pty --partition=my_partion bash
yoder@node1:~$