How to change username

I’m checking out the latest qcow2 image and I changed the username in the settings but the terminal still shows me as “purism”. I tried changing the username with usermod but it just tells me usermod: user purism is currently used by process XXX.

How do I change the username because “purism” is simply not acceptable?

2 Likes

I’ve actually run into this too. It’s only a VM, so I don’t care much, but I’d want to change my username on the phone once I get it

1 Like

I think you probably need to drop to a terminal prior to logging in as purism. On a laptop/desktop, this would be done with Ctrl+Alt+F{2-7} or something like that, but I’m not sure how one might do it on the Librem 5 image.

2 Likes

I’m curious about this as well.

Another way is to create a new user with adduser → reboot → log in as a new user → delete the previous user with deluser.

I believe that the current answer (on the real phone) is:

  • no, you can’t do that (you can add as many additional users as you like but if you delete purism, you will break the phone)
  • Purism is aware of this issue (although I don’t consider it to be a major issue).
1 Like

The login procedure is currently assuming that the GUI is running under the user called purism. If you try to change it, you’ll be left without GUI.

3 Likes

Is that coded in to a program or service somewhere? I couldn’t find anything under /etc that had ‘purism’ in it that was relevant so I’m assuming it’s part of some application code?

What about the hostname? Can we change that without any negative side effects?

systemd ???

I have done so months ago, without causing any evident problems. So I would say go ahead and change it.

 systemd ???

Yeah, I mostly looked in systemd units under /etc/systemd but looked a few other places as well. I may have missed it though.

Edit: Sort of relevant: https://source.puri.sm/Librem5/phosh/-/merge_requests/493/diffs?commit_id=babbd8d6183bd1fe801a983794591c3b4a34a564

1 Like

Right. /lib/systemd/system/phosh.service contains User=1000 which may mean that you could rename the purism account.

(From past experience though, changing the association between name and uid of an account on Linux involves changing things in quite a few different places. So it wouldn’t be a bad idea to have a second account that is allowed ssh access in and has sudo access, and of course working ssh access in, in case you break it.)

Well, I tried it in a VM and so far, so good.

  1. Enabled the root account and enabnled logging in as root via SSH.
  2. Updated /home/purism to my name.
  3. Updated /etc/passwd and /etc/shadow to have my name instead of purism.
  4. Added my new username to the sudo group.
  5. Rebooted the VM.

I’m curious to see what happens after updates. As Dorota said it could leave me without a GUI, so we’ll see what happens.

Edit: Please don’t use this as a guide unless someone smarter than me from Purism says this is safe. It very well may not be safe.

2 Likes

easiest way:
boot single user (add single to kernel boot parameter to ensure only root processess will run)
usermod -l new-login-name old-name
groupmod -n new-login-name old-name
reboot

that is actuallyw rong way - more cosher would be groupmod -a newuser sudo
you don’t have to have dedicated entry in sudoers file

That is what I did, I didn’t update /etc/sudoers directly for that. Updated my post above.

1 Like

The only other thing that I would add to that is … rename /media/purism

It may well work without doing that but it is untidy at a minimum.

1 Like

How can you edit the kernel boot parameters on the Librem 5?

flash-kernel is the program managing them.

That will actually edit the username, correct?

But what if I wanted to create a new user from scratch and use it as the main user, and eradicate the original one? The log in screen on boot does not seem to be allowing to choose who is logging in.

1 Like

I think so. Rename. But without fixing the home directory and anything else similar that might depend on it - and I read previously that this will break things because purism is hard-coded somewhere, so that is to be included within the “anything else”.

If done comprehensively, how would that differ? (Theoretically, doing it your way, the “main user” would end up with a different uid but would that matter to you?)

From past experience (not on the Librem 5), renaming the existing account and keeping the uid/gid the same is less hassle.