Debian qemu-system-sparc64

Motivation

Required packages

The minimum packages required are

apt-get install qemu-system-sparc openbios-sparc qemu-utils qemu-system-common

If you plan on using libvirt to help manage VMs

apt-get install libvirt-daemon libvirt-daemon-system

And adding virt-manager if you like GUIs

apt-get install virt-manager

Setup using {cowbuilder-dist,cowbuilder,pbuilder} create

Set the MIRRORSITE environment variable to http://ftp.ports.debian.org/debian-ports/ and pass --debootstrapopts --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg

Example:

MIRRORSITE=http://ftp.ports.debian.org/debian-ports/ cowbuilder-dist sid sparc64  \
    create --debootstrapopts --keyring=/usr/share/keyrings/debian-ports-archive-keyring.gpg

But this is currently broken due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854889

Using qemu-system-sparc64 command line

hard drive and d-i image

Once you have a virtual disk created, e.g.

qemu-img create -f qcow2 -o size=8G /path/to/vm/images/default/debian-unstable-sparc64.qcow2

As of 2016-06-28 you will need a d-i iso from

https://people.debian.org/~glaubitz/debian-cd/

Short form

Short form of qemu-system-sparc64, limited networking

qemu-system-sparc64 -hda /path/to/vm/images/default/debian-unstable-sparc64.qcow2 -cdrom /path/to/vm/images/default/iso/debian-9.0-sparc64-NETINST-1.iso -boot once=d -serial pty -nographic -m 160

Access the VM via

minicom -p /dev/pty/X

Longer form

Longer form of qemu-system-sparc64, shows a little more of the defined system features

LC_ALL=C QEMU_AUDIO_DRV=none \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
/usr/bin/qemu-system-sparc64 -name debian-unstable-sparc64 -machine sun4u,accel=tcg,usb=off -m 1024 \
-realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 \
-uuid ccd8b5c2-b8e4-4d5e-af19-9322cd8e55bf -rtc base=utc -no-reboot -no-shutdown \
-boot strict=on \
-drive file=/path/to/vm/images/default/debian-unstable-sparc64.qcow2,if=none,id=drive-ide0-0-1,format=qcow2,cache=none,aio=native \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \
-netdev user,id=hostnet0,hostfwd=tcp::5555-:22 \
-device e1000,netdev=hostnet0,id=net0,mac=52:54:00:ce:98:e8 \
-msg timestamp=on -serial pty -nographic

Connect to the VM's serial via PTY e.g. from minicom

minicom -p /dev/pty/X

This still uses user-mode networking with forwarding on localhost:5555 to VMs port 22 for ssh access.

VM setup using virsh and xml

If you plan to use libvirt to manage your VMs use virsh to import your xml Populate the default libvirt system session, or your can just populate a libvirt's user-session by omitting the URI

virsh -c qemu:///system define debian-unstable-sparc64.xml

This is an example XML, using libvirt 'default' network and virtio nic

<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
  virsh edit debian-unstable-sparc64
or other application using the libvirt API.
-->

<domain type='qemu'>
  <name>debian-unstable-sparc64</name>
  <uuid>ccd8b5c2-b8e4-4d5e-af19-9322cd8e55bf</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='sparc64' machine='sun4u'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-sparc64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='native'/>
      <source file='/path/to/vm/images/default/debian-unstable-sparc64.qcow2'/>
      <target dev='hda' bus='ide'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'/>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='network'>
      <mac address='52:54:00:ce:98:e8'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <video>
      <model type='vga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </video>
    <memballoon model='none'/>
  </devices>
</domain>

http://libvirt.org/formatdomain.html is a useful resource for libvirt config

https://wiki.debian.org/QEMU is a useful resource for QEMU

Running debian-installer

When connected to the serial console you can run through the d-i as normal

Notes

Create/edit /etc/modprobe.d/drm-blacklist.conf

# blacklist of DRM modules that do not load on qemu-system-sparc64 sun4u
blacklist drm
blacklist bochs-drm
blacklist ttm

Edit /etc/initramfs-tools/initramfs.conf

#MODULES=most
MODULES=dep

Example, add entry into /etc/silo.conf

image = /vmlinuz
        label = linux-emergency
        append = "initrd=/initrd.img root=/dev/sda1 systemd.unit=emergency.target"

If you need even less running try

image = /vmlinuz
        label = linux-light
        append = "initrd=/initrd.img init=/bin/sh"

Example boot log

dmesg output

