User avatar
Botspot
Posts: 169
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Sun Sep 15, 2019 1:02 pm

I have designed a script to run a graphical Raspbian virtual machine, within Raspbian.

Update: I have released a bootable image here. This is much easier than installing Vdesktop, the dependencies, and downloading a Raspbian image. Simply flash it to an SD card, then when Raspbian Buster has booted, you can easily run Stretch from the menu:
2019-09-29-133712_1280x1024_scrot.png
2019-09-29-133712_1280x1024_scrot.png (148.93 KiB) Viewed 148 times
GitHub page here.
Report bugs here.

Image

This script is excellent in these situations:
  • Migrating to a clean install of Raspbian and want to copy files from the old one.
  • Running two versions of software at the same time, one in the host, other in the guest.
  • Running something potentially dangerous (such as compiling) but don't want your main OS modified.
  • "Switch" OSes without ever shutting down or swapping SD cards.
  • Run Raspbian Stretch on a Pi 4.
To download:

Code: Select all

cd
git clone https://github.com/Botspot/vdesktop
chmod +x /home/pi/vdesktop/rc.local /home/pi/vdesktop/vdesktop
To download and run a fresh Stretch image

Code: Select all

cd
git clone https://github.com/Botspot/vdesktop
chmod +x /home/pi/vdesktop/rc.local /home/pi/vdesktop/vdesktop
wget http://downloads.raspberrypi.org/raspbian_full/images/raspbian_full-2019-04-09/2019-04-08-raspbian-stretch-full.zip
unzip /home/pi/2019-04-08-raspbian-stretch-full.zip
sudo /home/pi/vdesktop/vdesktop /home/pi/2019-04-08-raspbian-stretch-full.img
Command usage:
Boot from an image file:

Code: Select all

sudo /home/pi/vdesktop/vdesktop /home/pi/2019-04-08-raspbian-stretch-full.img
Or a block device:

Code: Select all

sudo /home/pi/vdesktop/vdesktop /dev/sda
Or the root directory of the guest:

Code: Select all

sudo /home/pi/vdesktop/vdesktop /home/pi/raspbian-stretch/
Once the guest has booted, you have to log in with the guest's credentials. Then the guest's GUI will appear in a Xephyr window.

To do:
  • Write up a more comprehensive set of instructions, and add come CLI flags.
  • autologin to the guest, so the user doesn't have to do it manually.
  • auto-detect default desktop session profile to correctly boot pi-top OS and Raspbian that doesn't have raspberrypi-ui-mods installed.
  • Sync sound between host and guest, preferably avoiding pulseaudio.
  • display text at guest's default size instead of autoscaling to Xephyr's aspect ratio.
  • display guest's default mouse pointer instead of the fall-back Adwaita.
Last edited by Botspot on Sun Sep 29, 2019 6:40 pm, edited 6 times in total.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

hippy
Posts: 5941
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Powerful Tool to run a Stretch Container in Buster. Testers wanted, comments wanted.

Sun Sep 15, 2019 3:10 pm

Excelent stuff. On my 3B (non-plus) I managed to get Buster running under Buster okay -

Code: Select all

