Skip to content

Commit b2c8087

Browse files
committed
Add auto-login getty services and empty root password
Add getty@.service and serial-getty@.service files to enable root auto-login on tty1 and ttyS0 terminals. Configure systems to use empty root passwords by default across azl3, emt3, and elxr12 platforms. Modified imageos.go to handle empty password cases by deleting passwords when none is set. The changes allow for iso initrd automatically log in and start installer scripts. Signed-off-by: Yu, Fei <fei.yu@intel.com>
1 parent 44e6bf9 commit b2c8087

11 files changed

Lines changed: 76 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to tty1 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/getty@tty1.service
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to ttyS0 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/serial-getty@ttyS0.service

config/osv/azure-linux/azl3/imageconfigs/defaultconfigs/default-initrd-x86_64.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ systemConfig:
8888
additionalFiles:
8989
- local: ../additionalfiles/99-dhcp-en.network
9090
final: /etc/systemd/network/99-dhcp-en.network
91+
- local: ../additionalfiles/getty@.service
92+
final: /usr/lib/systemd/system/getty@.service
93+
- local: ../additionalfiles/serial-getty@.service
94+
final: /usr/lib/systemd/system/serial-getty@.service
95+
96+
users:
97+
- name: root
98+
passwordMaxAge: 99999
99+
password: ""
91100

92101
kernel:
93102
name: kernel
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to tty1 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/getty@tty1.service
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to ttyS0 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/serial-getty@ttyS0.service

config/osv/edge-microvisor-toolkit/emt3/imageconfigs/defaultconfigs/default-initrd-x86_64.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ systemConfig:
8888
additionalFiles:
8989
- local: ../additionalfiles/99-dhcp-en.network
9090
final: /etc/systemd/network/99-dhcp-en.network
91+
- local: ../additionalfiles/getty@.service
92+
final: /usr/lib/systemd/system/getty@.service
93+
- local: ../additionalfiles/serial-getty@.service
94+
final: /usr/lib/systemd/system/serial-getty@.service
95+
96+
users:
97+
- name: root
98+
passwordMaxAge: 99999
99+
password: ""
91100

92101
kernel:
93102
name: kernel
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to tty1 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/getty@tty1.service
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Service]
2+
ExecStart=
3+
ExecStart=-/sbin/agetty --noclear --autologin root --keep-baud %I $TERM
4+
5+
# Default to ttyS0 but allow other choices
6+
[Install]
7+
Alias=getty.target.wants/serial-getty@ttyS0.service

config/osv/wind-river-elxr/elxr12/imageconfigs/defaultconfigs/default-initrd-x86_64.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ systemConfig:
4444
final: /etc/systemd/network/dhcp.network
4545
- local: ../additionalfiles/elxr-aria.list
4646
final: /etc/apt/sources.list.d/elxr-aria.list
47+
- local: ../additionalfiles/getty@.service
48+
final: /usr/lib/systemd/system/getty@.service
49+
- local: ../additionalfiles/serial-getty@.service
50+
final: /usr/lib/systemd/system/serial-getty@.service
51+
52+
users:
53+
- name: root
54+
passwordMaxAge: 99999
55+
password: ""
4756

4857
kernel:
4958
name: kernel

internal/chroot/chrootenv.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ func (chrootEnv *ChrootEnv) CleanupChrootEnv(targetOs, targetDist, targetArch st
444444
if _, err := shell.ExecCmd("rm -f "+chrootRepoCongfigPath+"/*", true, shell.HostPath, nil); err != nil {
445445
return fmt.Errorf("failed to remove existing local repo config files: %w", err)
446446
}
447-
repoConfigBackupPath := filepath.Join(chrootEnv.ChrootEnvRoot, "repo-config-backup")
448447
if err := file.CopyDir(repoConfigBackupPath, chrootRepoCongfigPath, "-f", true); err != nil {
449448
return fmt.Errorf("failed to backup existing repo config files: %w", err)
450449
}

0 commit comments

Comments
 (0)