Unable to persist user after installation on Ubuntu 22.04.3
Describe the question
Users created on virtual environment doesn't seem to persist on Ubuntu 22.04.3. It seems odd as it would persist on Ubuntu 20.04 for a previous installation.
What you have tried
Adding a user with useradd or even through apt package management have the users showing on the /etc/passwd on the custom-root but the changes doesn't reflect after ISO installation.
Steps to replicate:
- Download Ubuntu Server 22.04.3
- Add MongoDB repository and install it
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
apt update && apt install mongodb-org
- Verify user exists on
/etc/passwdwithcat /etc/passwd | grep mongodb - Install ISO generated by Cubic
- Verify user doesn't exists on
/etc/passwdwithcat /etc/passwd | grep mongodb
Expected behaviour
Have users persisting on installed after ISO installation
OS Information (please complete the following information):
- Ubuntu Server 22.04.3
Cubic Information (please complete the following information): Cubic version... 2023.12.85
I suspect this is because 22.04 uses Subiquity and overlay file systems, whereas 20.04 did not. I'll look into this.
The same happened to me. The base image I imported was also ubuntu22.04.3. When I installed nfs, rcpbind was automatically installed and an _rpc user was created, but the user was not saved on the new host. By the way, the contents of the /etc/fstab file I modified are not saved either. Is this a similar problem? @PJ-Singh-001
I have a similar situation. I did install additional packages in the terminal, but after generating iso and installed on the hardware, those packages are not there. It took changes from the Pressed/user-data thought.
I have a similar situation. I did install additional packages in the terminal, but after generating iso and installed on the hardware, those packages are not there. It took changes from the Pressed/user-data thought.
@misiek303, Your question regarding packages was answered in Issue #295, Installed packages via apt in Cubic Terminal don't exist in the final ISO.
@prorealize,
I will assume you are customizing Ubuntu Server 22.04 ISO, which uses the Subiquity installer, and not the 22.04 Desktop ISO.
You will need to install using the minimal install option, as described in Issue #295, Installed packages via apt in Cubic Terminal don't exist in the final ISO).
You can create users using the adduser command as described in Issue #3, How to create custom users on the login screen?. I suggest using adduser instead of useradd; you can read about the options the adduser command takes (such as -M to not create a home directory) on the man page.
However, you should not have to manually create this user if you install using the minimal install option I described above.
@ChYUYAO,
Ubuntu Server 22.04 uses the Subiquity installer. You will need to install using the minimal install option, as described in Issue #295, Installed packages via apt in Cubic Terminal don't exist in the final ISO).
The /etc/fstab file is overwritten by the installer, because the installer does its own partitioning.
You can use one these techniques to work around this:
- Keep a customized version of your
fstabfile in/usr/local/etc. Then copy/etc/local/fstabto/etc/using thelate-commandscommand incloud-init. - Using the
late-commandscommand incloud-init, append the necessary line to/etc/fstabwith the commandecho "<your fstab line>" | tee --append /etc/fstab.
@ChYUYAO,
Ubuntu Server 22.04 uses the Subiquity installer. You will need to install using the minimal install option, as described in Issue #295, Installed packages via apt in Cubic Terminal don't exist in the final ISO).
The
/etc/fstabfile is overwritten by the installer, because the installer does its own partitioning.You can use one these techniques to work around this:
- Keep a customized version of your
fstabfile in/usr/local/etc. Then copy/etc/local/fstabto/etc/using thelate-commandscommand incloud-init.- Using the
late-commandscommand incloud-init, append the necessary line to/etc/fstabwith the commandecho "<your fstab line>" | tee --append /etc/fstab.
I've tried the second way, but still haven't customized what I need in /etc/fstab.
late-commands: - echo "/mnt/var /var none bind" | tee --append /etc/fstab - echo "/mnt/home /home none bind" | tee --append /etc/fstab - echo "/mnt/tmp /tmp none bind" | tee --append /etc/fstab
iso:ubuntu-22.04.3-live-server-amd64.iso mysystem:ubuntu 20.04 desktop
I think the format needs to be something like this:
#cloud-config
autoinstall:
version: 1
late-commands:
- curtin in-target --target=/target -- <your shell command>
Where <your shell command> should be replaced with your shell command.
I suggest making sure the late-commands works by creating a simple test file first to ensure you have the correct format in your couid-init file.
#cloud-config
autoinstall:
version: 1
late-commands:
- curtin in-target --target=/target -- touch /opt/test.txt
@PJ-Singh-001 Hi, I have the similar issue.
I installed docker.io and dnsmasq in the Terminal part. During the installation, user dnsmasq and group docker is created.
When finished the ISO and install a server with this ISO, the user dnsmasq and group docker are missing which cause dnsmasq and docker failed to start.
Would you please help to take a look on this? Thank you in adavnace!