User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

[SOLVED] How do I run a Raspbian virtual desktop inside Raspbian?

Mon Apr 29, 2019 10:36 pm

Would it be possible to run Raspbian inside a window, on Raspbian OS, on a Raspberry Pi 3?

If so, how? I only found how to do emulate a Raspberry Pi on x86-based computers with QEMU.

Edit: tweaked title and description for improved clarification
Last edited by Botspot on Mon May 20, 2019 8:25 pm, edited 2 times in total.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

fruitoftheloom
Posts: 20477
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Can I have a Raspbian virtual machine on Raspbian?

Tue Apr 30, 2019 6:53 am

Botspot wrote:
Mon Apr 29, 2019 10:36 pm
Would it be possible to run Raspbian inside a QEMU window, on Raspbian OS, on a Raspberry Pi 3?

If so, how? I only found how to do it on x86-based computers.

You need to use Qemu as the Virtual Machine, but it has limitations:

Code: Select all

sudo apt update
sudo apt install qemu

Qemu version 2.8 from the repositories only emulates ARMHF 32bit:

https://blog.agchapman.com/using-qemu-t ... ry-pi/amp/



You will need a newer version of Qemu if you wish to emulate ARM64 64bit:

https://github.com/wimvanderbauwhede/li ... -3-on-QEMU
Retired disgracefully.....

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 1:48 am

Specifically what I want is several instances or Raspbian running in separate windows simultaneously.

Since I am not simulating a non-native CPU architecture, I would rather not use qemu. And even if I could get qemu to work, I expect it to be too slow to be usable.
Instead of simulating extremely low-level, would I be able to run Raspbian at a much higher-level, since I do not have to emulate a different processor, operating system, or much else?

Would it be possible to run Xorg in a window?
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
HawaiianPi
Posts: 4532
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 7:28 am

Botspot wrote:
Fri May 10, 2019 1:48 am
Specifically what I want is several instances or Raspbian running in separate windows simultaneously.
On a Raspberry Pi computer? And where is the RAM needed to do that going to come from?

Is it possible? Maybe. Is it possible to do it in any way that would be useful? Unlikely on a Pi with only 1GB of RAM (or less). How many instances are you asking about, and what do you want to do within them?
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 7:31 am

QEMU supports KVM acceleration. This way, you can run Raspbian or Windows 10 Pro (AARCH64) "inside" Gentoo.

For perfomance reasons, you should only try it on the Raspberry Model 3B+. Search for the posts of forum member "sakaki".

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
DougieLawson
Posts: 35798
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 7:51 am

Why on earth would you want that when you can have a second full-fat, fully functional Raspberry for £35?

Virtual machines have an enormous overhead.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 2:39 pm

HawaiianPi wrote:
Botspot wrote:
Fri May 10, 2019 1:48 am
Specifically what I want is several instances or Raspbian running in separate windows simultaneously.
Is it possible? Maybe. Is it possible to do it in any way that would be useful?
I think it would be useful and here's why:
I have several SD cards, each one with different software installed. They all are running Raspbian. I use each one for a different purpose.
Sometimes I want to do something which is possible on one of the other cards. I have to shutdown, eject, insert, boot up. After I do the task, I have to do all those steps again, which is very inconvenient.
My Pi is very out-of-reach, and I once broke a card while ejecting it, so I really dislike switching cards.
HawaiianPi wrote: And where is the RAM needed to do that going to come from?
Default Raspbian runs about 150 MB total with no programs running. If I only needed to run pcmanfm or something small, my Pi 3 should not have a problem. Now if I plan to do web browsing on several virtual desktops, that would be different.
ghans wrote: QEMU supports KVM acceleration. This way, you can run Raspbian or Windows 10 Pro (AARCH64) "inside" Gentoo.

For performance reasons, you should only try it on the Raspberry Model 3B+. Search for the posts of forum member "sakaki".

ghans
I would rather not use QEMU, mainly because it is meant to simulate non-native machines and CPU architectures. Since I do not wish to simulate a entirely different machine, I see no reason to use QEMU. And I followed fruitoftheloom's Stretch tutorial and QEMU does not even support Raspi3 emulation yet. The tutorial suggested emulating a different machine entirely, which made it too slow to be runnable on a Raspberry Pi.
DougieLawson wrote: Why on earth would you want that when you can have a second full-fat, fully functional Raspberry for £35?
I do have a second Pi, but I do not have a router to connect them for any sort of VNC thing. And migrating the HDMI, USB, and audio each time I want to switch would be much more tedious and risky than shutting down switching cards.
DougieLawson wrote: Virtual machines have an enormous overhead.
You're right. My Pi struggles when running Windows 98.
That's why I do not want a virtual machine. 

