GithubHelp home page GithubHelp logo

vyos-pi-builder's Introduction

vyos-pi-builder

Build VyOS 1.4 image on pi4

Quick build instructions:

  • install a 64bit debian/ubuntu (haven't tried using raspbian) on a pi and install docker

  • build the official vyos-build docker container as vyos/vyos-build:current-arm64 This can take an hour++ to complete

    sudo docker build https://github.com/vyos/vyos-build.git#current:docker -t vyos/vyos-build:current-arm64
    
  • Build a Pi image:

    git clone https://github.com/runborg/vyos-pi-builder
    cd vyos-pi-builder
    sudo docker run -it --privileged -v "$(pwd)":/vyos -v /dev:/dev -w /vyos --sysctl net.ipv6.conf.lo.disable_ipv6=0 vyos/vyos-build:current-arm64 sudo bash -x build-image.sh
    

Build VyOS 1.4 image on an x86 linux host using qemu-user-static and docker/podman

  • Prerequisites

    • docker/podman
    • qemu-user-static
  • build the official vyos-build docker container as vyos/vyos-build:current-arm64 This can take an hour++ to complete

    git clone -b current --single-branch https://github.com/vyos/vyos-build
    sudo docker build --platform linux/arm64 vyos-build/docker -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -t vyos/vyos-build:current-arm64
    
    

    or with make

    make container
    
  • Build a Pi kernel:

    You must build the kernel the first time and when the kernel is upgraded.

    The required kernel version information by VyOS is here and the provided kernel version information for Raspberry Pi is here.

    If the version of the kernel you need is different from the kernel provided for pi, you will need to prepare the kernel by other means instead of using the command below.

    sudo docker run --rm -it --platform linux/arm64 --privileged -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -v "$(shell pwd)":/vyos -v /dev:/dev --sysctl net.ipv6.conf.lo.disable_ipv6=0 localhost/vyos/vyos-build:current-arm64 /bin/bash -c 'cd /vyos; /bin/bash -x build-pi-kernel.sh'
    

    or with make

    make kernel-local
    

    you can also take already built container in docker registry and use that.

    make kernel-registry
    
  • Build a Pi image:

    git clone https://github.com/runborg/vyos-pi-builder
    cd vyos-pi-builder
    sudo docker run --rm -it --platform linux/arm64 --privileged -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -v "$(shell pwd)":/vyos -v /dev:/dev --sysctl net.ipv6.conf.lo.disable_ipv6=0 localhost/vyos/vyos-build:current-arm64 /bin/bash -c 'cd /vyos; /bin/bash -x build-image.sh'
    

    or with make

    make iso-local
    

    you can also take already built container in docker registry and use that.

    make iso-registry
    

vyos-pi-builder's People

Contributors

djkaosun avatar jalenlin avatar kaplan-michael avatar mowoe avatar runborg avatar tkmr-akhs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vyos-pi-builder's Issues

Not really an issue ;)

Hi there!

I just wanted to say thank you for sharing this repo. It worked flawlessly so far.
What I was wondering is how to get wireless to work. I suppose the right drivers are missing from the vyos kernel?

Also, I was wondering, on a device such as this one https://www.dfrobot.com/product-2242.html
the second interface requires the r8168-dkms driver. That in turn would require dkms support. Is that even possible? Probably easier to just use the raspbian kernel instead lol.

I know this isn't a free support forum but I figured I'd ask anyway. Maybe someone else thought about it already.

Thank you

build script doesnt work for 1.4 sagitta or 1.3 equuleus

Hi!
first of all thank you for your work in this project. I have discovered some issues with the build-image.sh script:

  1. ./configure wont work in the current branch of vyos-build, as vyos discontinued using it (see build docs 'Build ISO'). The compilation and configuration process is now done by the build-vyos-image (python) script. To continue using this setup, the only possibility is to use vyos 1.3 (or lower) by checking out the equuleus branch during build.
  2. The build script uses data/generic-arm64.json as the configuration for the build flavor. However, this file is not provided anywhere (anymore?), I had to create it myself. (This is true for both 1.4 and 1.3)

