I already read this, but it hasn't helped. Not having logged in to the 'olduser', I type sudo usermod -l 'newuser' 'olduser' and it yields the error message from the title of my question. What can I do?
2 Answers
It is not just being logged in as the olduser, but also if the olduser id is running any processes on the system. If you search the output of ps -ef|grep olduser you may see the processes it is running. Actually, the error message is telling you the PID of the process it is running (the <number> in your question headline)
You can kill the process or processes it is running and run your change username command and you should be okay. If not, please post what other error(s) you are running into, for further help.
Log in as root, then open terminal and run
kill -9 -u [old_username] && username -l [old_username] [new_username]
After that run
adduser [new_username] sudo
to be able to run sudo commands with the new username.