kata-containers / kata-containers

Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolation and security advantages of VMs. https://katacontainers.io/
Apache License 2.0
5.08k stars 1k forks source link

rootfs.sh reports error when creating chrony.conf #9837

Open xiyan18 opened 1 week ago

xiyan18 commented 1 week ago

refer to this document to create rootfs:https://github.com/kata-containers/kata-containers/blob/main/tools/osbuilder/rootfs-builder/README.md

image

My OS is ubuntu, the setup_rootfs function did not create the "${ROOTFS_DIR}/etc/chrony/" directory image

image

justxuewei commented 1 week ago

@xiyan18 Would you mind adding the following two lines and running again?

+   if [ -f "${chrony_conf_file}" ]; then
    info "Configure chrony file ${chrony_conf_file}"
    cat >> "${chrony_conf_file}" <<EOF
refclock PHC /dev/ptp0 poll 3 dpoll -2 offset 0
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, at any time
makestep 1 -1
EOF
+   fi
justxuewei commented 1 week ago

Btw, for the next time, could you paste code rather than upload pictures? The pictures won't be helpful for other people to search. Thanks ;)