Since I only want to run a second instance of Raspbian inside of Raspbian on a Raspberry Pi, I do not feel the need to emulate a Raspberry Pi device when Raspberry Pi is already the native machine.
Since I am not emulating a machine, nor am I even trying to run a different operating system or kernel, would it be possible just to plug one of my extra cards into a USB adapter, into my Pi, mount the native Raspbian's /proc, /sys, and /dev, then simply chroot in as the user pi?
I tried. I could not get that to work completely. Pcmanfm opened , but chromium threw an error.
Here are the commands I used to chroot in. (these commands assume a Raspbian SD card is plugged into a USB port, and is mounted to /media/pi/rootfs and /media/pi/boot)

Code: Select all

sudo mount -t sysfs sys /media/pi/rootfs/sys/
sudo mount -t proc proc /media/pi/rootfs/proc/
sudo mount --bind /dev /media/pi/rootfs/dev/
sudo mount --bind /dev/pts /media/pi/rootfs/dev/pts/
sudo mount --bind /dev/shm /media/pi/rootfs/dev/shm
All mount commands proceeded with no errors.
Then I tried to chroot in.

Code: Select all

sudo chroot /media/pi/rootfs/ /bin/su -l pi
Command completed with no errors.
Then I ran Pcmanfm file manager.

Code: Select all

pcmanfm
Pcmanfm window popped up displaying the contents of /home/pi on the SD card.
One observation: pcmanfm is using a different GTK and icon theme than when I ran it directly from the Pi.
I closed pcmanfm, then tried to start Chromium.

Code: Select all

chromium-browser
No browser window popped up like pcmanfm did. Instead, it threw an error:
​​​​​​

Code: Select all

 --disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
The setuid sandbox is not running as root. Common causes:
  * An unprivileged process using ptrace on it, like a debugger.
  * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Trace/breakpoint trap
My best guess is Chromium is smart enough to notice Xorg is not running. :?
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
procount
Posts: 1698
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 2:54 pm

Botspot wrote:
Fri May 10, 2019 2:39 pm
I have several SD cards, each one with different software installed. They all are running Raspbian. I use each one for a different purpose.
Sometimes I want to do something which is possible on one of the other cards. I have to shutdown, eject, insert, boot up. After I do the task, I have to do all those steps again, which is very inconvenient.
My Pi is very out-of-reach, and I once broke a card while ejecting it, so I really dislike switching cards.
It sounds like the reason for asking to run multiple copies of Raspbian simultaneously is just to avoid physically swapping sd cards?
In which case, why not consider PINN? It allows multiple installations of Raspbian to be installed on the same sd card with a boot manager to select which one you want to use.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 3:16 pm

procount wrote:
Fri May 10, 2019 2:54 pm
It sounds like the reason for asking to run multiple copies of Raspbian simultaneously is just to avoid physically swapping sd cards?
In which case, why not consider PINN? It allows multiple installations of Raspbian to be installed on the same sd card with a boot manager to select which one you want to use.
Oh, sorry I forgot to mention how many cards I have.
I have 4 Sd cards, 2 USB drives, and a HDD. Will PINN allow for so many installations?
Sounds like PINN would allow for a dual-booting from the internal SD, but I would prefer simultaneous and temporary insertion.
I would want to insert a SD card into the USB adapter on my Pi, make the modifications I wanted to (move files, apt update, install something, test a program, etc.), then remove the SD card and insert it into another Pi.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
procount
Posts: 1698
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: Can I have a Raspbian virtual machine on Raspbian?

Fri May 10, 2019 3:35 pm

Oh. I thought you wanted to avoid swapping sd cards.....

Pinn will allow upto about 57 OSes if your device storage is large enough but mixing them between different devices would be a bit tricky. I guess you could install all of your OSes to a HDD which is used as a master, then transfer an OS to another sd card or usb device when it is modified/updated. It was just a thought.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Andyroo
Posts: 4180
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 5:01 pm

You could use pxe to boot along these lines https://www.raspberrypi.org/documentati ... utorial.md

Could you look to move all apps to one image booting from a USB HD? Simplest to manage updates and backups on.

It may be worth talking to your local Jam organiser. The one in Hull where using a laptop with the OS on it and downloading to the Pi with a new user and config. I’m sure that came from the Foundation.
Need Pi spray - these things are breeding in my house...

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 5:11 pm