I already submitted PR #15 to fix a smaller issue and would be willing to contribute some more fixes for this project. However I think that the current project maintainers should decide how to continue on issue 1.), as the build scripts are currently not usable for vyos sagitta.

make container failed: unknown shorthand flag: 'v' in -v

Hi,

in addition to my previous issue, I also noticed that make container fails with the same error.
However, if you omit --arch, the command may not work either, as it tries to mount qemu-aarch64-static during the build process, and docker has no support for mounting files when building a container image:

$ sudo docker build vyos-build/docker -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -t vyos/vyos-build:current-arm64 
unknown shorthand flag: 'v' in -v
See 'docker build --help'.

I also have the feeling here that I have overlooked a decisive step

make iso error

Hi,

When I trying to build an image I hit the following error:

xorriso 1.5.2 : RockRidge filesystem manipulator, libburnia project.

xorriso : NOTE : Environment variable SOURCE_DATE_EPOCH encountered with value 1647449038
Drive current: -outdev 'stdio:live-image-arm64.hybrid.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 62.2g free
xorriso : NOTE : -as mkisofs: Ignored option '-cache-inodes'
xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
Added to ISO image: directory '/'='/binary'
xorriso : UPDATE :     244 files added in 1 seconds
xorriso : FAILURE :  Cannot find in ISO image: -boot_image ... bin_path='/isolinux/isolinux.bin'
xorriso : UPDATE :     244 files added in 1 seconds
xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'
E: An unexpected failure occurred, exiting...
P: Begin unmounting filesystems...
P: Saving caches... 

Can you please tell me where is the "boot_image ISO image" file is? How to complete the missing file?

Thanks

Unable to find a medium containing a live file system

Hi there,
I've tried to create an Vyos ISO (current with 6.1.51 kernel) and the rpi images based on that ISO file thanks to your instructions.
Sadly the Image will not boot post initrd (see screenshot below). The Squashfs seems to be there, so I would appreciate any kind of advice or tip how to debug this issue.

Thanks a lot!
Marcel

Screenshot:

screenshot

Filesystem

bookworm:/home/moed/vyos-pi-builder# fdisk -l vyos-bcm2711-rpi-4-b.img
Disk vyos-bcm2711-rpi-4-b.img: 1.8 GiB, 1932735488 bytes, 3774874 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x67ec2bae

Device                    Boot  Start     End Sectors  Size Id Type
vyos-bcm2711-rpi-4-b.img1 *      8192  116735  108544   53M  e W95 FAT16 (LBA)
vyos-bcm2711-rpi-4-b.img2      116736 3710975 3594240  1.7G 83 Linux
bookworm:/home/moed/vyos-pi-builder# mount -o offset=59768832 vyos-bcm2711-rpi-4-b.img /mnt/
bookworm:/home/moed/vyos-pi-builder# ls -lah /mnt/
total 36K
drwxr-xr-x  5 root root 4.0K Sep  6 14:02 .
drwxr-xr-x 18 root root 4.0K Aug  7 15:35 ..
drwxr-xr-x  5 root root 4.0K Sep  6 14:02 boot
drwxr-xr-x  2 root root 4.0K Sep  6 14:02 iso
drwx------  2 root root  16K Sep  6 14:02 lost+found
-rw-r--r--  1 root root    8 Sep  6 14:02 persistence.conf
bookworm:/home/moed/vyos-pi-builder# ls -lah /mnt/boot/
total 20K
drwxr-xr-x 5 root root 4.0K Sep  6 14:02 .
drwxr-xr-x 5 root root 4.0K Sep  6 14:02 ..
drwxr-xr-x 2 root root 4.0K Sep  6 14:02 efi
drwxr-xr-x 2 root root 4.0K Sep  6 14:02 grub
drwxr-xr-x 4 root root 4.0K Sep  6 14:02 image
bookworm:/home/moed/vyos-pi-builder# ls -lah /mnt/boot/image/
total 336M
drwxr-xr-x 4 root root 4.0K Sep  6 14:02 .
drwxr-xr-x 5 root root 4.0K Sep  6 14:02 ..
drwxr-xr-x 5 root root 4.0K Sep  6 14:02 grub
-r--r--r-- 1 root root 316M Sep  6 14:02 image.squashfs
-r--r--r-- 1 root root  11M Sep  6 14:02 initrd.img
drwxr-xr-x 2 root root 4.0K Sep  6 14:02 rw
-r--r--r-- 1 root root 9.1M Sep  6 14:02 vmlinuz
bookworm:/home/moed/vyos-pi-builder# cat /mnt/boot/grub/grub.cfg
set default=1
set timeout=5

