Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant provisioning switches character encoding

I was running vagrant provision today and it failed with the following error:

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>│││└───────────────────────────────────────────────────────────────────────────┘

But then, to my surprise, it started printing a stack trace in a very strange encoding...

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


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

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


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

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

And the terminal prompt returned...in that same encoding! All my input was converted to that encoding (capital letters appeared as usual though).

My question is: why does Vagrant change the encoding of my terminal window, and does it have something to do with the GRUB error?

I'm on a Macbook Pro.

like image 846
ataber Avatar asked Aug 27 '13 17:08

ataber


2 Answers

If you are using apt-get upgrade/dist-upgrade, try it:

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

like image 193
Gustavo Henrique Avatar answered Nov 10 '22 03:11

Gustavo Henrique


I wrote a function for it. Just copy paste it into your provision script:

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

Note: I had posted this as a comment to @gustavohenrique's answer but it didn't had a good format as a comment. So, I've posted this as an answer although it's a duplicate answer. It's more of a supplement. Sorry for the disruption.

like image 42
Inanc Gumus Avatar answered Nov 10 '22 04:11

Inanc Gumus