Skip to content
Open
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
24 changes: 24 additions & 0 deletions pkg/machine/e2e/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,30 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0))
Expect(sshSession.outputToString()).To(ContainSubstring("yes"))

/* Validate that subid count is sufficiently large.
* The subid and subgid files contain a line for each user with subid start and count,
* separated by a double colon, for example: 'user:100000:65536'. Only the count is of
* interest here, it should be sufficiently large to accommodate nested namespaces which is
* required to run rootless Podman in Podman. The check assumes there is only 1 user.
*/
count_min := 1000000
for _, file := range []string{"/etc/subuid", "/etc/subgid"} {
cmd := fmt.Sprintf(`awk -F: 'NR==1 {print $NF}' %s`, file)
sshSession, err := mb.setName(mb.name).setCmd(ssh.withSSHCommand([]string{cmd})).run()
Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0))

subid_count_str := sshSession.outputToString()
Expect(subid_count_str).ToNot(BeEmpty(), "No subid count found in %s", file)

subid_count, err := strconv.Atoi(subid_count_str)
Expect(err).ToNot(HaveOccurred())
Expect(subid_count).To(BeNumerically(">=", count_min),
"Expected subid count %d to be >= %d in %s",
subid_count, count_min, file,
)
}
})

It("machine init with cpus, disk size, memory, timezone", func() {
Expand Down
2 changes: 2 additions & 0 deletions pkg/machine/wsl/declares.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ ln -fs /dev/null /etc/systemd/system/systemd-oomd.socket
mkdir -p /etc/systemd/system/systemd-sysusers.service.d/
echo CREATE_MAIL_SPOOL=no >> /etc/default/useradd
adduser -m [USER] -G wheel
sed -ir 's/65536/1000000/' /etc/subuid
sed -ir 's/65536/1000000/' /etc/subgid
mkdir -p /home/[USER]/.config/systemd/[USER]/
chown [USER]:[USER] /home/[USER]/.config
`
Expand Down