Qemu Debian x86 on RaspberryPi - raspberry-pi

I want to create i386 environment with QEMU and chroot on Raspberry Pi.
I am using Raspberry Pi ver B, but I guess it should not matter much which version is used.
So far I did:
apt-get install qemu qemu-user qemu-user-static binfmt-support debootstrap binutils
Then I mounted chroot directory to /tmp/mnt and ran:
sudo debootstrap --foreign --arch i386 buster ./ http://deb.debian.org/debian/
Then I mounted:
mount -t sysfs /sys /tmp/mnt/sys/
mount -t proc /proc /tmp/mnt/proc/
mount –bind /dev /tmp/mnt/dev/
mount –bind /dev/pts /tmp/mnt/dev/pts/
mount –bind /dev/shm /tmp/mnt/dev/shm/
Now when I try to run second stage of debootstrap:
sudo chroot ./ ./debootstrap/debootstrap --second-stage
I get the following error message:
W: Failure trying to run: /sbin/ldconfig
W: See //debootstrap/debootstrap.log for details
I checked the debootstrap/debootstrap.log:
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
Indeed when I try sudo chroot ./ ./sbin/ldconfig I get same Seg fault.
But when I try sudo chroot ./ ./bin/bash it works.
I am not sure what should be my next step.
I guess it is something related to my qemu config or verison (I am using version 2.8.1(Debian 1:2.8+dfsg-6+deb9u4)). I checked many threads about similar issues, but I could not find one which would help me to find the solution.

OK, I think I figured it out.
It works when I select stretch as Debian version in debootstrap command.
sudo debootstrap --foreign --arch i386 stretch ./ http://deb.debian.org/debian/
Now when I think about it more, it makes sense. I guess running i386 Debian in chroot does not provide full separation from host OS (I mounted proc, sys, etc.).

I had the exact same problem running Raspbian Buster; the problem went away when chrooting Debian Stretch.
So somehow ldconfig from the i386 repository is not working with the qemu-i386-static emulator on buster, but it IS working on stretch!
Has nothing to do with the host system....

Related

mount: unknown filesystem type 'vmhgsf'

I'm trying to mount my windows shared folder in centOS using command:
~mount -t vmhgfs .host:/shared-folder /var/www/html/
Unfortunatelly I get :
~monut: unknown filesystem type 'vmhgfs'
error. I tried to use:
~/usr/bin/vmhgfs-fuse /mnt
but mountpoint is not empty...
Is there any way to mount this folder on VMware player?
Cyb
Try this:
vmhgfs-fuse .host:/shared-folder /var/www/html/
you might need to use sudo on this
Working from a MacBook Pro running Big Sur and using VMware to host the virtual machine with CentOS 7 operating system. Had issues with loading in shared folders after VMware tools were installed. What worked for me is to use this exact command:
sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
Hope this saves others the trouble of tracking down this solution.
The below is working perfectly fine for me. Might be useful for someone.
Already I have mapped the required folders in "SharedFolder" settings. But it was not showing up.
Additionally running this command shares the windows directories.
sudo /usr/bin/vmhgfs-fuse .host:/ /home/user/win -o subtype=vmhgfs-fuse,allow_other

CentOS mount LAN disk, //192.168.1.223/ is not a valid block device

I'm using CentOS today, I want mount my work LAN disk in /mnt/P,
use:mount -t cifs //192.168.1.223/ /mnt/P -o username=centos,password=FFM#centos,domain=ffm.local
early, I used this order in Ubuntu, it's OK, but today, in CentOS, tell me:
mount: //192.168.1.223/ is not a valid block device
I don't know much about CentOS, please, thx~
You need install cifs-utils package
sudo yum install cifs-utils

Permanent mount volume via sshfs Sierra

