New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch Linux template fails to build #2557

Closed
lokedhs opened this Issue Jan 6, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@lokedhs

lokedhs commented Jan 6, 2017

Qubes OS version (e.g., R3.2):

Qubes OS version r3.2.

Affected TemplateVMs (e.g., fedora-23, if applicable):

Attempting to build Arch Linux template using fedora-23

I was following the instructions on the following page: https://www.qubes-os.org/doc/templates/archlinux/

Everything went well until the stop that involves me running make qubes-vm. It runs for a while and then fails. The end of the log looks like this:

--> Archlinux dist-prepare-chroot (makefile):
  --> Checking mounting of dev/proc/sys on build chroot...
    --> sudo mount -t proc proc /home/user/qubes-builder/chroot-archlinux/proc;
    --> sudo mount --bind /dev /home/user/qubes-builder/chroot-archlinux/dev;
    --> sudo mount --bind /dev/pts /home/user/qubes-builder/chroot-archlinux/dev/pts;
    --> sudo mount --bind /sys /home/user/qubes-builder/chroot-archlinux/sys;
    --> sudo mount --bind /home/user/qubes-builder/cache/archlinux/pacman_cache /home/user/qubes-builder/chroot-archlinux/var/cache/pacman;
    --> sudo mount --bind /home/user/qubes-builder/qubes-packages-mirror-repo/archlinux /home/user/qubes-builder/chroot-archlinux/tmp/qubes-deb;
  --> Synchronize resolv.conf, in case it changed since last run...
-> Building vmm-xen (archlinux) for archlinux vm (logfile: build-logs/vmm-xen-vm-archlinux.log)
--> Done:
      qubes-src/vmm-xen/pkgs/qubes-vm-xen-4.6.3-24-x86_64.pkg.tar.xz
--> Archlinux dist-prepare-chroot (makefile):
  --> Checking mounting of dev/proc/sys on build chroot...
  --> Synchronize resolv.conf, in case it changed since last run...
-> Building core-vchan-xen (archlinux) for archlinux vm (logfile: build-logs/core-vchan-xen-vm-archlinux.log)
--> Done:
      qubes-src/core-vchan-xen/pkgs/qubes-libvchan-xen-3.2.0-2-x86_64.pkg.tar.xz
--> Archlinux dist-prepare-chroot (makefile):
  --> Checking mounting of dev/proc/sys on build chroot...
  --> Synchronize resolv.conf, in case it changed since last run...
-> Building core-qubesdb (archlinux) for archlinux vm (logfile: build-logs/core-qubesdb-vm-archlinux.log)
--> Done:
      qubes-src/core-qubesdb/pkgs/qubes-db-vm-3.2.3-3-x86_64.pkg.tar.xz
--> Archlinux dist-prepare-chroot (makefile):
  --> Checking mounting of dev/proc/sys on build chroot...
  --> Synchronize resolv.conf, in case it changed since last run...
-> Building linux-utils (archlinux) for archlinux vm (logfile: build-logs/linux-utils-vm-archlinux.log)
--> Done:
      qubes-src/linux-utils/pkgs/qubes-vm-kernel-support-3.2.3-5-x86_64.pkg.tar.xz
      qubes-src/linux-utils/pkgs/qubes-vm-utils-3.2.3-5-x86_64.pkg.tar.xz
--> Archlinux dist-prepare-chroot (makefile):
  --> Checking mounting of dev/proc/sys on build chroot...
  --> Synchronize resolv.conf, in case it changed since last run...
-> Building core-agent-linux (archlinux) for archlinux vm (logfile: build-logs/core-agent-linux-vm-archlinux.log)
--> build failed!
Compiling 'py3/xdg.py'...
python3 -O -m compileall py3
Listing 'py3'...
Compiling 'py3/dnf-qubes-hooks.py'...
Compiling 'py3/xdg.py'...
gcc -o close-window close-window.c -lX11
==> Entering fakeroot environment...
==> Starting package()...
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/etc/qubes-rpc
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qrexec-agent /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
install qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec-client-vm
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec_client_vm
install qrexec-fork-server /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qubes-rpc-multiplexer /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
cat: version: No such file or directory
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init
# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 init/*.sh vm-systemd/*.sh /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init/
install: cannot stat 'init/*.sh': No such file or directory
make: *** [Makefile:99: install-init] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
/home/user/qubes-builder/qubes-src/builder-archlinux/Makefile.archlinux:120: recipe for target 'dist-package' failed
make[2]: *** [dist-package] Error 2
Makefile.generic:139: recipe for target 'packages' failed
make[1]: *** [packages] Error 1
Makefile:209: recipe for target 'core-agent-linux-vm' failed
make: *** [core-agent-linux-vm] Error 1
@rdhammond

