cloudymax / pxeless

An automated system install and image customization tool for when PXE is not an option, or is not an option yet.
MIT License
111 stars 16 forks source link

[Advice] Unable to log-in to newly created image using user-data.basic config? Try this: #33

Closed agusserraa98 closed 1 year ago

agusserraa98 commented 1 year ago

For context, I created my user-data file using the user-data.basic as a base.

I created the image but I can't log in to the server at all with the created user.

I thought it was my configuration but I used the user-data.basic and still can't login.

Anyone with a similar problem?

cloudymax commented 1 year ago

Thanks for letting me know that there was an issue, I'll look into this after work today. 👍

Could you share the command you used to generate your image?

agusserraa98 commented 1 year ago

Hello Max!

Thank you very much for your help I use the following command:

docker run --cpus 3 --privileged --rm --volume "$(pwd):/data" --user $(id -u):$(id -g) deserializeme/pxeless -a -k -u user-data.basic -s ubuntu-22.04.2-live-server-amd64.iso -d unatended.iso -x /data

cloudymax commented 1 year ago

Thanks for providing this and my apologies for the delay, work is rough this week but tomorrow is a national holiday here in The Netherlands so I'll have the time to test a fix 👍

cloudymax commented 1 year ago

@agusserraa98 I tried to run the command you provided:

docker run --cpus 3 --privileged \
--rm --volume "$(pwd):/data" \
--user $(id -u):$(id -g) \
deserializeme/pxeless -a -k -u user-data.basic  -s ubuntu-22.04.2-live-server-amd64.iso -d unatended.iso -x /data

and it failed with a permissions error:

sudo: you do not exist in the passwd database

This prompted me to do some experimenting and it looks like I made an error in the documentation due to some incorrect assumptions about the permissions required to mount a squashfs in a container. Please accept my apologies for not catching that issue earlier 😅

It turns out that we cannot use --user $(id -u):$(id -g) when also using the -x option because your user id is not in the sudoers file of the container, and we need to use sudo to mount the squashfs. This could be fixed by me adding a user account to the container that has been granted password-less sudo access and then explicitly running the docker command with that user's id and group - but that's work i will have to do at a later date. Ive opened a ticket for myself here: https://github.com/cloudymax/pxeless/issues/34

For now, I slightly modified the command to remove the option mentioned previously, and ran it using the latest and v0.0.7 image tags:

docker run --cpus 16 --privileged \
--rm --volume "$(pwd):/data"  \
deserializeme/pxeless -a -k -u user-data.basic  -s ubuntu-22.04.2-live-server-amd64.iso -d unatended.iso -x /data

I was able to install the ISO and login using the basic profile credentials

Screenshot 2023-04-26 at 22 18 08

I also now see that we don't need to use --privileged to mount the squashfs in the container, only sudo. So that flag can also be dropped. 😅

If that still does not work for you, and you are using a USB drive and not a VM - try another USB drive. I have had multiple instances where a drive has failed to properly hold an ISO when imaged via dd/rufus/etcher towards the end of its life. Ive also had this happen with some drives I ordered in bulk from ali-express, so if you have a spare - try it out.

Let me know if you still have issues 👍