Andyroo wrote:
Fri May 10, 2019 5:01 pm
You could use pxe to boot along these lines https://www.raspberrypi.org/documentati ... utorial.md
Why would I need to network boot?
Andyroo wrote: Could you look to move all apps to one image booting from a USB HD? Simplest to manage updates and backups on.
Not possible. For example, one of my SDs is a very old version of Raspbian on purpose: to run Sonic Pi, as newer versions keep crashing.
Andyroo wrote: It may be worth talking to your local Jam organiser. The one in Hull where using a laptop with the OS on it and downloading to the Pi with a new user and config. I’m sure that came from the Foundation.
I do not understand this last statement. What is a "local Jam organizer"?
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

Andyroo
Posts: 4180
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 5:15 pm

By setting up different images on a NAS you can then select the image to boot from.

Local meet-up with other Raspberry Pi users are normally called ‘Jams’ https://www.raspberrypi.org/jam/
Need Pi spray - these things are breeding in my house...

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 6:06 pm

Andyroo wrote:
Fri May 10, 2019 5:15 pm
Local meet-up with other Raspberry Pi users are normally called ‘Jams’ https://www.raspberrypi.org/jam/
No jams nearby me - I live in Texas.
Andyroo wrote: By setting up different images on a NAS you can then select the image to boot from.
I do see how that would be a non-physical way to switch operating systems, but then I would have two Pis to work with, and I would still have to shutdown the network-booted Pi whenever I wanted to switch.

Since I have only one screen, mouse and keyboard, I think the problem would actually be made worse. Whenever I want to switch operating systems on the network-booted pi, I would have to:
  • shutdown the network-booted pi
  • remove power from the network-booted pi
  • unplug all USB, HDMI, and audio cables from the network-booted pi
  • plug in all USB, HDMI, and audio cables into the network-host pi
  • wait for the pi to recognize the devices
  • move or rename the disk image files in order to boot another operating system
  • migrate all the USB, HDMI, and audio devices back to the network-booted pi
  • plug in the network-booted pi
    ​​​​​​​
  • wait for it to turn on
As mentioned before, my Raspberry Pi is somewhat out of reach, so switching the cards is difficult. But I would much rather switch only an SD card, than to constantly move USB, HDMI, and audio devices back and forth across two Pis.
And even if I VNC'ed in to the network-booted pi and did not have to plug and unplug anything, it would still not be exactly what I want. What if I wanted a third OS running simultaneously? What if the OS does not support VNC? What if VNC does not support a necessary functionality like audio, GPU overlay, or CLI?
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 7:30 pm

Botspot wrote:I would rather not use QEMU, mainly because it is meant to simulate non-native machines and CPU architectures. Since I do not wish to simulate a entirely different machine, I see no reason to use QEMU.
Please understand the difference between QEMUs TCG "accelerator" and QEMU with KVM acceleration. Better yet, just start Linux on your Laptop (with Intel VT or AMD-V, obviously), modpobe kvm, and then start QEMU with "accel=kvm".

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 8:16 pm

ghans wrote:
Fri May 10, 2019 7:30 pm
Botspot wrote:I would rather not use QEMU, mainly because it is meant to simulate non-native machines and CPU architectures. Since I do not wish to simulate a entirely different machine, I see no reason to use QEMU.
Please understand the difference between QEMUs TCG "accelerator" and QEMU with KVM acceleration. Better yet, just start Linux on your Laptop (with Intel VT or AMD-V, obviously), modpobe kvm, and then start QEMU with "accel=kvm".

ghans
Followed fruitoftheloom's suggestion to update qemu to the latest version and followed the general install directions on Qemu's website.
Then followed the instructions on https://github.com/wimvanderbauwhede/li ... -3-on-QEMU


full command I ran:

Code: Select all

qemu-system-arm    -kernel raspbian_bootpart/kernel-qemu-4.14.79-stretch    -dtb raspbian_bootpart/versatile-pb.dtb    -m 256 -M versatilepb -cpu arm1176    -serial stdio    -append "rw console=ttyAMA0 root=/dev/sda2 rootfstype=ext4  loglevel=8 rootwait fsck.repair=yes memtest=1"    -drive file=2019-04-08-raspbian-stretch.img,format=raw    -redir tcp:5022::22     -no-reboot
Did I do something wrong? Not only did it take over an hour to boot up, it gave many errors, failed to boot to desktop, and said it was in "emergency mode".
Error output:

Code: Select all

 qemu-system-arm    -kernel raspbian_bootpart/kernel-qemu-4.14.79-stretch    -dtb raspbian_bootpart/versatile-pb.dtb    -m 256 -M versatilepb -cpu arm1176    -serial stdio    -append "rw console=ttyAMA0 root=/dev/sda2 rootfstype=ext4  loglevel=8 rootwait fsck.repair=yes memtest=1"    -drive file=2019-04-08-raspbian-stretch.img,format=raw    -redir tcp:5022::22     -no-reboot