This comment has been minimized.

Show comment
Hide comment
@rdhammond

rdhammond Jan 7, 2017

I was struggling with this, too, until I came up with a workaround last night After the build gets to this point and fails, edit this file (assuming your username is user and you cloned qubes-builder under your home dir):

/home/user/qubes-buidler/chroot-archlinux/home/user/qubes-src/core-agent-linux/Makefile

Look for:

# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 init/*.sh vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
install -m 0644 init/functions $(DESTDIR)$(LIBDIR)/qubes/init/

Change to:

# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 /home/user/qubes-src/core-agent-linux/init/*.sh vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
install -m 0644 /home/user/qubes-src/core-agent-linux/init/functions $(DESTDIR)$(LIBDIR)/qubes/init/

Note that the paths in the replacement code are correct. They're relative to the chroot, not your normal tree. After that, go back to your normal qubes-builder dir, run make core-agent-linux, and it should behave. The remaining build targets seem to go off without a hitch.

Explanation: As far as I can tell, the install command(s) above are somehow running under a different working path than the script expects; it doesn't find ./init and bails out. Forcing the path seems to fix it, but considering there's a giant FIXME in front, it's probably not a coincidence. :) I have zero clue where the stuff for Arch comes from, though, since the Makefile is kind of a black box to me and Qubes the build process seems insanely complex. If someone can point me at the right place---or just take the changes above and run with them---I'd appreciate it. This was a really frustrating one for me because I love Arch, so hopefully all this helps.

I was struggling with this, too, until I came up with a workaround last night After the build gets to this point and fails, edit this file (assuming your username is user and you cloned qubes-builder under your home dir):

/home/user/qubes-buidler/chroot-archlinux/home/user/qubes-src/core-agent-linux/Makefile

Look for:

# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 init/*.sh vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
install -m 0644 init/functions $(DESTDIR)$(LIBDIR)/qubes/init/

Change to:

# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 /home/user/qubes-src/core-agent-linux/init/*.sh vm-systemd/*.sh $(DESTDIR)$(LIBDIR)/qubes/init/
install -m 0644 /home/user/qubes-src/core-agent-linux/init/functions $(DESTDIR)$(LIBDIR)/qubes/init/

Note that the paths in the replacement code are correct. They're relative to the chroot, not your normal tree. After that, go back to your normal qubes-builder dir, run make core-agent-linux, and it should behave. The remaining build targets seem to go off without a hitch.

Explanation: As far as I can tell, the install command(s) above are somehow running under a different working path than the script expects; it doesn't find ./init and bails out. Forcing the path seems to fix it, but considering there's a giant FIXME in front, it's probably not a coincidence. :) I have zero clue where the stuff for Arch comes from, though, since the Makefile is kind of a black box to me and Qubes the build process seems insanely complex. If someone can point me at the right place---or just take the changes above and run with them---I'd appreciate it. This was a really frustrating one for me because I love Arch, so hopefully all this helps.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jan 7, 2017

Member

This is already fixed here: QubesOS/qubes-core-agent-linux#32

Member

marmarek commented Jan 7, 2017

This is already fixed here: QubesOS/qubes-core-agent-linux#32

@marmarek marmarek closed this Jan 7, 2017

@rdhammond

This comment has been minimized.

Show comment
Hide comment
@rdhammond

rdhammond Jan 7, 2017

It looks like app-linux-split-gpg is also missing an (Arch) dependency, which is killing the build. I'll file a separate ticket.

It looks like app-linux-split-gpg is also missing an (Arch) dependency, which is killing the build. I'll file a separate ticket.

@cryptix

This comment has been minimized.

Show comment
Hide comment
@cryptix

cryptix Jan 9, 2017

I just ran into this again following the docs instructions.

...
==> Starting package()...
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/etc/qubes-rpc
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qrexec-agent /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
install qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec-client-vm
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec_client_vm
install qrexec-fork-server /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qubes-rpc-multiplexer /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
cat: version: No such file or directory
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init
# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 init/*.sh vm-systemd/*.sh /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init/
install: cannot stat 'init/*.sh': No such file or directory
make: *** [Makefile:99: install-init] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
/home/user/qubes-builder/qubes-src/builder-archlinux/Makefile.archlinux:120: recipe for target 'dist-package' failed
make[2]: *** [dist-package] Error 2
Makefile.generic:139: recipe for target 'packages' failed
make[1]: *** [packages] Error 1
Makefile:209: recipe for target 'core-agent-linux-vm' failed
make: *** [core-agent-linux-vm] Error 1
[user@archdev qubes-builder]$ 

I'm not familiar with the build process here but maybe make get-sources doesn't fetch latest?