echo -n Press ESC to enter the Grub menu...
if sleep --verbose --interuptable 5 ; then
    terminal_input console virtual
fi

menuentry "VyOS  (Serial console)" {
        linux /boot/image/vmlinuz boot=live vyos-union=/boot/image console=ttyAMA0,115200n8 earlycon=pl011,0xfe201000 noautologin
        initrd /boot/image/initrd.img
}
menuentry "VyOS  (Graphical console)" {
        linux /boot/image/vmlinuz boot=live vyos-union=/boot/image noautologin
        initrd /boot/image/initrd.img
}

menuentry "Lost password change  (Serial console)" {
        linux /boot/image/vmlinuz boot=live vyos-union=/boot/image console=ttyAMA0,115200n8 init=/opt/vyatta/sbin/standalone_root_pw_reset
        initrd /boot/image/initrd.img
}

Logs files:

The following stage is required to be done first: bootstrap

Hi - when following the README and running the docker command I get the following logs:

ubuntu@ubuntu:~/vyos-pi-builder$ sudo docker run -it --privileged -v "$(pwd)":/vyos -v /dev:/dev -w /vyos --sysctl net.ipv6.conf.lo.disable_ipv6=0 vyos/vyos-build:current-arm64 sudo bash -x build-image.sh
Current UID/GID: 1000/1000
+ set -x
+ set -e
++ pwd
+ ROOTDIR=/vyos
+ rm -rf vyos-build
+ git clone http://github.com/vyos/vyos-build vyos-build
Cloning into 'vyos-build'...
warning: redirecting to https://github.com/vyos/vyos-build/
remote: Enumerating objects: 9761, done.
remote: Counting objects: 100% (312/312), done.
remote: Compressing objects: 100% (213/213), done.
remote: Total 9761 (delta 178), reused 185 (delta 93), pack-reused 9449
Receiving objects: 100% (9761/9761), 7.11 MiB | 6.74 MiB/s, done.
Resolving deltas: 100% (5779/5779), done.
++ find build -type f -name '*.deb'
++ grep -v -e -dbgsym_ -e libnetfilter-conntrack3-dbg
find: ‘build’: No such file or directory
+ cd vyos-build
+ echo 'Copy new default configuration to the vyos image'
Copy new default configuration to the vyos image
+ cp /vyos/config.boot.default data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default
+ VYOS_BUILD_FLAVOR=data/generic-arm64.json
+ ./configure
Loading data/generic-arm64.json
Loading data/defaults.json
No inheritance detected
Checking if packages required for VyOS image build are installed
All dependencies are installed
Saving the build config to build/build-config.json
+ make iso
Checking build configuration
[2022-01-25 09:36:01] lb clean
P: Cleaning chroot
Starting VyOS ISO image build
Setting up additional APT entries
Configuring live-build
[2022-01-25 09:36:02] lb config noauto --architectures arm64 --bootappend-live boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay console=ttyS0,115200 console=tty0 net.ifnames=0 biosdevname=0 --bootappend-live-failsafe live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal console=ttyS0,115200 console=tty0 net.ifnames=0 biosdevname=0 --linux-flavours v8-arm64-vyos --linux-packages linux-image-5.10.93 --bootloader grub-efi --binary-images iso-hybrid --checksums sha256 md5 --debian-installer none --distribution bullseye --iso-application VyOS --iso-publisher root@89535b0f4372 --iso-volume VyOS --debootstrap-options --variant=minbase --exclude=isc-dhcp-client,isc-dhcp-common,ifupdown --include=apt-utils,ca-certificates,gnupg2 --mirror-bootstrap http://deb.debian.org/debian --mirror-chroot http://deb.debian.org/debian --mirror-chroot-security http://deb.debian.org/debian --mirror-binary http://deb.debian.org/debian --mirror-binary-security http://deb.debian.org/debian --archive-areas main contrib non-free --firmware-chroot false --firmware-binary false --updates true --security false --backports false --utc-time true --debug --apt-recommends false --apt-options --yes -oAPT::Get::allow-downgrades=true --apt-indices false
P: Updating config tree for a debian/bullseye/arm64 system
P: Symlinking hooks...
It's not like I'm building this specially for you or anything!
[2022-01-25 09:36:04] lb build
P: live-build 20210407
P: Building for a debian/bullseye/arm64 system
[2022-01-25 09:36:04] lb bootstrap
P: Setting up clean exit handler
[2022-01-25 09:36:05] lb bootstrap_cache restore
W: skipping /usr/lib/live/build/bootstrap_cache, foreign architecture(s).
[2022-01-25 09:36:05] lb bootstrap_debootstrap
W: skipping /usr/lib/live/build/bootstrap_debootstrap, foreign architecture(s).
[2022-01-25 09:36:05] lb bootstrap_cache save
W: skipping /usr/lib/live/build/bootstrap_cache, foreign architecture(s).
[2022-01-25 09:36:05] lb chroot_prep install all-except-archives
E: the following stage is required to be done first: bootstrap
E: An unexpected failure occurred, exiting...
make: *** [Makefile:32: iso] Error 1

