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

Fix #323, fix issue of broken systemd (/dev/console) in docker container #342

Merged

Conversation

nghiant2710
Copy link
Contributor

connects to #323. We will create a process that always points to /dev/console to keep it opening.

@petrosagg
Copy link
Contributor

The commit seems to have unrelated changes in it. Please split into atomic changes

@nghiant2710
Copy link
Contributor Author

@petrosagg updated!

@petrosagg
Copy link
Contributor

@nghiant2710 I don't understand why systemd 230 needs all those changes. You need to be more descriptive in your commits

@nghiant2710
Copy link
Contributor Author

nghiant2710 commented Sep 29, 2017

@petrosagg current systemd template will install systemd from jessie-backports as a workaround for /dev/console issue of systemd and docker which happens on systemd v230 and higher. So we will need to update the template (no longer install systemd from jessie-backports, don't mount /sys/fs/cgroup in the container) to support systemd v230 before applying the workaround for /dev/console. That's what the PR does.


COPY entry.sh /usr/bin/
# We only want few core services run in the container.
RUN find /etc/systemd/system \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use systemctl enable/disable/mask instead of deleting the files

Copy link
Contributor Author

@nghiant2710 nghiant2710 Oct 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrosagg, if we don't delete those files, the logs will be very ugly and can make user confused. For example:

18.10.17 02:45:35 (+0700) Systemd init system enabled.
18.10.17 02:45:35 (+0700) systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
18.10.17 02:45:35 (+0700) Detected virtualization docker.
18.10.17 02:45:35 (+0700) Detected architecture arm.
18.10.17 02:45:35 (+0700) Set hostname to <4457d5d>.
18.10.17 02:45:35 (+0700) Failed to install release agent, ignoring: No such file or directory
18.10.17 02:45:35 (+0700) systemd-remount-fs.service: Cannot add dependency job, ignoring: Unit systemd-remount-fs.service is masked.
18.10.17 02:45:35 (+0700) sys-kernel-config.mount: Cannot add dependency job, ignoring: Unit sys-kernel-config.mount is masked.
18.10.17 02:45:35 (+0700) dev-hugepages.mount: Cannot add dependency job, ignoring: Unit dev-hugepages.mount ismasked.
18.10.17 02:45:35 (+0700) systemd-modules-load.service: Cannot add dependency job, ignoring: Unit systemd-modules-load.service is masked.
18.10.17 02:45:35 (+0700) sys-fs-fuse-connections.mount: Cannot add dependency job, ignoring: Unit sys-fs-fuse-connections.mount is masked.
18.10.17 02:45:35 (+0700) kmod-static-nodes.service: Cannot add dependency job, ignoring: Unit kmod-static-nodes.service is masked.
18.10.17 02:45:35 (+0700) getty.target: Cannot add dependency job, ignoring: Unit getty.target is masked.
18.10.17 02:45:35 (+0700) systemd-logind.service: Cannot add dependency job, ignoring: Unit systemd-logind.service is masked.
18.10.17 02:45:35 (+0700) display-manager.service: Cannot add dependency job, ignoring: Unit display-manager.service is masked.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nghiant2710 why don't you disable instead of masking then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrosagg there're some static services which can't be disabled and they will output errors when systemd starts.
I've updated this, we should keep masking services as we do now since the above errors seems to be systemd issue (I see the same issue here systemd/systemd#5358). We can explain to users if they ask about these messages.

COPY launch.service /etc/systemd/system/launch.service

RUN systemctl enable launch.service systemd-udevd
RUN systemctl enable /etc/systemd/system/launch.service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the full path of the service here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


if [ $suite == '24' ]; then
cgroup='VOLUME ["/sys/fs/cgroup"]'
cgroupEntry='mount -t tmpfs -o mode=0755 cgroup /sys/fs/cgroup'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the cgroup not needed in the other case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to mount cgroup in some systemd latest versions, it relates to this issue systemd/systemd#6477.

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

Successfully merging this pull request may close these issues.

None yet

2 participants