vagrant provisioning switches character encoding
Asked Answered
S

2

11

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.

Serious answered 27/8, 2013 at 17:19 Comment(2)
This came before your question elsewhere on the StackExchange network: askubuntu.com/questions/325872/…Cusped
Did you ever determine a root cause for this behavior?Tupper
S
10

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

Sheikh answered 11/6, 2014 at 14:37 Comment(2)
askubuntu.com/questions/146921/…Metametabel
i get this while executing within a qemu chroot for raspbian. aliased like @deeperx's answer below and all is well.Seeker
B
2

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.

Berberidaceous answered 17/5, 2015 at 12:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.