Подтвердить что ты не робот

Кодирование символов

Сегодня я запускал 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
␊┼␍

И подсказка терминала вернулась... в ту же кодировку! Весь мой вход был преобразован в эту кодировку (заглавные буквы появились как обычно).

Мой вопрос: почему Вагрант меняет кодировку моего окна терминала и имеет ли это что-то общее с ошибкой GRUB?

Я на Macbook Pro.

4b9b3361

Ответ 1

Если вы используете apt-get upgrade/dist-upgrade, попробуйте:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

Ответ 2

Я написал для него функцию. Просто скопируйте его в свое положение script:

function aptget {
  # to prevent encoding problem
  sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
    -o Dpkg::Options::="--force-confdef" \
    -o Dpkg::Options::="--force-confold" \
    [email protected]
}

aptget update
aptget upgrade

Примечание. Я опубликовал это как комментарий к ответу @gustavohenrique, но в комментарии не было хорошего формата. Итак, я опубликовал это как ответ, хотя это дублированный ответ. Это больше дополняет. Извините за нарушение.