SONiC on virtual machine

1,091 views
Skip to first unread message

Rajesh Dawadi

unread,
Dec 22, 2020, 10:07:23 AM12/22/20
to sonicproject
Hi, Apologies for a beginner question.

Is there any tutorial for running SONiC on virtual machine ?

Thanks,
Rajesh

Uy Nguyen

unread,
Dec 23, 2020, 8:52:20 PM12/23/20
to Rajesh Dawadi, sonicproject
Hi Rajesh,

2. Start it using qemu (x86-64)

Thanks,
Uy

--
You received this message because you are subscribed to the Google Groups "sonicproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonicproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonicproject/d09a3fcc-d8eb-4d69-9a40-5c65f300540en%40googlegroups.com.

Tom Ammon

unread,
Dec 23, 2020, 9:35:18 PM12/23/20
to Uy Nguyen, Rajesh Dawadi, sonicproject
Uy, thanks for the pointer, I've been looking for this myself as well. 

Rajesh, if you need more detailed help, let me know and I can help. I just spun up the image using libvirt and was able to use one of my regular kvm xml templates and booted the image after decompressing it. I was also able to find the default creds at https://github.com/Azure/SONiC/blob/master/doc/SONiC-User-Manual.md.

Tom



--
-----------------------------------------------------------------------------
Tom Ammon
M: (801) 784-2628
thoma...@gmail.com
-----------------------------------------------------------------------------

me Ielts

unread,
Dec 25, 2020, 12:09:26 PM12/25/20
to sonicproject
Thanks Uy, Tom. Tom, apologies , I am a beginner and was looking if there is any 'wiki' type of instruction manual on the steps. I have used qemu, kvm and am familiar with them but would prefer the initial steps. I am running a MAC laptop and was thinking if I could start a Ubuntu VM and then run the sonic image but not sure about the image I would need to use, given there are different images for different ASIC on the link: https://github.com/Azure/SONiC/blob/master/doc/SONiC-User-Manual.md#1-quick-start-guide. If you could point me some steps, I could even add a detailed wiki on the github link so future beginners would find it useful as well. :)
Thanks,
Rajesh

Uy Nguyen

unread,
Dec 27, 2020, 10:03:13 PM12/27/20
to me Ielts, sonicproject
Hi  Rajesh,

I don't use MacOS. I'm using Windows 10. Please find the attachment for the note for windows. 

Hope it helps. 

Thanks,
Uy

VM-Sonic-on-Windows.pdf

Keith Willowhawk

unread,
Dec 29, 2020, 1:47:54 AM12/29/20
to sonicproject
This was very helpful.  I was able to get the virtual SONiC switch running in both qemu and VirtualBox (after converting the img to a vdi) but I'm sure I'm missing something basic in the VirtualBox implementation (which seems to run faster on my platform...macos [don't judge]).  It appears the qemu implementation works with some serial redirection of some sort, and I'm obviously missing that on the simple VirtualBox VM (basic default Debian/64 VM with 2G ram and the converted VDI).  There isn't a virsh implementation on macOS that I've found yet, so using the XML provided isn't straightforward.   I suppose I could run it in a Linux VM but that's too many layers of inception for my taste.  Any pointers that might accelerate my tinkering?  The qemu implementation doesn't seem to have any interfaces once I am in SONiC and that sort of impedes my tinkering with interface commands...which is why I thought I'd swing it to VirtualBox since I don't have much direct experience with qemu as of yet.  (or VirtualBox for that matter, but at least there's a GUI there... sorry, vmware guy here trying to make the jump).

Thanks!

--Keith

balaji

unread,
Dec 31, 2020, 12:05:51 AM12/31/20
to sonicproject
Hi,

For the first time i am trying to compile SONiC image for VS.
till make configure PLATFORM=vs, it went fine,
but facing issue in "make all".

Thought about 100GB Space is available, observing "no space left on the device".
Here are the generated messages on console.

[ 01 ] [ target/docker-platform-monitor.gz ]

4e06a56ce5ffc32dc69cdd8435ecea6bf1132152f6c9742e9e5a56270e27ed68

./update_screen.sh: line 49: echo: write error: No space left on device

awk: (FILENAME=dockers/docker-router-advertiser/Dockerfile FNR=34) warning: error writing standard output (No space left on device)

scripts/prepare_docker_buildinfo.sh: line 38: echo: write error: No space left on device

[ FAIL LOG START ] [ target/docker-router-advertiser.gz ]

[ REASON ] :      target/docker-router-advertiser.gz does not exist   NON-EXISTENT PREREQUISITES: docker-start target/docker-config-engine-buster.gz-load

[ FLAGS  FILE    ] : []

[ FLAGS  DEPENDS ] : []

[ FLAGS  DIFF    ] : []

Containers: 0

 Running: 0

 Paused: 0

 Stopped: 0

Images: 330

Server Version: 18.09.5

Storage Driver: vfs

Logging Driver: json-file

Cgroup Driver: cgroupfs

Plugins:

 Volume: local

 Network: bridge host ipvlan macvlan null overlay

 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b

runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff

init version: de40ad0 (expected: fec3683)

Security Options:

 seccomp

  Profile: default

Kernel Version: 4.4.0-21-generic

Operating System: Debian GNU/Linux 10 (buster) (containerized)

OSType: linux

Architecture: x86_64

CPUs: 6

Total Memory: 7.686GiB

Name: 623afedc56ec

ID: 6CB5:GI36:WICY:YNDU:CEYW:O6O2:KB4B:64CF:I5R3:NVGF:W3TN:KHWE

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Registry: https://index.docker.io/v1/

Labels:

Experimental: true

Insecure Registries:

 127.0.0.0/8

Live Restore Enabled: false

Product License: Community Engine

 

WARNING: No swap limit support

WARNING: bridge-nf-call-iptables is disabled

WARNING: bridge-nf-call-ip6tables is disabled

Sending build context to Docker daemon  289.2MB

Error response from daemon: the Dockerfile (Dockerfile) cannot be empty

[  FAIL LOG END  ] [ target/docker-router-advertiser.gz ]

make: *** [slave.mk:714: target/docker-router-advertiser.gz] Error 1

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

Makefile.work:263: recipe for target 'all' failed

make[1]: *** [all] Error 2

make[1]: Leaving directory '/home/balaji/SONiC/sonic-buildimage'

Makefile:7: recipe for target 'all' failed

make: *** [all] Error 2

balaji@sfstypc01:~/SONiC/sonic-buildimage$

balaji@sfstypc01:~/SONiC/sonic-buildimage$

 

/dev/sda7       375G  106G  251G  30% /home

/dev/sda5       228G  112G  105G  52% /

Regards,
Balaji

Uy Nguyen

unread,
Jan 3, 2021, 8:32:17 PM1/3/21
to balaji, sonicproject

You don't need to 'make all'. Write a python script to fetch prebuilt modules. And just rebuild your module. 
Please refer to this guide: 

image.png

Thanks,
Uy

Reply all
Reply to author
Forward
0 new messages