Seems you have something broken in the sequence of scripts which run when logging in; specifically one which calls sed
You could either debug your .bashrc and .bash_profile scripts (and anything else that gets called by them) to try to locate where /usr/bin/sed is being called and correct it (and it may well be off in some other script elsewhere on your system - not necessarily within ~), or you could try changing your default login shell to something other than bash, so that those bash scripts are not called and you at least get the ability to log into the desktop, whereupon you have a better environment for debugging the issue.
chsh -l to list what shells you have installed chsh -s to set the login shell.
If you only have bash available, it might be worthwhile installing fish, or your alternative shell of choice from the tty you’re in now, just to get you started.
For a quick check, you could have a look in journalctl for the current boot to see if there are any pointers in there to the script with the offending line.
Try this to prepend the name of the shell script to the start of each line of output, whilst invoking bash with script echoing turned on (-x) and emulating a login shell (-l)
PS4='+ ${BASH_SOURCE}:${LINENO}: ' bash -x -l
Does it indicate which scripts throw out the “argument list too long” messages?
You can determine whether the error is is some system component or user configuration by creating a “test-user” login to see if the error occurs with a default user configuration.
You should have had quite a lot of output, as your login bash scripts… for example, here’s the last screenful of output from my system starting a login bash shell with line tracing on:
As you can see, as each line of the script is executed it’s emitted to the screen and at the start of each line is the name of the script which is executing and the line number in that script.
What output do you get form executing env -i bash --noprofile --norc?
OK - it would appear that this session is broken and cannot issue the most basic of commands.
As you cannot issue any commands, the only way I can think of to repair the configuration is to boot from a live USB stick, mount your home partition on your disk, find the files /home/usr/.bashrc and /home/usr/.bash_profile and append “.old” to them…
… then un-mount the partition and try to reboot from it.
I suspect that what is happening is that something is spamming multiple copies of the same thing into your path or some other environment variable which is so long it’s causing sed and bash itself to fail to parse it all. That’s why I wanted to see the size of env up above. Should be a few thousand characters (mine is 3438) so if it’s in the tens of thousands then it’s probably buggered.
However, in order to stop this stuff from running we need to be able to issue commands via the shell and whatever is broken is preventing you from issuing anything.