I am trying to permanently mount a volume via sshfs on mac. I have tried to follow the instructions in how-to-get-automount-and-sshfs-osxfuse-working-with-yosemite (Although I have Sierra, I couldn't find instructions for it so I thought to give it a try with Yosemite instructions). However I get stuck at this step:
If you do not see mount_sshfs, then you need to do this step. This
is a critical step because it is easily forgotten and may create
headaches. sudo ln -s $(which sshfs) /sbin/mount_sshfs.
Here is the error:
$ sudo ln -s $(which sshfs) /sbin/mount_sshfs
ln: /sbin/mount_sshfs: Operation not permitted
I couldn't find the way to solve this.
Apple protects some critical folders by "System Integrity Protection (SIP)", you can temporarily disable it with the instructions given here
https://apple.stackexchange.com/questions/208478/how-do-i-disable-system-integrity-protection-sip-aka-rootless-on-macos-os-x

(Cross-)Compiling Swift for Raspberry PI

Swift is now Open Source. Did anyone tried compiling Swift for a Raspberry PI? I started to do, but my 8 GB SD card seems to be too small for it ;) Is it possible to cross compile it from Ubuntu?
A 8GB SD Card works ok, but you'll need to extend the root volume. I have it working and the used space on /dev/root partition is around 3.1GB.
The steps below are based on the blog post by Andrew Madsen with a little extra focus on the steps inside fdisk.
Get Ubuntu
Download an image of Ubuntu 14.04 for Raspberry Pi 2 from finnie.org and copy it onto the SD card. Boot the Raspberry Pi.
Change the partition
Log into the Raspberry Pi and change the partition size. The default size for /dev/root is 1.7G with 1.1G available. That is not enough.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 1.7G 540M 1.1G 35% /
devtmpfs 458M 4.0K 458M 1% /dev
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 93M 228K 93M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 462M 0 462M 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/mmcblk0p1 64M 20M 45M 31% /boot/firmware
Run fdisk
sudo fdisk /dev/mmcblk0
At the prompt enter p for 'print the partition table'. There are two partitions
/dev/mmcblk0p1 * 2048 133119 65536 c W95 FAT32 (LBA)
/dev/mmcblk0p2 133120 3670015 1768448 83 Linux
When prompted, enter d (for delete), then 2. Then, recreate the partition by entering n, then p, then 2, then pressing enter at the next two prompts accepting the defaults.
Enter p again and see the second partition is now bigger, now all space on an 8GB card is used.
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 2048 133119 65536 c W95 FAT32 (LBA)
/dev/mmcblk0p2 133120 15523839 7695360 83 Linux
Enter w to write the changes to disk, then reboot
sudo reboot
Resize the partition
After the reboot, resize the partition’s file system by running
sudo resize2fs /dev/mmcblk0p2
Swap space
Setup a swap file by doing
sudo apt-get install dphys-swapfile
Install libicu-dev and clang-3.6
sudo apt-get install libicu-dev clang-3.6
Use update-alternatives to provide /usr/bin links for clang and clang++:
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
Then, add #iachievedit’s repository key:
wget -qO- http://dev.iachieved.it/iachievedit.gpg.key | sudo apt-key add -
Add the appropriate repository to sources.list:
echo "deb [arch=armhf] http://iachievedit-repos.s3.amazonaws.com/ trusty main" | sudo tee --append /etc/apt/sources.list
Run apt-get update:
sudo apt-get update
Install Swift
sudo apt-get install swift-2.2
After the installation is complete, you’re ready to compile Swift programs!
Write Swift
Open your favorite text editor, write a program, and save it (e.g. to 'hello.swift’):
let device = "Raspberry Pi 2!"
print("Hello from Swift on \(device)")
Compile it
swiftc hello.swift
and run it:
./hello
Hello from Swift on Raspberry Pi 2!
That’s it! Swift running on Raspberry Pi
The Swift Package Manager got custom toolchain support via
PR-1098
end of April 2017.
I wrote up detailed instructions on how to build a RaspberryPi toolchain over here: macOS -> RasPi Cross Compilation Toolchain
and even the reverse (build macOS binaries on a RaspberryPi) for the fun of it.
The same would work for Intel-Linux to ARM-Linux w/ minimal modifications. The SwiftPM repo contains an example script on how to do this for Intel-macOS to Intel-Ubuntu.
You can find a 2017-05-01 update on Swift-on-ARM over here:
An Update on Swift 3.1.1 For Raspberry Pi Zero/1/2/3.
As a small summary, so that this answer isn't just links ;-), ARM status 2017-05-16:
you can compile Swift 3.1/3.1.1 on RaspberryPi Ubuntu
don't forget to setup swap, some minimal patches are required
for 3.1.1. 8GB disk may be a bit to little.
compilation on Raspbian doesn't seem to work yet (last known version
is 3.0.2)
you can cross-compile Swift using a custom toolchain, which is
reasonably easy to setup
you need to grab a SwiftPM snapshot (Swift 4) for this (but the toolchain itself can be 3.1 or even 3.0.2 w/ minor changes)
you can also run (and compile) Swift via Docker,
e.g. in HypriotOS.
there is a Slack group for Swift ARM: swift-arm

Ubuntu Server 14.04 install error: can't umount /media

I'm trying to install Ubuntu Server 14.04.2 on an old dellcomputer, but as soon as I get past the initial menu, choosing to install Ubuntu Server, I get some console output and everything gets stuck on:
mount: mounting /dev/sda on /media failed: Invalid argument
umount: can't umount /media: Invalid argument
mount: mounting /dev/sdb on /media failed: Invalid argument
umount: can't umount /media: Invalid argument
Ubuntu Link: system installation
Installation Question
Best would be disable any floppy diskette, any slave or other IDE devices from BIOS settings. Only enable the peripheral device setting and reboot the computer. It should be able to mount properly from the target location. Its easy and works for me .. :)