Defaut pi name change
-
Hi, i'm using the official retropie prebuilt image. I want to change the default username of pi to something else.
I know that after that i would have to make sure to also rename the home folder of pi, the default group pi and lastly to update the files in /etc/sudoers.d/ so that i can use sudo without a password prompt.
Is there anything else that i should worry about?
Would there be any incompatibilities regarding the retropie script? -
@headcrab Honestly? I would not mess with the
pi
user. So many packages and scripts have this user hard-coded into paths etc. It is likely to cause all sorts of untold issues that will continue to crop up. If you are well versed in Linux, then go for it, otherwise I would let things remain as they are. -
@jonnykesh I'm not sure the RetroPie setup scripts harcodes the
pi
user in the install scripts, but some old experimental.optional packages might assume that.@Headcrab is there a valid reason - other than a cosmetical name change - you don't want to use the default
pi
username ? -
@mitu I'm sure the main RetroPie scripts use a $user variable. I was thinking more in terms of additional scripts, third party scrapers or as you said experimental packages.
I just don't see the point of potentially breaking something but to each their own. -
@mitu
I sync my savefiles to another rpi using rsync via samba shares.
It is a work in progress (might switch to rsync via ssh), so i would prefer to have the same username and uid across my installs to avoid any permission issues and make management easier.If it is only the experimental packages that might cause trouble, i will keep that in mind, but for now i don't use any.
-
I'm back after my first attempt at this. It is not so simple after all, so i don't recommend anyone without enough linux knowledge to try this at a working install.
These are some problems i encountered:
-
autologin failed.
Solution => Edit /etc/systemd/system/autologin@.service and rename pi in the 'ExecStart=-/sbin/agetty' line. -
Emulationstation doesn't show any systems
Solution => Edit /opt/retropie/configs/all/emulationstation/es_systems.cfg
All the paths containing pi need to be fixed.
I'm not sure if /etc/emulationstation/es_systems.cfg should also be edited or what happens after an update. -
Also don't forget to chown /opt/retropie/configs/ with your new user:usergroup
And generally do a
find . -type d -user USERNAME
To find any folders that belong to pi.
For example all the files in /opt/retropie/emulators/drastic/ where owned by pi.
I didn't have the time to test anything else yet, i only launched a snes game and it seemed to work fine.
Any further insights would be welcome.
-
-
@headcrab If you come across any other issues post them here. Seems straight-forward enough but not without issues. As you said someone without any Linux knowledge might have problems.
-
@headcrab I'd rather reinstall RetroPie using the new user, than to modify the existing installation. This way you don't have to change rights, modify paths, etc.
For instance, the autostart service uses the proper user when it's set up - https://github.com/RetroPie/RetroPie-Setup/blob/28dd3d70634f30d4998c76b305badfa8977a57a1/scriptmodules/supplementary/autostart.sh#L74 - and I'm sure that ES does the same when installed the 1st time. -
The scripts are indeed flexible since retropie is available for other platforms beyond raspbian.
I just wanted to save some time, since my install is a dual boot on top of Noobs, so starting from scratch would take hours.
Also anyone that starts with the ready made retropie image from github will also have to go through these steps.If anything comes up i will post it here.
-
Hi, i'll just post the full list of edits that need to be completed, just in case someone stumbles on this thread in the future.
#i did the following not through ssh, but with a physical keyboard #enable root user sudo passwd root #logout of the user pi logout #Log back in as root #Rename user pi usermod -l newname pi #Rename the user's home directory usermod -m -d /home/newname newname #Rename group pi groupmod --new-name newname pi #Now logout and log back in as newname #Disable password prompt for sudo cd /etc/sudoers.d/ sudo mv 010_pi-nopasswd 010_newname-nopasswd sudo nano 010_Name-nopasswd # edit the name pi to newname #Double check newname has sudo privileges sudo visudo #Disable Root sudo passwd -l root #fix the getty autologin username or else stuck at boot sudo nano /etc/systemd/system/autologin@.service #search for the following line ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM. #smb.conf has pi user in the share definitions sudo nano /etc/samba/smb.conf #Change the es_systems.cfg folder paths cd /opt/retropie/configs/all/emulationstation/ cp es_systems.cfg es_systems.cfg.pi.bak sudo nano es_systems.cfg #Folder configs and everything below /opt/retropie/configs/ sudo chown -R newname:newname /opt/retropie/configs/ #Paths for game image files also need editing #Look in /opt/retropie/configs/all/emulationstation/gamelists/ #check fstab if you have mounted anything sudo nano /etc/fstab # If you installed Drastic all the containing files of /opt/retropie/emulators/drastic/ sudo chown -R Name:Name /opt/retropie/emulators/drastic/*
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.