Skip to content
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
8 changes: 6 additions & 2 deletions docs/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ kernel:
QEMU:
- `qemu.pid`: QEMU PID
- `qmp.sock`: QMP socket
- `serial.log`: QEMU serial log, for debugging
- `serial.sock`: QEMU serial socket, for debugging (Usage: `socat -,echo=0,icanon=0 unix-connect:serial.sock`)

VZ:
- `vz.pid`: VZ PID
- `vz-identifier`: Unique machine identifier file for a VM
- `vz-efi`: EFIVariable store file for a VM

Serial:
- `serial.log`: legacy serial log (QEMU only), for debugging
- `serial.sock`: legacy serial socket (QEMU only), for debugging (Usage: `socat -,echo=0,icanon=0 unix-connect:serial.sock`)
- `serialv.log`: virtio serial log, for debugging
- `serialv.sock`: virtio serial socket (QEMU only), for debugging (Usage: `socat -,echo=0,icanon=0 unix-connect:serialv.sock`)

SSH:
- `ssh.sock`: SSH control master socket
- `ssh.config`: SSH config file for `ssh -F`. Not consumed by Lima itself.
Expand Down
16 changes: 15 additions & 1 deletion pkg/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ func Cmdline(cfg Config) (string, []string, error) {
// Parallel
args = append(args, "-parallel", "none")

// Serial
// Serial (legacy)
serialSock := filepath.Join(cfg.InstanceDir, filenames.SerialSock)
if err := os.RemoveAll(serialSock); err != nil {
return "", nil, err
Expand All @@ -818,6 +818,20 @@ func Cmdline(cfg Config) (string, []string, error) {
args = append(args, "-chardev", fmt.Sprintf("socket,id=%s,path=%s,server=on,wait=off,logfile=%s", serialChardev, serialSock, serialLog))
args = append(args, "-serial", "chardev:"+serialChardev)

// Serial (virtio)
serialvSock := filepath.Join(cfg.InstanceDir, filenames.SerialVirtioSock)
if err := os.RemoveAll(serialvSock); err != nil {
return "", nil, err
}
serialvLog := filepath.Join(cfg.InstanceDir, filenames.SerialVirtioLog)
if err := os.RemoveAll(serialvLog); err != nil {
return "", nil, err
}
const serialvChardev = "char-serial-virtio"
args = append(args, "-chardev", fmt.Sprintf("socket,id=%s,path=%s,server=on,wait=off,logfile=%s", serialvChardev, serialvSock, serialvLog))
args = append(args, "-device", "virtio-serial-pci,id=virtio-serial0")
args = append(args, "-device", fmt.Sprintf("virtconsole,chardev=%s,id=console0", serialvChardev))

// We also want to enable vsock here, but QEMU does not support vsock for macOS hosts

if *y.MountType == limayaml.NINEP || *y.MountType == limayaml.VIRTIOFS {
Expand Down
2 changes: 1 addition & 1 deletion pkg/qemu/qemu_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (l *LimaQemuDriver) Start(ctx context.Context) (chan error, error) {
}()
}

logrus.Infof("Starting QEMU (hint: to watch the boot progress, see %q)", filepath.Join(qCfg.InstanceDir, filenames.SerialLog))
logrus.Infof("Starting QEMU (hint: to watch the boot progress, see %q)", filepath.Join(qCfg.InstanceDir, "serial*.log"))
logrus.Debugf("qCmd.Args: %v", qCmd.Args)
if err := qCmd.Start(); err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion pkg/store/filenames/filenames.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ const (
KernelCmdline = "kernel.cmdline"
Initrd = "initrd"
QMPSock = "qmp.sock"
SerialLog = "serial.log"
SerialLog = "serial.log" // legacy
SerialSock = "serial.sock"
SerialVirtioLog = "serialv.log" // virtio serial
SerialVirtioSock = "serialv.sock"
SSHSock = "ssh.sock"
SSHConfig = "ssh.config"
VhostSock = "virtiofsd-%d.sock"
Expand Down
2 changes: 1 addition & 1 deletion pkg/vz/vm_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func attachPlatformConfig(driver *driver.BaseDriver, vmConfig *vz.VirtualMachine
}

func attachSerialPort(driver *driver.BaseDriver, config *vz.VirtualMachineConfiguration) error {
path := filepath.Join(driver.Instance.Dir, filenames.SerialLog)
path := filepath.Join(driver.Instance.Dir, filenames.SerialVirtioLog)
serialPortAttachment, err := vz.NewFileSerialPortAttachment(path, false)
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions pkg/vz/vz_driver_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/Code-Hex/vz/v3"

"github.com/lima-vm/lima/pkg/store/filenames"
"github.com/sirupsen/logrus"

"github.com/lima-vm/lima/pkg/driver"
Expand Down Expand Up @@ -132,7 +131,7 @@ func (l *LimaVzDriver) CreateDisk() error {
}

func (l *LimaVzDriver) Start(ctx context.Context) (chan error, error) {
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %q)", filepath.Join(l.Instance.Dir, filenames.SerialLog))
logrus.Infof("Starting VZ (hint: to watch the boot progress, see %q)", filepath.Join(l.Instance.Dir, "serial*.log"))
vm, errCh, err := startVM(ctx, l.BaseDriver)
if err != nil {
if errors.Is(err, vz.ErrUnsupportedOSVersion) {
Expand Down