If this is a UEFI install then you can edit the kernel command line to add init=/usr/bin/bash
to it so that you end up at a bash shell during boot. Then you can edit the file to remove your changes and reboot.
The reason this issue happened in the first place is because /etc/environment
is read by pam_env
, it's not invoked as part of the setup scripts. So every entry in it needs to be in key=value
form, such as MY_VAR=hello
and not export MY_VAR=hello
. You also can't do variable expansion like PATH=${PATH}:/my/new/path
. It's recommended that if you need something like the latter that you create a script in /etc/profile.d
instead.