qemu-system-arm: -redir tcp:5022::22: The -redir option is deprecated. Please use '-netdev user,hostfwd=...' instead.
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
alsa: Audio parameters for DAC
alsa: parameter | requested value | obtained value
alsa: format    |               2 |              2
alsa: channels  |               2 |              2
alsa: frequency |           44100 |          48000
alsa: ============================================
alsa: requested: buffer size 4096 period size 1024
alsa: obtained: samples 4096
Uncompressing Linux... done, booting the kernel.
vpb_sic_write: Bad register offset 0x2c
Booting Linux on physical CPU 0x0
Linux version 4.14.79 ([email protected]) (gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)) #1 Sun Jan 27 22:47:58 UTC 2019
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: VIPT aliasing data cache, unknown instruction cache
OF: fdt: Machine model: ARM Versatile PB
Memory policy: Data cache writeback
On node 0 totalpages: 65536
free_area_init_node: node 0, pgdat c062db90, node_mem_map cfdb9000
  Normal zone: 576 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 65536 pages, LIFO batch:15
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0 
Built 1 zonelists, mobility grouping on.  Total pages: 64960
Kernel command line: rw console=ttyAMA0 root=/dev/sda2 rootfstype=ext4  loglevel=8 rootwait fsck.repair=yes memtest=1
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 253036K/262144K available (4670K kernel code, 217K rwdata, 1080K rodata, 188K init, 146K bss, 9108K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xd0800000 - 0xff800000   ( 752 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0497d08   (4672 kB)
      .init : 0xc05c9000 - 0xc05f8000   ( 188 kB)
      .data : 0xc05f8000 - 0xc062e420   ( 218 kB)
       .bss : 0xc0633cf4 - 0xc06585c4   ( 147 kB)
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
VIC @d0800000: id 0x00041190, vendor 0x41
FPGA IRQ chip 0 "intc" @ d0802000, 20 irqs, parent IRQ: 47
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
Failed to initialize '/amba/[email protected]': -22
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Console: colour dummy device 80x30
Calibrating delay loop... 73.31 BogoMIPS (lpj=366592)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
Disabling memory control group subsystem
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x8220 - 0x827c
devtmpfs: initialized
random: get_random_u32 called from bucket_table_alloc+0x80/0x1a4 with crng_init=0
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/[email protected]
OF: amba_device_add() failed (-19) for /amba/fpga/[email protected]
Serial: AMBA PL011 UART driver
101f1000.uart: ttyAMA0 at MMIO 0x101f1000 (irq = 28, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
101f2000.uart: ttyAMA1 at MMIO 0x101f2000 (irq = 29, base_baud = 0) is a PL011 rev1
101f3000.uart: ttyAMA2 at MMIO 0x101f3000 (irq = 30, base_baud = 0) is a PL011 rev1
10009000.uart: ttyAMA3 at MMIO 0x10009000 (irq = 54, base_baud = 0) is a PL011 rev1
random: fast init done
vgaarb: loaded
SCSI subsystem initialized
clocksource: Switched to clocksource arm,sp804
NET: Registered protocol family 2
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 32
NetWinder Floating Point Emulator V0.97 (double precision)
workingset: timestamp_bits=14 max_order=16 bucket_order=2
Installing knfsd (copyright (C) 1996 [email protected]).
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
9p: Installing v9fs 9p2000 file system support
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
io scheduler mq-deadline registered
io scheduler kyber registered
pl061_gpio 101e4000.gpio: PL061 GPIO chip @0x101e4000 registered
pl061_gpio 101e5000.gpio: PL061 GPIO chip @0x101e5000 registered
pl061_gpio 101e6000.gpio: PL061 GPIO chip @0x101e6000 registered
pl061_gpio 101e7000.gpio: PL061 GPIO chip @0x101e7000 registered
OF: PCI: host bridge /amba/[email protected] ranges:
OF: PCI:    IO 0x43000000..0x4300ffff -> 0x00000000
OF: PCI:   MEM 0x50000000..0x5fffffff -> 0x50000000
OF: PCI:   MEM 0x60000000..0x6fffffff -> 0x60000000
versatile-pci 10001000.pci: PCI core found (slot 11)
versatile-pci 10001000.pci: PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [bus 00-ff]
pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff pref]
pci 0000:00:0c.0: [1000:0012] type 00 class 0x010000
pci 0000:00:0c.0: reg 0x10: [io  0x0000-0x00ff]
pci 0000:00:0c.0: reg 0x14: [mem 0x00000000-0x000003ff]
pci 0000:00:0c.0: reg 0x18: [mem 0x00000000-0x00001fff]
PCI: bus0: Fast back to back transfers disabled
pci 0000:00:0c.0: BAR 2: assigned [mem 0x50000000-0x50001fff]
pci 0000:00:0c.0: BAR 1: assigned [mem 0x50002000-0x500023ff]
pci 0000:00:0c.0: BAR 0: assigned [io  0x1000-0x10ff]
clcd-pl11x dev:20: PL110 designer 41 rev0 at 0x10120000
clcd-pl11x dev:20: Versatile hardware, VGA display
Console: switching to colour frame buffer device 80x30
brd: module loaded
sym53c8xx 0000:00:0c.0: enabling device (0100 -> 0103)
sym0: <895a> rev 0x0 at pci 0000:00:0c.0 irq 66
sym0: No NVRAM, ID 7, Fast-40, LVD, parity checking
sym0: SCSI BUS has been reset.
scsi host0: sym-2.2.3
scsi 0:0:0:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
scsi target0:0:0: tagged command queuing enabled, command queue depth 16.
scsi target0:0:0: Beginning Domain Validation
scsi target0:0:0: Domain Validation skipping write tests
scsi target0:0:0: Ending Domain Validation
scsi 0:0:2:0: CD-ROM            QEMU     QEMU CD-ROM      2.5+ PQ: 0 ANSI: 5
scsi target0:0:2: tagged command queuing enabled, command queue depth 16.
scsi target0:0:2: Beginning Domain Validation
scsi target0:0:2: Domain Validation skipping write tests
scsi target0:0:2: Ending Domain Validation
sd 0:0:0:0: [sda] 6799360 512-byte logical blocks: (3.48 GB/3.24 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 63 00 00 08
sr 0:0:2:0: [sr0] scsi3-mmc drive: 16x/50x cd/rw xa/form2 cdda tray
cdrom: Uniform CD-ROM driver Revision: 3.20
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sr 0:0:2:0: Attached scsi CD-ROM sr0
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <[email protected]>
smc91x 10010000.net eth0: SMC91C11xFD (rev 1) at d0b80000 IRQ 41
smc91x 10010000.net eth0: Ethernet addr: 52:54:00:12:34:56
 sda: sda1 sda2
input: AT Raw Set 2 keyboard as /devices/platform/amba/amba:fpga/10006000.kmi/serio0/input/input0
sd 0:0:0:0: [sda] Attached SCSI disk
rtc-ds1307 0-0068: registered as rtc0
IR NEC protocol handler initialized
IR RC5(x/sz) protocol handler initialized
IR RC6 protocol handler initialized
IR JVC protocol handler initialized
IR Sony protocol handler initialized
IR SANYO protocol handler initialized
IR Sharp protocol handler initialized
IR MCE Keyboard/mouse protocol handler initialized
IR XMP protocol handler initialized
versatile reboot driver registered
mmci-pl18x fpga:05: /aliases ID not available
mmci-pl18x fpga:05: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 59,60 (pio)
mmci-pl18x fpga:05: DMA channels RX none, TX none
mmci-pl18x fpga:0b: /aliases ID not available
mmci-pl18x fpga:0b: mmc1: PL181 manf 41 rev0 at 0x1000b000 irq 49,50 (pio)
mmci-pl18x fpga:0b: DMA channels RX none, TX none
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:0
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:1
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:2
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:3
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:4
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:5
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:6
leds-syscon 10000000.core-module:[email protected]: registered LED versatile:7
ledtrig-cpu: registered to indicate activity on CPUs
Netfilter messages via NETLINK v0.30.
nf_conntrack version 0.5.0 (4096 buckets, 16384 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
NET: Registered protocol family 17
Bridge firewalling registered
9pnet: Installing 9P2000 support
rtc-ds1307 0-0068: setting system clock to 2019-05-10 00:04:30 UTC (1557446670)
uart-pl011 101f1000.uart: no DMA platform data
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/amba/amba:fpga/10007000.kmi/serio1/input/input2
EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 8:2.
devtmpfs: mounted
Freeing unused kernel memory: 188K
This architecture does not have kernel memory protection.
random: crng init done
systemd[1]: Failed to insert module 'autofs4': No such file or directory
systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
systemd[1]: Detected architecture arm.

Welcome to Raspbian GNU/Linux 9 (stretch)!

systemd[1]: Set hostname to <raspberrypi>.
systemd[1]: Initializing machine ID from random generator.
systemd[1]: Listening on udev Control Socket.
[  OK  ] Listening on udev Control Socket.
systemd[1]: Listening on Journal Socket.
[  OK  ] Listening on Journal Socket.
systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
systemd[1]: Created slice User and Session Slice.
[  OK  ] Created slice User and Session Slice.
systemd[1]: Listening on Journal Socket (/dev/log).
[  OK  ] Listening on Journal Socket (/dev/log).
systemd[1]: Listening on Syslog Socket.
[  OK  ] Listening on Syslog Socket.
systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
systemd[1]: Listening on fsck to fsckd communication Socket.
[  OK  ] Listening on fsck to fsckd communication Socket.
systemd[1]: Created slice System Slice.
[  OK  ] Created slice System Slice.
systemd[1]: Created slice system-autologin.slice.
[  OK  ] Created slice system-autologin.slice.
         Starting Set the console keyboard layout...
systemd[1]: Mounting POSIX Message Queue File System...
         Mounting POSIX Message Queue File System...
systemd[1]: Starting Restore / save the current clock...
         Starting Restore / save the current clock...
systemd[1]: Starting Journal Service...
         Starting Journal Service...
systemd[1]: dev-hugepages.mount: Couldn't determine result for ConditionVirtualization=!private-users, assuming failed: No such file or directory
systemd[1]: Starting Create Static Device Nodes in /dev...
         Starting Create Static Device Nodes in /dev...
systemd[1]: Mounting RPC Pipe File System...
         Mounting RPC Pipe File System...
systemd[1]: Starting Load Kernel Modules...
         Starting Load Kernel Modules...
systemd[1]: Created slice system-systemd\x2dfsck.slice.
[  OK  ] Created slice system-systemd\x2dfsck.slice.
systemd[1]: Listening on udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
systemd[1]: Reached target Swap.
[  OK  ] Reached target Swap.
systemd[1]: Reached target Slices.
[  OK  ] Reached target Slices.
systemd[1]: Created slice system-serial\x2dgetty.slice.
[  OK  ] Created slice system-serial\x2dgetty.slice.
systemd[1]: Mounted RPC Pipe File System.
[  OK  ] Mounted RPC Pipe File System.
systemd[1]: Mounted POSIX Message Queue File System.
[  OK  ] Mounted POSIX Message Queue File System.
systemd[1]: Started Restore / save the current clock.
[  OK  ] Started Restore / save the current clock.
systemd[1]: Started Create Static Device Nodes in /dev.
[  OK  ] Started Create Static Device Nodes in /dev.
systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Load Kernel Modules.
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
systemd[1]: systemd-modules-load.service: Unit entered failed state.
systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
systemd[1]: Starting Apply Kernel Variables...
         Starting Apply Kernel Variables...
systemd[1]: Starting udev Kernel Device Manager...
         Starting udev Kernel Device Manager...
systemd[1]: Starting Remount Root and Kernel File Systems...
         Starting Remount Root and Kernel File Systems...
[  OK  ] Started Apply Kernel Variables.
[ TIME ] Timed out waiting for device dev-serial1.device.
[DEPEND] Dependency failed for Configure Bluetooth Modems connected by UART.
[ TIME ] Timed out waiting for device dev-ttyAMA0.device.
[DEPEND] Dependency failed for Serial Getty on ttyAMA0.
[ TIME ] Timed out waiting for device dev-di…x2dpartuuid-cd48578f\x2d01.device.
[DEPEND] Dependency failed for File System C…/dev/disk/by-partuuid/cd48578f-01.
[DEPEND] Dependency failed for /boot.
[DEPEND] Dependency failed for Local File Systems.
         Starting Set console font and keymap...
         Starting Raise network interfaces...
         Starting Preprocess NFS configuration...
[  OK  ] Reached target Timers.
[  OK  ] Closed Syslog Socket.
[  OK  ] Started Emergency Shell.
         Starting Tell Plymouth To Write Out Runtime Data...
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Emergency Mode.
[  OK  ] Reached target Login Prompts.
[  OK  ] Started Set console font and keymap.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Started Preprocess NFS configuration.
[  OK  ] Started Tell Plymouth To Write Out Runtime Data.
You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to
try again to boot into default mode.
[  OK  ] Started udev Kernel Device Manager.
[FAILED] Failed to start Journal Service.
See 'systemctl status systemd-journald.service' for details.
[DEPEND] Dependency failed for Flush Journal to Persistent Storage.
ghans wrote: Better yet, just start Linux on your Laptop (with Intel VT or AMD-V, obviously), modpobe kvm, and then start QEMU with "accel=kvm".
ghans
No, the x86 laptop is not an option. I need to run Raspbian, in a window in Raspbian, on a Raspberry Pi.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

ghans
Posts: 7871
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 8:23 pm

Well, is this any better ?

viewtopic.php?t=232417

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Fri May 10, 2019 8:31 pm

According to the Stretch tutorial, Qemu does not yet support Raspberry Pi 3. Instead, they had qemu simulate an entirely different ARM device , versatiale-pb, which has a maximum of 256 MB RAM. Since qemu is emulating an entirely different device, it is totally understandable for it to be too slow, and DougieLawson agrees.
DougieLawson wrote: Virtual machines have an enormous overhead.
That's why I am looking for an error-free, faster solution than qemu.

And I tried
ghans wrote: Please understand the difference between QEMUs TCG "accelerator" and QEMU with KVM acceleration.
...and then start QEMU with "accel=kvm".
Tried adding accel=kvmto the end of the command, but qemu replied back with

Code: Select all

qemu-system-arm: -no-reboot: drive with bus=0, unit=0 (index=0) exists
Googled it, tried -accel kvm, tried -accel=kvm.
-enable-kvm seems to get me closer, though not close enough to pop up a qemu window:

Code: Select all

Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
HawaiianPi
Posts: 4532
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sat May 11, 2019 1:14 am

Botspot wrote:
Fri May 10, 2019 8:31 pm
That's why I am looking for an error-free, faster solution than qemu.
Which would be multi-boot with something like PINN or BerryBoot.

You really are way over-complicating this with your approach. Running a VM requires a lot of RAM and CPU power, and Pi computers have neither of those in abundance. So again, can you do it, maybe? Should you do it, almost certainly not.

You have also posted conflicting information.

For example, in one post you say, "My Pi is very out-of-reach, and I once broke a card while ejecting it, so I really dislike switching cards."

But then in a later post you said, "I would want to insert a SD card into the USB adapter on my Pi, make the modifications I wanted to (move files, apt update, install something, test a program, etc.), then remove the SD card and insert it into another Pi."

Another Pi, which you can't even use, because you only have one keyboard, mouse and monitor, and no router. "I do have a second Pi, but I do not have a router to connect them for any sort of VNC thing." No router, really? How do you connect to the Internet?

You seem to be arguing just for the sake of arguing, and making up excuses to continue arguing.

"And even if I VNC'ed in to the network-booted pi and did not have to plug and unplug anything, it would still not be exactly what I want. What if I wanted a third OS running simultaneously?" Again, where is the CPU power and RAM for this?

"What if the OS does not support VNC?" Not a problem with multi-boot.

"What if VNC does not support a necessary functionality like audio, GPU overlay, or CLI?" Also not a problem with multi-boot.

You can multi-boot from an SD card, USB drive or network. Whatever is most convenient for you.

Oh, and if you really broke an SD card, then you have your Pi3 in a Pi2 case. They may look similar, but they are not the same. The Pi2B had a push-to-eject card slot, so many Pi2 cases have limited access to the slot (counting on the ejection mechanism to make the card accessible). The push-eject slot had some reliability problems and the Pi3 models have a simpler, more reliable push in pull out system that requires more room around the card slot.

Good luck getting multiple VMs running on your Pi. I've worked with VMs on much more powerful hardware and often found them to be more trouble than they're worth, but you seem fixated on the idea that is your only option, no matter what anyone else suggests, so I think this is where my participation in the thread will end. I've never tried running a VM on a Pi, because I don't believe the results would be satisfactory, but if you do get it working I would be interested in your experience and results, so please mark the thread as solved when you find a solution.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sat May 11, 2019 1:45 am

ghans wrote:
Fri May 10, 2019 8:23 pm
Well, is this any better ?

viewtopic.php?t=232417

ghans
Ghans, thank you so much for sharing this with me.
I went ahead and flashed one of my SD cards with the disk image on that post, and I can see the potential of running Raspbian and Buster at the same time.
It appears the makers used systemd-nspawn.
I went to the man page, and there is one sentence which looks like exactly what I am looking for:
In contrast to chroot(1) systemd-nspawn may be used to boot full Linux-based operating systems in a container.
Sorry for all the apparent contradictions guys, but if I can get this to work, it would be exactly what I wanted.
HawaiianPi wrote: Running a VM requires a lot of RAM and CPU power, and Pi computers have neither of those in abundance.
Totally agree that a Virtual Machine is a bad idea. But since I do not wish to simulate non-native hardware, I hope to find a solution which will fall somewhere between a dual-boot and virtual machine.

If that is not possible, I will probably just get a microSD extension cable, thereby making it easier and safer to switch cards.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sun May 12, 2019 12:28 am

Update: I succeeded in using systemd-nspawn to correctly boot up the operating system on a second SD card inserted into the easily-reachable USB card slot on my Pi. The familiar code-based CLI boot screen appeared in the terminal. Since I am not emulating hardware, CPU architecture, or even another kernel (I think), the speed of the nspawn container was equally fast as if I was booting from that SD card.
I ran this command:

Code: Select all

sudo systemd-nspawn -bD /media/pi/rootfs --bind /dev/tty2 --bind /lib/modules
2019-05-11-192548_1920x1080_scrot.png
2019-05-11-192548_1920x1080_scrot.png (244.81 KiB) Viewed 1460 times
One problem though: the SD was is supposed to boot to desktop. Instead it is booting to CLI. When I attempt to start it manually with startx, it says

Code: Select all

xinit: unable to connect to X server: Connection refused
xinit: server error
Not surprised, as the native operating system is using Xorg. I will look into options to implement a second Xorg screen configuration into a graphical QEMU-style window on the native OS. I am also looking into VNC to create a virtual desktop I can connect to from the main OS, and simply bypass VNC for the audio and GPU overlay requirements.

Does anyone know if I am understanding this correctly, that vncserver can create a virtual desktop on a headless machine?
https://www.raspberrypi.org/documentati ... ccess/vnc/
Creating a virtual desktop
If your Raspberry Pi is headless (i.e. not plugged into a monitor) or controlling a robot, it is unlikely to be running a graphical desktop.

VNC Server can create a virtual desktop for you, giving you graphical remote access on demand. This virtual desktop exists only in your Raspberry Pi's memory:
So does VNC care if an Xorg server is already running but busy?
Last edited by Botspot on Sun May 12, 2019 9:32 pm, edited 1 time in total.
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

PhatFil
Posts: 1342
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sun May 12, 2019 2:58 am

would docker be of interest? https://www.docker.com/

having only scratched the surface myself by installing a couple of docker versions of projects that took my interest.

But as i understand it its a way to sit many systems side by side without any of the conflicts that could arise between different systems. and you can pull performance metrics too..

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sun May 12, 2019 1:31 pm

PhatFil wrote:
Sun May 12, 2019 2:58 am
would docker be of interest? https://www.docker.com/

having only scratched the surface myself by installing a couple of docker versions of projects that took my interest.

But as i understand it its a way to sit many systems side by side without any of the conflicts that could arise between different systems. and you can pull performance metrics too..
To be honest, I have never heard of Docker before.
Do you know if Docker would be able to run the full desktop GUI, or just individual apps like chroot?
Does this URL help clarify things for you? https://www.reddit.com/r/docker/comment ... sktop_gui/
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

User avatar
rpdom
Posts: 14991
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Sun May 12, 2019 4:47 pm

Botspot wrote:
Sun May 12, 2019 1:31 pm
Do you know if Docker would be able to run the full desktop GUI, or just individual apps like chroot?
Docker will not run a GUI. There are ways of making applications run using the host GUI, but it is not a great idea.

What it provides is a contained environment with the base Linux files that run using the Linux Kernel from the host system. It's a bit like a chroot, but more flexible. Anything running inside each Docker container (usually) has no access to anything running on the host system, including peripherals. This is where it differs from a Virtual Machine. You can run an Alpine Linux environment (a pretty minimal Linux, used a lot in Docker) in a container using the current Raspbian kernel.
You can give it specific locations on disk that it can access, also firewalled network access and limits for CPU usage and memory etc (to an extent).

Because it uses the host's kernel it can be very efficient in terms of resources.

I've used Docker a lot on x86-64 systems over the last few years and have tried it out on a Pi 3B with a couple of simple Docker containers.

User avatar
Botspot
Posts: 161
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Yahoo Messenger

Re: How do I run a Raspbian virtual desktop inside Raspbian?

Mon May 20, 2019 8:24 pm

Botspot wrote:I am also looking into VNC to create a virtual desktop I can connect to from the main OS, and simply bypass VNC for the audio and GPU overlay requirements.
That's what I ended up doing. Credit to Sakaki for helping put me on the right track.

Unlike multi-boot or PINN, this solution is limited to OSes that use the same kernel as the host OS, and they have to run VNC to create a virtual framebuffer. But for running another instance of Raspbian within Raspbian, it works at full native speed.
HawaiianPi wrote: but if you do get it working I would be interested in your experience and results, so please mark the thread as solved when you find a solution.
This is the four main steps I take to get this working:
After inserting a Raspbian-flashed SD card into a microSD-to-USB adapter in the Pi, the process can be divided into 4 main steps:
  1. remount it as suid.
  2. boot it with systemd-nspawn.
  3. start vncserver within the systemd-nspawn container and take note of the VNC address it returns.
  4. start vnc viewer on the host OS and connect to the container's virtual desktop.


I go into more detail at this topic.

Yes I will mark it as solved, and for all of you who want to see the final result, take a look at this:Image
edit: added the concise 4 steps
My doctor told me my brain is as useful as a Raspberry Pi. Is that a compliment?

Return to “General discussion”