Getting closer to the end that was further than I first thought.
link on drivers and binding directories.
https://forum.manjaro.org/t/how-to-install-video-drivers-kernels-and-grub-while-being-chrooted-using-systemd-nspawn/6755/22
For everyone who is interested:
Where this project is at this time.
pull latest compatible version of openwrt ( 32 bit or 64 bit)
credit to sakaka in raspberry forum
You can easily switch your Raspbian host to use the 64-bit (official) kernel; after doing so ,your existing (32-bit) Raspbian userland will continue to work fine, but you should then also be able to chroot/nspawn into aarch64 userlands too
To do so, on your host system edit the file /boot/config.txt, and add to the end:
Code: Select all
[all]
arm_64bit=1
now you can run x86_64 img
If this is done while in host, reboot to take affect.
run apt-get update
& apt-get install systemd-container
if working in linux us wget
followed by download link.
you need to mount these guys using:
pi@raspberrypi:~ $ gzip openwrt_latest
Archive: openwrt_latest
inflating: latest-version-openwrt.img
pi@raspberrypi:~ $ sudo losetup --show -P -f {latest-version-openwrt.img}
/dev/loop0
pi@raspberrypi:~ $ ls /dev/loop0*
/dev/loop0 /dev/loop0p1 /dev/loop0p2
```pi@raspberrypi:~ $ sudo mkdir -p /mnt/openwrt
pi@raspberrypi:~ $ sudo mount -v /dev/loop0p2 /mnt/openwrt
mount: /dev/loop0p2 mounted on /mnt/openwrt
pi@raspberrypi:~ $ sudo mkdir /mnt/openwrt/boot
pi@raspberrypi:~ $ sudo mount -v /dev/loop0p1 /mnt/openwrt/boot
mount: /dev/loop0p1 mounted on /mnt/openwrt/boot.
now test your container
pi@raspberrypi:~ $ sudo systemd-nspawn --directory=/mnt/openwrt
Now we need to setup container as a service to start on boot up.
copy all the contents from /mnt/openwrt and place in this directory
cp -r /mnt/openwrt /var/lib/machines/
. ---dont forget the -r
------
For network config you need 2 files in /etc/systemd/network/
./Bridge.netdev
[NetDev]
Name=br0
Kind=bridge
./bridge.network
[Match]
Name=br0
[Network]
DNS=192.168.1.1
Address=192.168.1.2/24
Gateway=192.168.1.1
The ip addresses can be whatever, this is what machinectl
will see and show in machinectl -a
Now setup your config file:
/etc/systemd/nspawn/openwrt.nspawn
[Exec]
PrivateUsers=yes
[Files]
[Network]
Private=yes
VirtualEthernet=yes
Bridge=br0
When you are ready to deploy you need to add Interface=eth0
to the above config file
Here I made sure the Bridge was assigned in .nspawn conf of the single container.
Now start it up: machinectl start openwrt
you should be able to SSH
into the ip 192.168.1.1 or whatever you put in the .network
config file
if you can not, then manual startup the container
first kill the one running
machinectl kill openwrt
give it about 5-10 sec to shutdown check with machinectl -a
now run systemd-nspawn --directory=/var/lib/machines/openwrt
Once in the container on openwrt add bridge for interfaces.
vi /etc/config/network
go to line with option ifname
then add 'eth0 host0'
save [ Esc / : / wq / Enter]
then terminate container session
Hold Ctrl
and press ]
key rapidly.
If you check ip a
you will see that vb-openwrt now has an ip address, 192.168.1.x
Now that is as far as i have gotten so far. Working on trying to bind ports and mount essential "host' directories is still needed. If anyone wants to contribute to testing or knows of some advice, it would be much appreciated.
@dlakelan has been working with me on this and im sure he is wanting to see this fully working.