pi@Pi3B:~ $ sudo /home/pi/vdesktop/vdesktop /home/pi/2019-06-20-raspbian-buster.img 
OK, looks like you specified an .img file.
e2fsck 1.44.5 (15-Dec-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
... etc ...
But had problems trying to run other images which I have run before on a 3B ...

Code: Select all

pi@Pi3B:~ $ sudo /home/pi/vdesktop/vdesktop /home/pi/lineage-14.1-20180615-UNOFFICIAL-KonstaKANG-rpi3.img 
OK, looks like you specified an .img file.
/home/pi/vdesktop/vdesktop: line 134: 264192
2361344 * 512: syntax error in expression (error token is "2361344 * 512")
Unable to create loop device

Code: Select all

pi@Pi3B:~ $ sudo /home/pi/vdesktop/vdesktop /home/pi/chromiumos_image_r70.img 
OK, looks like you specified an .img file.
/home/pi/vdesktop/vdesktop: line 134: * 512: syntax error: operand expected (error token is "* 512")
Unable to create loop device
That may be as expected, not being Raspbian images and all, but it does seem to point to a "syntax error" in vdesktop.

User avatar
Botspot
Posts: 169
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Re: Powerful Tool to run a Stretch Container in Buster. Testers wanted, comments wanted.

Sun Sep 15, 2019 7:30 pm

hippy wrote:
Sun Sep 15, 2019 3:10 pm

Code: Select all

pi@Pi3B:~ $ sudo /home/pi/vdesktop/vdesktop /home/pi/chromiumos_image_r70.img 
OK, looks like you specified an .img file.
/home/pi/vdesktop/vdesktop: line 134: * 512: syntax error: operand expected (error token is "* 512")
Unable to create loop device
That may be as expected, not being Raspbian images and all, but it does seem to point to a "syntax error" in vdesktop.
Yes, vdesktop is only designed to boot Raspbian images at this time; the main reason for that being that the container is actually running the host's kernel. So images such as Chromium OS are not supported. Second reason is that the image mounting utility my script is using is only intended for Raspbian img files. So it has no clue what to do when faced with Chromium OS'es 15 partitions. Edit: So that's where the syntax error is coming from.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
Botspot
Posts: 169
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Re: Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Wed Sep 25, 2019 3:23 pm

Good morning, everyone.

Well my Pi 4 finally arrived, and after some extensive testing in several configurations, I am relieved to announce that using vdesktop, Raspbian Stretch runs at 100% native speed on a Pi 4.

The vdesktop script has been updated a bit and a couple bugs worked out (see the github page for more details), so if anyone out there has suggestion or bug report, please let me know!

Also, I am working on a bootable image with vdesktop installed and a Raspbian Stretch demo image downloaded. So if anyone has any experience on the proper way to create a clean bootable image, please let me know!
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12213
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Thu Sep 26, 2019 8:13 pm

Thread moved to general discussion, as requested by OP.

sunilvb
Posts: 5
Joined: Sun Feb 02, 2014 2:54 am

Re: Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Fri Sep 27, 2019 11:00 pm

Was able to install and run Stretch on RPi 4!!

Observations :
[FAILED] Failed to start Remout Root and Kernel File System
[FAILED] Failed to start rng-tools.service
[FAILED] Failed to start Avahi mDNS/DNS-SD stack
[FAILED] FAiled to start LSB: Resize the root filesystem to fill partition

In spite of the FAILED msg, I was able to login and start the guest os (Stretch on Buster). Although, the task bar icons are invisible.
The browser does not connect to internet.
Questions:
How do I ssh into the guest from host or external computer on the network?
What options are available to communicate from host to guest?
How do I copy file from host to guest and vice versa?

User avatar
Botspot
Posts: 169
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Re: Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Sat Sep 28, 2019 11:00 pm

sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
[FAILED] Failed to start Remout Root and Kernel File System
[FAILED] Failed to start rng-tools.service
[FAILED] Failed to start Avahi mDNS/DNS-SD stack
[FAILED] FAiled to start LSB: Resize the root filesystem to fill partition
That is completely normal, and in fact part of the beauty of systemd-nspawn:
systemd-nspawn limits access to various kernel interfaces in the container to read-only, such as /sys, /proc/sys or /sys/fs/selinux. The host's network interfaces and the system clock may not be changed from within the container. Device nodes may not be created. The host system cannot be rebooted and kernel modules may not be loaded from within the container.
sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
Although, the task bar icons are invisible.
Strange. It works for me every time. Well I lengthened the "grace period", it should work now.
sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
The browser does not connect to internet.
I noticed that too. Only seems to be a problem on the Pi 4, not earlier models. I'll have to research it.
sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
How do I ssh into the guest from host or external computer on the network?
Well from the host, that's easy. Just type commands into the same terminal you entered the guest's username and password.
From another computer on the local network, I have never tried this. But I think the guest would need internet connection, so once I get that working again it should work like it would on a normal Pi.
sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
What options are available to communicate from host to guest?
Currently the Xephyr window only "listens" to the keyboard and mouse. So far I have had no luck getting the guest to be able to communicate with a usb device connected to the host machine.
sunilvb wrote:
Fri Sep 27, 2019 11:00 pm
How do I copy file from host to guest and vice versa?
Very easy. I forgot to mention this. Vdesktop mounts all img files to /mnt/virtualdesktop by default. So just go in there and you can access everything.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
Botspot
Posts: 169
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas

Re: Vdesktop: Ultimate Raspbian Virtual Machine Script. Feedback wanted!!

Mon Sep 30, 2019 1:59 am

Update: bootable image released. Download it here, and see the first post for details.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

Return to “General discussion”