I've run the prior docker build which was successful - running on a Raspberry Pi 4 2GB edition. I'm a little out of my depth - any advice or ideas?

support update images

Hey this is more of a question whether it is even possible to build an iso instead of an RPI image and use that via add system image to update the running images.

build-image.sh fails on "make iso" due to amd64 repo pinning

Recently when trying to build an image I hit the following error:

The following packages have unmet dependencies:
 ntp : Conflicts: time-daemon
 systemd-timesyncd : Conflicts: time-daemon
 vyos-1x : Depends: telegraf (>= 1.20) but it is not installable
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: An unexpected failure occurred, exiting...
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists...
Building dependency tree...
Reading state information...
make: *** [Makefile:32: iso] Error 1

This seems to be caused by the additional_repos values pulled in by vyos-build/data/defaults.json pinning to amd64 architecture.

I've put together a working fork which applies a workaround of including a custom VYOS_BUILD_FLAVOR JSON file which copies the additional_repos values from defaults.json without the arch pinning: jsimpso@920734f

I'm happy to raise a PR, but not sure if that's the way you want to approach the problem or whether it's better dealt with upstream in vyos-build (I'm not sure how much official support there is for arm64 builds beyond that default flavor config being there).

Thanks!

Build of live-image-arm64.hybrid.iso failed.

Hi,

apparently building live-image-arm64.hybrid.iso seem to fail.

I ran the following command:

$ sudo docker run --rm -it --platform arm64 --privileged \
        -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static \
        -v "$(pwd)":/vyos \
        -v /dev:/dev \
        --sysctl net.ipv6.conf.lo.disable_ipv6=0 vyos/vyos-build:current-arm64 /bin/bash \
        -c 'cd /vyos; /bin/bash -x build-image.sh'

The result is as follows:

