Vagrant配置开关字符编码问题

11

今天我运行了vagrant provision,但是出现了以下错误:

Package configuration┌──────────────────────────┤ Configuring grub-pc ├──────────────────────────┐│││ 
The GRUB boot loader was previously installed to a disk that is no
││ longer present, or whose unique identifier has changed for some reason.   
││ It is important to make sure that the installed GRUB core image stays in  
││ sync with GRUB modules and grub.cfg. Please check again to make sure
││ that GRUB is written to the appropriate boot devices.
││││ If you're unsure which drive is designated as boot drive by your BIOS,    
││ it is often a good idea to install GRUB to all of them.
││││ Note: it is possible to install GRUB to partition boot records as well,  
││ and some appropriate partitions are offered here. However, this forces   
││ GRUB to use the blocklist mechanism, which makes it less reliable, and   
││ therefore is not recommended.
││││<Ok>│││└───────────────────────────────────────────────────────────────────────────┘

但是,出乎意料的是,它开始以一种非常奇怪的编码方式打印堆栈跟踪...

STDERR: F▒␋┌␊␍ ├⎺ ⎺⎻␊┼ ├␊⎼└␋┼▒┌.␍␊␉␌⎺┼°: ┬␤␋⎻├▒␋┌ ⎺┤├⎻┤├ ├␤␊ ▒␉⎺┴␊ ␊⎼⎼⎺⎼⎽, ±␋┴␋┼± ┤⎻!
␍⎻┐±: ␊⎼⎼⎺⎼ ⎻⎼⎺␌␊⎽⎽␋┼± ±⎼┤␉-⎻␌ (--␌⎺┼°␋±┤⎼␊):
 ⎽┤␉⎻⎼⎺␌␊⎽⎽ ␋┼⎽├▒┌┌␊␍ ⎻⎺⎽├-␋┼⎽├▒┌┌▒├␋⎺┼ ⎽␌⎼␋⎻├ ⎼␊├┤⎼┼␊␍ ␊⎼⎼⎺⎼ ␊│␋├ ⎽├▒├┤⎽ 255
E⎼⎼⎺⎼⎽ ┬␊⎼␊ ␊┼␌⎺┤┼├␊⎼␊␍ ┬␤␋┌␊ ⎻⎼⎺␌␊⎽⎽␋┼±:
 ±⎼┤␉-⎻␌
E: S┤␉-⎻⎼⎺␌␊⎽⎽ /┤⎽⎼/␉␋┼/␍⎻┐± ⎼␊├┤⎼┼␊␍ ▒┼ ␊⎼⎼⎺⎼ ␌⎺␍␊ (1)
---- E┼␍ ⎺┤├⎻┤├ ⎺° ▒⎻├-±␊├ ┤⎻±⎼▒␍␊ -≤ ----
R▒┼ ▒⎻├-±␊├ ┤⎻±⎼▒␍␊ -≤ ⎼␊├┤⎼┼␊␍ 100


R␊⎽⎺┤⎼␌␊ D␊␌┌▒⎼▒├␋⎺┼:
---------------------
# I┼ /┴▒⎼/␌␤␊°/␌▒␌␤␊/␌⎺⎺┐␉⎺⎺┐⎽/␌⎺└└⎺┼-⎽⎺°├┬▒⎼␊/⎼␊␌␋⎻␊⎽/␍␊°▒┤┌├.⎼␉

 49: ␊│␊␌┤├␊ "▒⎻├-±␊├-┤⎻±⎼▒␍␊-≤" ␍⎺
 50:   ␌⎺└└▒┼␍ "▒⎻├-±␊├ ┤⎻±⎼▒␍␊ -≤" 
 51: ␊┼␍


 C⎺└⎻␋┌␊␍ R␊⎽⎺┤⎼␌␊:
------------------
# D␊␌┌▒⎼␊␍ ␋┼ /┴▒⎼/␌␤␊°/␌▒␌␤␊/␌⎺⎺┐␉⎺⎺┐⎽/␌⎺└└⎺┼-⎽⎺°├┬▒⎼␊/⎼␊␌␋⎻␊⎽/␍␊°▒┤┌├.⎼␉:49:␋┼ ◆°⎼⎺└_°␋┌␊'

␊│␊␌┤├␊("▒⎻├-±␊├-┤⎻±⎼▒␍␊-≤") ␍⎺
  ⎼␊├┤⎼┼⎽ 0
  ␌⎺└└▒┼␍ "▒⎻├-±␊├ ┤⎻±⎼▒␍␊ -≤"
  ▒␌├␋⎺┼ "⎼┤┼"
  ⎼␊␌␋⎻␊_┼▒└␊ "␍␊°▒┤┌├"
  ⎼␊├⎼≤_␍␊┌▒≤ 2
  ␌⎺⎺┐␉⎺⎺┐_┼▒└␊ "␌⎺└└⎺┼-⎽⎺°├┬▒⎼␊"
  ␉▒␌┐┤⎻ 5
  ⎼␊├⎼␋␊⎽ 0
␊┼␍

终端提示返回的编码与之前一样!所有输入都被转换成了该编码(虽然大写字母照常显示)。

我的问题是:为什么Vagrant会改变我的终端窗口编码,这是否与GRUB错误有关?

我使用的是Macbook Pro。


这是在StackExchange网络的其他地方提出你的问题之前:http://askubuntu.com/questions/325872/ubuntu-unattended-apt-get-upgrade-grub-install-dialog - opyate
你是否曾经确定过这种行为的根本原因? - John Claus
2个回答

10
如果您正在使用 apt-get upgrade/dist-upgrade,请尝试以下命令:sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

1
http://askubuntu.com/questions/146921/how-do-i-apt-get-y-dist-upgrade-without-a-grub-config-prompt - dre
在Raspbian的QEMU chroot中执行时,我会得到这个错误。按照@deeperx下面的答案进行别名设置后一切正常。 - Mike Mackintosh

2
我已经为此编写了一个函数。只需将其复制粘贴到您的配置脚本中即可:
function aptget {
  # to prevent encoding problem
  sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    -o Dpkg::Options::="--force-confdef" \
    -o Dpkg::Options::="--force-confold" \
    $@
}

aptget update
aptget upgrade

注意:我曾将这篇文章作为对@gustavohenrique答案的评论发布,但它并不适合作为评论的格式。所以,尽管这是一个重复的答案,我还是将其发布为了一个答案。它更像是一种补充说明。对于造成的不便,请谅解。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接