[    0.000000] PROMLIB: Sun IEEE Boot Prom 'OBP 3.10.24 1999/01/01 01:01'
[    0.000000] PROMLIB: Root node compatible: sun4u
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.3.0-1-sparc64 (debian-kernel@lists.debian.org) (gcc version 4.9.3 (Debian 4.9.3-11) ) #1 Debian 4.3.3-7 (2016-01-19)
[    0.000000] bootconsole [earlyprom0] enabled
[    0.000000] ARCH: SUN4U
[    0.000000] Ethernet address: 00:00:00:00:00:00
[    0.000000] MM: PAGE_OFFSET is 0xfffff80000000000 (max_phys_bits == 40)
[    0.000000] MM: VMALLOC [0x0000000100000000 --> 0x0000060000000000]
[    0.000000] MM: VMEMMAP [0x0000060000000000 --> 0x00000c0000000000]
[    0.000000] Kernel: Using 3 locked TLB entries for main kernel image.
[    0.000000] Remapping the kernel... done.
[    0.000000] OF stdout device is: /pci@1fe,0/ebus@2/su
[    0.000000] PROM: Built device tree with 56667 bytes of memory.
[    0.000000] Top of RAM: 0x3fe80000, Total RAM: 0x3fe80000
[    0.000000] Memory hole size: 0MB
[    0.000000] Allocated 16384 bytes for kernel page tables.
[    0.000000] Zone ranges:
[    0.000000]   DMA      empty
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000003fe7ffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000003fe7ffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000003fe7ffff]
[    0.000000] On node 0 totalpages: 130880
[    0.000000]   Normal zone: 1151 pages used for memmap
[    0.000000]   Normal zone: 130880 pages, LIFO batch:15
[    0.000000] Booting Linux...
[    0.000000] CPU CAPS: [flush,stbar,swap,muldiv,v9,mul32,div32,v8plus]
[    0.000000] CPU CAPS: [vis]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 129729
[    0.000000] Kernel command line: root=/dev/sda1
[    0.000000] PID hash table entries: 4096 (order: 2, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 1048576 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 524288 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 1016536K/1047040K available (5104K kernel code, 689K rwdata, 1408K rodata, 392K init, 579K bss, 30504K reserved, 0K cma-reserved)
[    0.000000] NR_IRQS:2048 nr_irqs:2048 1
[   14.441329] clocksource: tick: mask: 0xffffffffffffffff max_cycles: 0x171024e7e0, max_idle_ns: 440795205315 ns
[   14.442609] clocksource: mult[a000000] shift[24]
[   14.443701] clockevent: mult[1999999a] shift[32]
[   14.452849] Console: colour dummy device 80x25
[   14.454260] console [tty0] enabled
[   14.456437] bootconsole [earlyprom0] disabled
[   14.537811] Calibrating delay using timer specific routine.. 204.90 BogoMIPS (lpj=409800)
[   14.538135] pid_max: default: 32768 minimum: 301
[   14.539122] Security Framework initialized
[   14.539291] Yama: disabled by default; enable with sysctl kernel.yama.*
[   14.540428] AppArmor: AppArmor disabled by boot time parameter
[   14.540998] Mount-cache hash table entries: 2048 (order: 1, 16384 bytes)
[   14.541078] Mountpoint-cache hash table entries: 2048 (order: 1, 16384 bytes)
[   14.551510] Initializing cgroup subsys io
[   14.551814] Initializing cgroup subsys memory
[   14.552078] Initializing cgroup subsys devices
[   14.552181] Initializing cgroup subsys freezer
[   14.552304] Initializing cgroup subsys net_cls
[   14.552426] Initializing cgroup subsys perf_event
[   14.552539] Initializing cgroup subsys net_prio
[   14.553327] ftrace: allocating 17417 entries in 35 pages
[   14.642321] devtmpfs: initialized
[   14.652371] Performance events: No support for PMU type 'ultra12'
[   14.655210] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[   14.663129] NET: Registered protocol family 16
[   14.686384] /pci@1f,0: PCI IO[1fe02000000] MEM[1ff00100000]
[   14.686609] /pci@1f,0: Unable to request IOMMU resource.
[   14.686815] /pci@1f,0: SABRE PCI Bus Module ver[0:0]
[   14.687008] PCI: Scanning PBM /pci@1f,0
[   14.688449] sabre ffe2b738: PCI host bridge to bus 0000:00
[   14.688793] pci_bus 0000:00: root bus resource [io  0x1fe02000000-0x1fe0200ffff] (bus address [0x0000-0xffff])
[   14.688904] pci_bus 0000:00: root bus resource [mem 0x1ff00100000-0x1ff100fffff] (bus address [0x00000000-0x0fffffff])
[   14.689176] pci_bus 0000:00: root bus resource [bus 00-02]
[   14.698203] pci 0000:00:01.0: can't claim BAR 13 [io  0x1000000-0x1fffff]: no compatible bridge window
[   14.698357] pci 0000:00:01.1: can't claim BAR 13 [io  0x1000000-0x1fffff]: no compatible bridge window
[   14.721983] vgaarb: setting as boot device: PCI:0000:00:07.0
[   14.722156] vgaarb: device added: PCI:0000:00:07.0,decodes=io+mem,owns=io+mem,locks=none
[   14.722274] vgaarb: loaded
[   14.722365] vgaarb: bridge control possible 0000:00:07.0
[   14.731820] /pci@1f,0/ebus@2/eeprom@14,2000: Mostek regs at 0x1fe02006000
[   14.734424] clocksource: Switched to clocksource tick
[   14.860947] NET: Registered protocol family 2
[   14.873407] TCP established hash table entries: 8192 (order: 3, 65536 bytes)
[   14.873690] TCP bind hash table entries: 8192 (order: 3, 65536 bytes)
[   14.873946] TCP: Hash tables configured (established 8192 bind 8192)
[   14.875585] UDP hash table entries: 512 (order: 1, 16384 bytes)
[   14.875757] UDP-Lite hash table entries: 512 (order: 1, 16384 bytes)
[   14.877830] NET: Registered protocol family 1
[   14.879510] PCI: CLS 0 bytes, default 64
[   14.885084] Unpacking initramfs...
[   15.375667] Freeing initrd memory: 4032K (fffff80004400000 - fffff800047f0000)
[   15.380665] futex hash table entries: 256 (order: -1, 6144 bytes)
[   15.381387] audit: initializing netlink subsys (disabled)
[   15.382622] audit: type=2000 audit(0.916:1): initialized
[   15.386787] HugeTLB registered 8 MB page size, pre-allocated 0 pages
[   15.387231] zbud: loaded
[   15.389651] VFS: Disk quotas dquot_6.6.0
[   15.389866] VFS: Dquot-cache hash table entries: 1024 (order 0, 8192 bytes)
[   15.414840] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[   15.415849] io scheduler noop registered
[   15.416038] io scheduler deadline registered
[   15.416448] io scheduler cfq registered (default)
[   15.422552] ffe2dcf8: ttyS0 at MMIO 0x1fe020043f8 (irq = 5, base_baud = 115387) is a 16550A
[   15.422802] Console: ttyS0 (SU)
[   15.458048] console [ttyS0] enabled
[   15.465288] mousedev: PS/2 mouse device common for all mice
[   15.474034] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
[   15.475557] ledtrig-cpu: registered to indicate activity on CPUs
[   15.478121] NET: Registered protocol family 10
[   15.495845] mip6: Mobile IPv6
[   15.496386] NET: Registered protocol family 17
[   15.497145] mpls_gso: MPLS GSO support
[   15.500469] registered taskstats version 1
[   15.501795] zswap: loaded using pool lzo/zbud
[   15.507445] rtc-m48t59 rtc-m48t59.0: setting system clock to 2016-01-25 11:32:17 UTC (1453721537)
[   15.508459] PM: Hibernation image not present or could not be loaded.
[   16.420473] random: systemd-udevd urandom read with 1 bits of entropy available
[   18.400667] SCSI subsystem initialized
[   18.409319] virtio-pci 0000:00:09.0: virtio_pci: leaving for legacy driver
[   18.504876] libata version 3.00 loaded.
[   18.572158] scsi host0: pata_cmd64x
[   18.583006] scsi host1: pata_cmd64x
[   18.584451] ata1: PATA max UDMA/33 cmd 0x1fe02008000 ctl 0x1fe02008080 bmdma 0x1fe02008200 irq 6
[   18.585056] ata2: PATA max UDMA/33 cmd 0x1fe02008100 ctl 0x1fe02008180 bmdma 0x1fe02008208 irq 6
[   18.588599] pata_cmd64x: active 10 recovery 10 setup 3.
[   18.588737] pata_cmd64x: active 10 recovery 10 setup 3.
[   18.746135] ata1.01: NODEV after polling detection
[   18.752588] ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
[   18.753400] ata1.00: 16777216 sectors, multi 16: LBA48 
[   18.755852] pata_cmd64x: active 3 recovery 1 setup 1.
[   18.776672] ata1.00: configured for UDMA/33
[   18.808156] scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
[   18.825819] pata_cmd64x: active 10 recovery 10 setup 3.
[   18.825875] pata_cmd64x: active 10 recovery 10 setup 3.
[   18.979325] ata2.01: NODEV after polling detection
[   18.980201] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[   18.981112] pata_cmd64x: active 4 recovery 2 setup 1.
[   18.981774] ata2.00: configured for UDMA/33
[   18.990976] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[   19.849873] sd 0:0:0:0: [sda] 16777216 512-byte logical blocks: (8.58 GB/8.00 GiB)
[   19.856064] sd 0:0:0:0: [sda] Write Protect is off
[   19.856479] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   19.858231] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   19.920384]  sda: sda1 sda2 sda3
[   19.964632] sd 0:0:0:0: [sda] Attached SCSI disk
[   21.313276] PM: Starting manual resume from disk
[   21.313812] PM: Hibernation image partition 8:2 present
[   21.313858] PM: Looking for hibernation image.
[   21.315901] PM: Image not found (code -22)
[   21.315965] PM: Hibernation image not present or could not be loaded.
[   22.684198] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   23.834252] systemd[1]: systemd 228 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN)
[   23.839821] systemd[1]: Detected architecture sparc64.
[   23.849255] systemd[1]: Set hostname to <debian-sparc64>.
[   24.591738] random: nonblocking pool is initialized
[   26.045398] systemd[1]: Reached target Remote File Systems (Pre).
[   26.056512] systemd[1]: Listening on udev Kernel Socket.
[   26.062555] systemd[1]: Listening on fsck to fsckd communication Socket.
[   26.067919] systemd[1]: Listening on Syslog Socket.
[   26.071848] systemd[1]: Reached target Remote File Systems.
[   26.079039] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[   26.092384] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[   26.099054] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[   26.103508] systemd[1]: Reached target Paths.
[   26.108908] systemd[1]: Listening on udev Control Socket.
[   26.122213] systemd[1]: Created slice System Slice.
[   26.130615] systemd[1]: Created slice system-getty.slice.
[   26.137825] systemd[1]: Created slice system-serial\x2dgetty.slice.
[   26.142834] systemd[1]: Reached target Encrypted Volumes.
[   26.149087] systemd[1]: Listening on Journal Socket (/dev/log).
[   26.160896] systemd[1]: Listening on Journal Audit Socket.
[   26.168256] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[   26.176485] systemd[1]: Created slice User and Session Slice.
[   26.186844] systemd[1]: Listening on Journal Socket.
[   26.222222] systemd[1]: Starting Journal Service...
[   26.295631] systemd[1]: Mounting Debug File System...
[   26.374674] systemd[1]: Mounting POSIX Message Queue File System...
[   26.472693] systemd[1]: Starting LSB: Set console font and keymap...
[   26.676475] systemd[1]: Starting Load Kernel Modules...
[   26.833608] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[   27.028166] systemd[1]: Mounting Huge Pages File System...
[   27.069320] systemd[1]: Reached target Slices.
[   27.944643] systemd[1]: Mounted POSIX Message Queue File System.
[   27.985449] systemd[1]: Mounted Debug File System.
[   28.181208] systemd[1]: Started Load Kernel Modules.
[   28.334848] systemd[1]: Started Create list of required static device nodes for the current kernel.
[   28.489141] systemd[1]: Mounted Huge Pages File System.
[   29.145314] systemd[1]: Started Journal Service.
[   45.166262] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[   47.164225] systemd-journald[144]: Received request to flush runtime journal from PID 1
[   57.867820] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   57.907383] scsi 1:0:0:0: Attached scsi generic sg1 type 5
[   57.945788] usbcore: registered new interface driver usbfs
[   57.998934] usbcore: registered new interface driver hub
[   58.003958] usbcore: registered new device driver usb
[   58.137751] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   58.168460] sr 1:0:0:0: [sr0] out of memory.
[   57.998934] usbcore: registered new interface driver hub
[   58.003958] usbcore: registered new device driver usb
[   58.137751] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   58.168460] sr 1:0:0:0: [sr0] out of memory.
[   58.169049] cdrom: Uniform CD-ROM driver Revision: 3.20
[   58.204942] sr 1:0:0:0: Attached scsi CD-ROM sr0
[   58.231445] uhci_hcd: USB Universal Host Controller Interface driver
[   58.276108] uhci_hcd 0000:00:06.0: UHCI Host Controller
[   58.276847] uhci_hcd 0000:00:06.0: new USB bus registered, assigned bus number 1
[   58.277688] uhci_hcd 0000:00:06.0: detected 2 ports
[   58.306741] uhci_hcd 0000:00:06.0: irq 7, io base 0x1fe02008280
[   58.339357] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[   58.339859] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   58.340351] usb usb1: Product: UHCI Host Controller
[   58.340657] usb usb1: Manufacturer: Linux 4.3.0-1-sparc64 uhci_hcd
[   58.341025] usb usb1: SerialNumber: 0000:00:06.0
[   58.379692] hub 1-0:1.0: USB hub found
[   58.394779] hub 1-0:1.0: 2 ports detected
[   61.369571] virtio_net virtio0 enp0s9: renamed from eth0
[   62.539174] Adding 393584k swap on /dev/sda2.  Priority:-1 extents:1 across:393584k FS


CategoryPorts