diff mbox series

[bug#41350,v2,3/3] system: vm: Build vm-image using native qemu, for the Hurd.

Message ID 87d06sc90t.fsf@gnu.org
State Accepted
Headers show
Series None | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Janneke Nieuwenhuizen May 25, 2020, 3:46 p.m. UTC
Jan Nieuwenhuizen writes:

Hello Mathieu, Ludo',

>>> The most interesting differences I see are wrt Grub, e.g.
>>>
>>> -/mnt/boot/grub/fonts
>>> -/mnt/boot/grub/fonts/unicode.pf2
>>>
>>> could that still play a role?  I'm having a look why this could be missing.
>>
>> It's because I just copy "lib/grub" folder in (gnu bootloader grub). I
>> should also do that for the fonts I guess. But I doubt the issue comes
>> from here.
>
> Meanwhile I tried adding that by hand; indeed that's not it.

As discussed on IRC (thanks!!), I bisected it down to a problem with the
file /servers/exec.  I suspected translator magic...but luckily Ludo
insisted he thinks that /servers/exec only needs to exist.

So, using current wip-hurd-vm, I tried this script:

--8<---------------cut here---------------start------------->8---
set -ex
cp -f $(./pre-inst-env guix system disk-image --no-grafts --target=i586-pc-gnu gnu/system/examples/bare-hurd.tmpl) /tmp/disk-image.img
sudo losetup -P /dev/loop0 /tmp/disk-image.img
sudo mount /dev/loop0p1 /mnt
ls -l /mnt/servers/exec
sudo rm -f /mnt/servers/exec
sudo touch /mnt/servers/exec
ls -l /mnt/servers/exec
sudo umount /mnt
sudo losetup -d /dev/loop0
--8<---------------cut here---------------end--------------->8---

...which indeed produces a working VM!

Turns out that creating /servers/exec in the store gets
hard-linked/deduplicated or something...look:

--8<---------------cut here---------------start------------->8---
+ ls -l /mnt/servers/exec
-r--r--r-- 17 root root 0 Jan  1  1970 /mnt/servers/exec
+ sudo rm -f /mnt/servers/exec
+ sudo touch /mnt/servers/exec
+ ls -l /mnt/servers/exec
-rw-r--r-- 1 root root 0 May 25 17:16 /mnt/servers/exec
--8<---------------cut here---------------end--------------->8---

The "fix" is just going from 17 to 1 link.  Doh'

So, another "fix" is the diff below but I did not want to commit and
push that yet.  Can we prevent creation of hard links in another way?

Greetings,
Janneke


$ git diff
diff mbox series

Patch

diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 7dd509d0d9..dfad83aa05 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -337,6 +337,7 @@  one specific hardware device. These we have to create."
   (for-each (lambda (file)
               (call-with-output-file (scope file)
                 (lambda (port)
+                  (display file port)   ;hack to avoid hard-linking
                   (chmod port #o666))))
             '("dev/null"
               "dev/zero"
@@ -350,6 +351,7 @@  one specific hardware device. These we have to create."
   (for-each (lambda (file)
               (call-with-output-file (scope (string-append "servers/" file))
                 (lambda (port)
+                  (display file port)   ;hack to avoid hard-linking
                   (chmod port #o444))))
             '("startup"
               "exec"