hypriot / os-rootfs

The root filesystem of HypriotOS
http://blog.hypriot.com/post/how-to-get-docker-working-on-your-favourite-arm-board-with-hypriotos/
MIT License
69 stars 40 forks source link

Firstboot service conflicts with cloud-init. #62

Closed techdragon closed 6 years ago

techdragon commented 6 years ago

reconfiguring the openssh server during the first boot scripts driven by the first boot service, conflicts with the execution of any package install in cloud-init that wants to use debconf.

Firstboot and cloud-init need to operate sequentially not in parallel.

techdragon commented 6 years ago

further investigation shows the easiest fix is to make a change in the builder after installing cloud-init.

firecyberice commented 6 years ago

@techdragon Which error messages do you get? What is not working as expected?

StefanScherer commented 6 years ago

We should try it without that reconfiguring, probably this is also done by cloud-init I'll reopen this issue to track progress.

techdragon commented 6 years ago

@firecyberice There is no error unless you undertake an action in cloud-init scripts that will require Debian to interact with the package lock. Most commonly, upgrading the packages will pull down a timezone package update, which requires the system to run the timezone reconfiguration via dpkg which fails due to the first boot script running in parallel with the cloud-init.

techdragon commented 6 years ago

@StefanScherer I was inclined to suggest this fix in the downstream hypriot image which adopted cloud-init. However one possible method for fixing this in the root image would be adopting cloud-init and converting the first-boot script task over to cloud-init.

StefanScherer commented 6 years ago

Maybe we do not need the firstboot script.

neta540 commented 6 years ago

/var/lib/cloud/scripts/ can contain per-boot, per-instance and per-once directories where boot scripts can be added and will be executed according to the directory. I don't see a reason a special firstboot script should be, when it can be done in a better way with cloud-init

techdragon commented 6 years ago

@neta540 👍 thats exactly the sort of thing I was investigating and was referring to when I suggested to @StefanScherer that the firstboot scripts could be converted over to cloud-init.

neta540 commented 6 years ago

Also it will help removing that ugly symbolic link, I truly hate having symbolic links on git repositories such as this. It lets them be cloned only on filesystems that support symbolic links. When making a Docker repository you'd want to make it as multiplatform as possible, to make it build-able in any Docker compatible machine... To have it working correctly on Windows machines for instance, you'd need to create that link manually with ln -s on the chroot script, also set file permissions correctly in the build.sh / chroot script accordingly.. another option is to use systemctl enable to create that link for you.

StefanScherer commented 6 years ago

Thanks @neta540 for the hint with the symlink. I first thought, which symlink, but you're right. Seems a good plan to get rid of the firstboot script.

StefanScherer commented 6 years ago

I'm trying to remove firstboot in HypriotOS 1.8.0. Will be tracked in https://github.com/hypriot/image-builder-rpi/issues/225

StefanScherer commented 6 years ago

Reopening, still WIP https://github.com/hypriot/image-builder-rpi/pull/227

StefanScherer commented 6 years ago

Will be fixed in HypriotOS 1.8.0, PR merged.