Current UID/GID: 0/0
+ set -x
+ set -e
++ pwd
+ ROOTDIR=/vyos
+ rm -rf vyos-build
+ git clone http://github.com/vyos/vyos-build vyos-build
Cloning into 'vyos-build'...
warning: redirecting to https://github.com/vyos/vyos-build/
remote: Enumerating objects: 11133, done.
remote: Counting objects: 100% (589/589), done.
remote: Compressing objects: 100% (280/280), done.
remote: Total 11133 (delta 309), reused 472 (delta 275), pack-reused 10544
Receiving objects: 100% (11133/11133), 7.39 MiB | 9.92 MiB/s, done.
Resolving deltas: 100% (6602/6602), done.
++ find build -type f -name '*.deb'
++ grep -v -e -dbgsym_ -e libnetfilter-conntrack3-dbg
find: ‘build’: No such file or directory
+ cd vyos-build
+ echo 'Copy new default configuration to the vyos image'
Copy new default configuration to the vyos image
+ cp /vyos/config.boot.default data/live-build-config/includes.chroot/opt/vyatta/etc/config.boot.default
+ VYOS_BUILD_FLAVOR='data/generic-arm64.json ./configure'
+ make iso
[2022-12-15 12:38:32] lb clean 
P: Cleaning chroot
set -o pipefail
./build-vyos-image iso
exit 0
I: Checking if packages required for VyOS image build are installed
build/config
I: Cleaning the build workspace
[2022-12-15 12:38:37] lb clean 
P: Cleaning chroot
I: Setting up additional APT entries
I: Configuring live-build
[2022-12-15 12:38:39] lb config noauto --architectures amd64 --bootappend-live boot=live components hostname=vyos username=live nopersistence noautologin nonetworking union=overlay console=ttyS0,115200 console=tty0 net.ifnames=0 biosdevname=0 --bootappend-live-failsafe live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal console=ttyS0,115200 console=tty0 net.ifnames=0 biosdevname=0 --linux-flavours amd64-vyos --linux-packages linux-image-5.15.82 --bootloader syslinux,grub-efi --binary-images iso-hybrid --checksums sha256 md5 --debian-installer none --distribution bullseye --iso-application VyOS --iso-publisher root@602803ccb2b2 --iso-volume VyOS --debootstrap-options --variant=minbase --exclude=isc-dhcp-client,isc-dhcp-common,ifupdown --include=apt-utils,ca-certificates,gnupg2 --mirror-bootstrap http://deb.debian.org/debian --mirror-chroot http://deb.debian.org/debian --mirror-chroot-security http://deb.debian.org/debian-security --mirror-binary http://deb.debian.org/debian --mirror-binary-security http://deb.debian.org/debian-security --archive-areas main contrib non-free --firmware-chroot false --firmware-binary false --updates true --security true --backports true --apt-recommends false --apt-options --yes -oAPT::Get::allow-downgrades=true --apt-indices false
P: Updating config tree for a debian/bullseye/amd64 system
P: Symlinking hooks...
I: Starting image build
[2022-12-15 12:38:43] lb build 
P: live-build 20210407
P: Building for a debian/bullseye/amd64 system
[2022-12-15 12:38:44] lb bootstrap 
P: Setting up clean exit handler
[2022-12-15 12:38:45] lb bootstrap_cache restore
W: skipping /usr/lib/live/build/bootstrap_cache, foreign architecture(s).
[2022-12-15 12:38:46] lb bootstrap_debootstrap 
W: skipping /usr/lib/live/build/bootstrap_debootstrap, foreign architecture(s).
[2022-12-15 12:38:47] lb bootstrap_cache save
W: skipping /usr/lib/live/build/bootstrap_cache, foreign architecture(s).
[2022-12-15 12:38:48] lb chroot_prep install all-except-archives
E: the following stage is required to be done first: bootstrap
E: An unexpected failure occurred, exiting...

What am I doing wrong?

make iso-* failed: unknown flag: --arch

Hi,

apparently building an image using the Makefile does not seem to work:

$ make iso-local
sudo docker run --rm -it --arch arm64 --privileged -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static -v "/tmp/vyos-pi-builder":/vyos -v /dev:/dev --sysctl net.ipv6.conf.lo.disable_ipv6=0 localhost/vyos/vyos-build:current-arm64 /bin/bash -c 'cd /vyos; /bin/bash -x build-image.sh'
unknown flag: --arch
See 'docker run --help'.
make: *** [Makefile:8: iso-local] Fehler 125

To my knowledge, docker has never had the flags --args. I wonder what I am missing here

Better instructions in README?

I'm thinking of giving this a spin on a couple Pi CM4s, but I think there are some baked in assumptions in the README that someone new to VyOS might not know.

For example, there's a step:

build the vyos-build docker container as vyos/vyos-build:current-arm64

But I'm not quite sure where the Dockerfile for that is (is it in this repo, or elsewhere?), nor if there are any other things I'd need to do to actually run the build (e.g. configure things for ARM64 vs AMD64).

(I found this repo through geerlingguy/raspberry-pi-pcie-devices#114)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.