edit: the fix in QubesOS/qubes-core-agent-linux#32 worked for me(tm) and resulted in a template that created a now running vm.

cryptix commented Jan 9, 2017

I just ran into this again following the docs instructions.

...
==> Starting package()...
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/etc/qubes-rpc
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qrexec-agent /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
install qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec-client-vm
ln -s ../../bin/qrexec-client-vm /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/qrexec_client_vm
install qrexec-fork-server /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/bin
install qubes-rpc-multiplexer /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes
cat: version: No such file or directory
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
/bin/bash: lsb_release: command not found
install -d /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init
# FIXME: do a source code move vm-systemd/*.sh to init/
# since those scripts are shared between sysvinit and systemd.
install -m 0755 init/*.sh vm-systemd/*.sh /home/user/qubes-src/core-agent-linux/pkg/qubes-vm-core/usr/lib/qubes/init/
install: cannot stat 'init/*.sh': No such file or directory
make: *** [Makefile:99: install-init] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
/home/user/qubes-builder/qubes-src/builder-archlinux/Makefile.archlinux:120: recipe for target 'dist-package' failed
make[2]: *** [dist-package] Error 2
Makefile.generic:139: recipe for target 'packages' failed
make[1]: *** [packages] Error 1
Makefile:209: recipe for target 'core-agent-linux-vm' failed
make: *** [core-agent-linux-vm] Error 1
[user@archdev qubes-builder]$ 

I'm not familiar with the build process here but maybe make get-sources doesn't fetch latest?

edit: the fix in QubesOS/qubes-core-agent-linux#32 worked for me(tm) and resulted in a template that created a now running vm.

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jan 15, 2017

Member

As discussed in #2578, this is apparently not yet resolved.

Member

andrewdavidwong commented Jan 15, 2017

As discussed in #2578, this is apparently not yet resolved.

@JoranHonig

This comment has been minimized.

Show comment
Hide comment
@JoranHonig

JoranHonig Jan 15, 2017

I was able to fix the issue in #2578 by changing the following file: qubes-src/builder-archlinux/scripts/04_install_qubes.sh line:70
It tries to make a symbolic link that already exists, the following change prevents the script from doing so.

#Before
ln -s ../usr/lib/os-release "${INSTALLDIR}/etc/os-release"
#After
if [ "$(readlink ${INSTALLDIR}/etc/os-release)" != "../usr/lib/os-release"]; then
    ln -s ../usr/lib/os-release "${INSTALLDIR}/etc/os-release"
fi

JoranHonig commented Jan 15, 2017

I was able to fix the issue in #2578 by changing the following file: qubes-src/builder-archlinux/scripts/04_install_qubes.sh line:70
It tries to make a symbolic link that already exists, the following change prevents the script from doing so.

#Before
ln -s ../usr/lib/os-release "${INSTALLDIR}/etc/os-release"
#After
if [ "$(readlink ${INSTALLDIR}/etc/os-release)" != "../usr/lib/os-release"]; then
    ln -s ../usr/lib/os-release "${INSTALLDIR}/etc/os-release"
fi
@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jan 15, 2017

Member

@JoranHonig: Sounds good! Closing as fixed.

Member

andrewdavidwong commented Jan 15, 2017

@JoranHonig: Sounds good! Closing as fixed.

@andrewdavidwong

This comment has been minimized.

Show comment
Hide comment
@andrewdavidwong

andrewdavidwong Jan 15, 2017

Member

@JoranHonig: Please consider submitting a PR with your fix.

Member

andrewdavidwong commented Jan 15, 2017

@JoranHonig: Please consider submitting a PR with your fix.

marmarek added a commit to marmarek/qubes-linux-utils that referenced this issue Jun 14, 2017

initramfs: use symlink for rw root.img, instead of dm-linear
Do not add 1:1 dm-linear when root.img (/dev/xvda) is read-write. This
was to always have root device at /dev/mapper/dmroot, but unfortunately
grub can't parse it properly (fails at looking for partition number of
/dev/xvda1). There was a hack specifically for this, but it caused other
partitions on xvda unavailable.
On the other hand, symlink is enough to be able to mount always the same
device. Now, grub detect that root fs is on /dev/xvda1, which is
enough to have grub2-install working. Unfortunate effect is that it puts
root=/dev/xvda1 at kernel command line, which breaks AppVMs based on
this TemplateVM. But it's easier to fix kernel command line, than grub
device detection logic.

Fixes "initramfs: add support for root.img with partition table"

QubesOS/qubes-issues#2557

@qubesos-bot qubesos-bot referenced this issue in QubesOS/updates-status Jun 24, 2017

Closed

linux-utils v4.0.2 (r4.0) #89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment