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

✨ Allow serial login in openrc systems #1505

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion overlay/files/system/oem/10_accounting.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Default user and permissions"
name: "Default user, permissions and serial login"
stages:
initramfs:
- name: "Setup groups"
Expand Down Expand Up @@ -48,3 +48,8 @@ stages:
commands:
- chown -R root:admin /usr/local/cloud-config
- chmod 770 /usr/local/cloud-config
- name: "Enable serial login for alpine" # https://wiki.alpinelinux.org/wiki/Enable_Serial_Console_on_Boot
if: '[ -e /sbin/rc-service ]'
commands:
- sed -i -e 's/ttyS0.*//g' /etc/inittab
- echo "ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100" >> /etc/inittab
14 changes: 9 additions & 5 deletions tests/upgrade_latest_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,26 @@ import (
var _ = Describe("k3s upgrade manual test", Label("upgrade-latest-with-cli"), func() {
var vm VM
containerImage := os.Getenv("CONTAINER_IMAGE")
var installOutput string

BeforeEach(func() {
if containerImage == "" {
Fail("CONTAINER_IMAGE needs to be set")
}
_, vm = startVM()
vm.EventuallyConnects(1200)
// Workaround for v2.2.0 alpine flavors mounting /tmp and overwriting the install config
// TODO: drop in v2.2.1 or v2.3.0 whichever comes first
time.Sleep(5 * time.Minute)
})

AfterEach(func() {
if CurrentSpecReport().Failed() {
gatherLogs(vm)
fmt.Print(installOutput)
serial, _ := os.ReadFile(filepath.Join(vm.StateDir, "serial.log"))
_ = os.MkdirAll("logs", os.ModePerm|os.ModeDir)
_ = os.WriteFile(filepath.Join("logs", "serial.log"), serial, os.ModePerm)
fmt.Println(string(serial))
gatherLogs(vm)
}
Expect(vm.Destroy(nil)).ToNot(HaveOccurred())
})
Expand All @@ -41,10 +45,10 @@ var _ = Describe("k3s upgrade manual test", Label("upgrade-latest-with-cli"), fu
err := vm.Scp("assets/config.yaml", "/tmp/config.yaml", "0770")
Expect(err).ToNot(HaveOccurred())
By("Manually installing")
out, err := vm.Sudo("/bin/bash -c 'set -o pipefail && kairos-agent manual-install --device auto /tmp/config.yaml 2>&1 | tee manual-install.txt'")
Expect(err).ToNot(HaveOccurred(), out)
installOutput, err := vm.Sudo("kairos-agent --debug manual-install --device auto /tmp/config.yaml")
Expect(err).ToNot(HaveOccurred(), installOutput)

Expect(out).Should(ContainSubstring("Running after-install hook"))
Expect(installOutput).Should(ContainSubstring("Running after-install hook"))
vm.Sudo("sync")

err = vm.DetachCD()
Expand Down