PJ-Singh-001 / Cubic

The Official Web Site for Cubic (Custom Ubuntu ISO Creator) (https://github.com/PJ-Singh-001/Cubic)
821 stars 47 forks source link

Unable to persist user after installation on Ubuntu 22.04.3 #292

Open prorealize opened 8 months ago

prorealize commented 8 months ago

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:

Expected behaviour

Have users persisting on installed after ISO installation

OS Information (please complete the following information):

Cubic Information (please complete the following information): Cubic version... 2023.12.85

PJ-Singh-001 commented 8 months ago

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

ChYUYAO commented 8 months ago

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 commented 8 months ago

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 commented 7 months ago

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 commented 7 months ago

@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 commented 7 months ago

@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 commented 7 months ago

@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 commented 7 months ago

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 commented 7 months ago

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