Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to persist user after installation on Ubuntu 22.04.3 #292

Open
prorealize opened this issue Feb 17, 2024 · 9 comments
Open

Unable to persist user after installation on Ubuntu 22.04.3 #292

prorealize opened this issue Feb 17, 2024 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@prorealize
Copy link

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/passwd with cat /etc/passwd | grep mongodb
  • Install ISO generated by Cubic
  • Verify user doesn't exists on /etc/passwd with cat /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

@prorealize prorealize added the question Further information is requested label Feb 17, 2024
@PJ-Singh-001
Copy link
Owner

I suspect this is because 22.04 uses Subiquity and overlay file systems, whereas 20.04 did not.
I'll look into this.

@PJ-Singh-001 PJ-Singh-001 self-assigned this Feb 24, 2024
@ChYUYAO
Copy link

ChYUYAO commented Mar 1, 2024

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

@misiek303
Copy link

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.

@PJ-Singh-001
Copy link
Owner

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.

@PJ-Singh-001
Copy link
Owner

@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.

@PJ-Singh-001
Copy link
Owner

@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:

  1. Keep a customized version of your fstab file in /usr/local/etc. Then copy /etc/local/fstab to /etc/ using the late-commands command in cloud-init.
  2. Using the late-commands command in cloud-init, append the necessary line to /etc/fstab with the command echo "<your fstab line>" | tee --append /etc/fstab.

@ChYUYAO
Copy link

ChYUYAO commented Mar 14, 2024

@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:

  1. Keep a customized version of your fstab file in /usr/local/etc. Then copy /etc/local/fstab to /etc/ using the late-commands command in cloud-init.
  2. Using the late-commands command in cloud-init, append the necessary line to /etc/fstab with the command echo "<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

@PJ-Singh-001
Copy link
Owner

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

@magixyu
Copy link

magixyu commented Mar 21, 2024

@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.
image

Would you please help to take a look on this? Thank you in adavnace!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants