Commit graph

372 commits

Author SHA1 Message Date
Ludovic Courtès 97a46055ca
database: 'register-items' takes an open database.
* guix/store/database.scm (store-database-directory)
(store-database-file): New procedures.
(call-with-database): Add call to 'mkdir-p'.
(register-items): Add 'db' parameter and remove #:state-directory and #:schema.
(register-path): Use 'store-database-file' and 'with-database', and
parameterize SQL-SCHEMA.
* gnu/build/image.scm (register-closure): Likewise.
* gnu/build/vm.scm (register-closure): Likewise.
* guix/scripts/pack.scm (store-database)[build]: Likewise.
2020-06-18 14:48:17 +02:00
Ludovic Courtès 8a02e45d93
shepherd: 'read-pid-file/container' terminates the whole process group.
This mirrors a change made in the Shepherd 0.8.0.  Previously, upon
startup failure, we could have left processes behind.

* gnu/build/shepherd.scm (read-pid-file/container): Kill (- PID) instead
of PID.
2020-06-12 00:04:42 +02:00
Ludovic Courtès b6b95685d0
shepherd: Unblock signals in the child process.
Fixes <https://bugs.gnu.org/41791>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

This change mirrors changes made in the Shepherd 0.8.1, where signals
are blocked in the shepherd process in support of 'signalfd'.  The
regression was introduced with the switch to 0.8.1 in
3f9c62d1a8b345909adaeb22f454ad22554c55a1: child processes would not
receive SIGTERM upon 'herd stop SERVICE'.

* gnu/build/shepherd.scm <top level>: Autoload (shepherd system).
(make-forkexec-constructor/container): Call call to 'sigaction' and
'unblock-signals'.
2020-06-12 00:04:42 +02:00
Royce Strange ea80cdbcea
activation: Fix function call for system activation
* gnu/build/activation.scm (boot-time-system):
Evaluate the linux-command-line thunk for linux systems to boot

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-06-09 10:43:54 +02:00
Mathieu Othacehe 8423c2d309
build: image: Do not call make-essential-device-nodes by default.
Calling "mknod" without root permissions fails. Plus those device nodes do not
appear to be needed to boot.

* gnu/build/image.scm (initialize-root-partition): Do not use
make-essential-device-nodes as default make-device-nodes procedure.
2020-06-09 10:32:19 +02:00
Jan (janneke) Nieuwenhuizen 68d8c09465
gnu: services: Add %hurd-startup-service.
This decouples startup of the Hurd from the "hurd" package, moving the RC
script into SYSTEM.

* gnu/packages/hurd.scm (hurd)[inputs]: Remove hurd-rc-script.
[arguments]: Do not substitute it.  Update "runsystem.sh" to parse kernel
arguments and exec into --system=SYSTEM/rc.
(hurd-rc-script): Move to...
* gnu/services.scm (%hurd-rc-file): ...this new variable.
(hurd-rc-entry): New procedure.
(%hurd-startup-service): Use it in new variable.
* gnu/system.scm (hurd-default-essential-services): Use it.
2020-06-08 14:26:14 +02:00
Jan (janneke) Nieuwenhuizen b37c544196
hurd-boot: Further cleanup of "rc".
* gnu/packages/hurd.scm (hurd-rc-script): Move implementation to ...
* gnu/build/hurd-boot.scm (boot-hurd-system): ...here, new file.
* gnu/build/linux-boot.scm (make-hurd-device-nodes): Move there likewise.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2020-06-08 14:26:14 +02:00
Jan (janneke) Nieuwenhuizen c3fd2df705
system: Support activation service for the Hurd.
* gnu/build/activation.scm (boot-time-system): Use "command-line" for the
Hurd.
* gnu/system.scm (hurd-default-essential-services): Add %boot-service and
%activation-service.
2020-06-08 14:12:20 +02:00
Mathieu Othacehe c77b92859f
image: Add Hurd support.
* gnu/system/image.scm (hurd-disk-image): New exported variable,
(root-offset, root-label): new variables,
(esp-partition, root-partition): adapt accordingly,
(find-image): add Hurd support.
2020-06-08 13:51:18 +02:00
Jan (janneke) Nieuwenhuizen 6cea61f2fa
linux-boot: Update 'make-hurd-device-nodes'.
* gnu/build/linux-boot.scm (make-hurd-device-nodes): Avoid de-duplication of
device mount points; also create mount points for /servers/.
2020-06-08 13:51:18 +02:00
Ludovic Courtès b347723445
vm: 'expression->derivation-in-linux-vm' always returns a native build.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Remove #:target.
[builder]: Use #+.  Don't pass #:target-arm32? and #:target-aarch64? to
'load-in-linux-vm'.
Pass #:target #f to 'gexp->derivation'.
(qemu-image): Adjust accordingly.
* gnu/build/vm.scm (load-in-linux-vm): Remove #:target-aarch64?
and #:target-arm32?.  Define them as local variables.
2020-06-06 23:28:49 +02:00
Mathieu Othacehe 72d1562a4d
build: image: Fix initialize-efi-partition docstring.
* gnu/build/image.scm (initialize-efi-partition): Turn BOOTLOADER-PACKAGE into
GRUB-EFI.
2020-05-29 12:20:15 +02:00
Mathieu Othacehe 05f37c16a3
image: Use grub-efi to install the EFI bootloader.
* gnu/build/image.scm (initialize-efi-partition): Rename bootloader-package
argument to grub-efi.
* gnu/system/image.scm (system-disk-image): Adapt accordingly to pass
grub-efi package.
2020-05-29 08:43:20 +02:00
Mathieu Othacehe 9c1adb2400
image: Add bootloader installation support.
* gnu/build/image.scm (initialize-root-partition): Add bootloader-package and
bootloader-installer arguments. Run the bootloader-installer if defined.
* gnu/system/image.scm (system-disk-image): Adapt the partition initializer
call accordingly.
2020-05-29 08:40:03 +02:00
Mathieu Othacehe bd3716f6fe
image: Add partition file-system options support.
* gnu/image.scm (<partition>)[file-system-options]: New field,
(partition-file-system-options): new exported procedure.
* gnu/system/image.scm (partition->gexp): Adapt accordingly.
* gnu/build/image.scm (sexp->partition): Also adapt accordingly,
(make-ext-image): and pass file-system options to mke2fs.
2020-05-26 17:16:42 +02:00
Mathieu Othacehe 16f9124d1f
build: image: Add support for EXT2 and EXT3 file-systems.
* gnu/build/image.scm (make-ext4-image): Rename to ...
(make-ext-image): ... it, and pass the file-system type to mke2fs,
(make-partition-image): Adapt to call "make-ext-image" if the partition
file-system is prefixed by "ext".
2020-05-26 09:57:10 +02:00
Maxim Cournoyer 281d80d8e5
linux-boot: Refactor boot-system.
The --root option can now be omitted, and inferred from the root file system
declaration instead.

* gnu/build/file-systems.scm (canonicalize-device-spec): Extend to support NFS
directly, and...
* gnu/build/linux-boot.scm (boot-system): ...remove NFS special casing from
here.  Remove nested definitions for root-fs-type, root-fs-flags and
root-fs-options, and bind those inside the let* instead.  Make "--root" take
precedence over the device field string representation of the root file
system.
* doc/guix.texi (Initial RAM Disk): Document that "--root" can be left
unspecified.
2020-05-20 08:30:34 -04:00
Marius Bakke 87a40d7203
Merge branch 'master' into core-updates 2020-05-05 20:43:21 +02:00
Mathieu Othacehe 77f5296236
vm: Remove obsolete procedures.
* gnu/build/vm.scm (install-efi, make-iso9660-image): Remove those procedures
that are now implemented in (gnu build image) module,
(initialize-hard-disk): remove efi support.
* gnu/system/vm.scm (iso9660-image): Remove it,
(qemu-image): adapt it to remove ISO9660 support.
2020-05-05 16:13:55 +02:00
Mathieu Othacehe f19cf27c2b
image: Add a new API.
Raw disk-images and ISO9660 images are created in a Qemu virtual machine. This
is quite fragile, very slow, and almost unusable without KVM.

For all these reasons, add support for host image generation. This implies the
use new image generation mechanisms.

- Raw disk images: images of partitions are created using tools such as mke2fs
  and mkdosfs depending on the partition file-system type. The partition
  images are then assembled into a final image using genimage.

- ISO9660 images: the ISO root directory is populated within the store. GNU
  xorriso is then called on that directory, in the exact same way as this is
  done in (gnu build vm) module.

Those mechanisms are built upon the new (gnu image) module.

* gnu/image.scm: New file.
* gnu/system/image.scm: New file.
* gnu/build/image: New file.
* gnu/local.mk: Add them.
* gnu/system/vm.scm (system-disk-image): Rename to system-disk-image-in-vm.
* gnu/ci.scm (qemu-jobs): Adapt to new API.
* gnu/tests/install.scm (run-install): Ditto.
* guix/scripts/system.scm (system-derivation-for-action): Ditto.
2020-05-05 16:13:53 +02:00
Mathieu Othacehe f8fd115717
build: bootloader: Add install-efi procedure.
* gnu/build/bootloader.scm (install-efi): New procedure copied from (gnu build vm).
(install-efi-loader): New exported procedure, wrapping install-efi.
* gnu/build/vm.scm (initialize-hard-disk): Adapt to use install-efi-loader.
2020-05-05 16:08:33 +02:00
Mathieu Othacehe 892bbea750
build: install: Do not set store GID.
There's no need to set the store GID as is will be done by the guix-daemon,
with the following snippet:

  if (chown(chrootStoreDir.c_str(), 0, buildUser.getGID()) == -1)
        throw SysError(format("cannot change ownership of ‘%1%’") % chrootStoreDir);

* gnu/build/install.scm (directives): Do not set store GID.
2020-05-05 16:08:33 +02:00
Mathieu Othacehe 5990e95b60
build: install: Ignore chown exceptions.
Changing ownership may require root permissions. As image can now be generated
without root permissions (no VM involved), ignore those exceptions.

* gnu/build/install.scm (evaluate-populate-directive): Ignore chown
exceptions.
2020-05-05 16:08:32 +02:00
Danny Milosavljevic bb357c509e
file-systems: Fix UTF-16 handling in initrd.
Follow-up to f73f4b3a2d.

* gnu/build/file-systems.scm (bytevector->u16-list): New procedure.
(utf16->string): New procedure.
2020-05-03 23:04:57 +02:00
Danny Milosavljevic f73f4b3a2d
file-systems: Fix F2FS volume name accessor.
Follow-up to 23b37c3d40.

* gnu/build/file-systems.scm (bytevector-utf16-length): New procedure.
(null-terminated-utf16->string): New procedure.
(f2fs-superblock-volume-name): Use it.
2020-05-03 20:35:50 +02:00
Marius Bakke 50e6c1bf2e
Merge branch 'master' into core-updates 2020-05-02 17:31:28 +02:00
Stefan afc57916e5
linux-boot: Allow the root file system to be mounted via NFS.
* gnu/build/linux-boot.scm (boot-system) Treat a root option with ":/" as an nfs source
and avoid to call 'canonicalize-device-spec' for it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-05-02 16:49:30 +02:00
raingloom 23b37c3d40
file-systems: Add support for F2FS.
* gnu/build/file-systems.scm (%f2fs-endianness): New syntax.
(f2fs-superblock?, read-f2fs-superblock, f2fs-superblock-uuid)
(f2fs-superblock-volume-name, check-f2fs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system): Register them.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-05-02 10:49:24 +02:00
Ludovic Courtès cd45d656f1
vm: Make the device node procedure a parameter.
* gnu/build/vm.scm (root-partition-initializer): Add #:make-device-nodes
parameter and use it.
* gnu/system/vm.scm (qemu-image): Add #:device-node parameter.  Pass
 #:make-device-nodes to 'root-partition-initializer'.
2020-04-11 20:59:40 +02:00
Ludovic Courtès ac61e876a4
linux-boot: Add 'make-hurd-device-nodes'.
* gnu/build/linux-boot.scm (make-hurd-device-nodes): New procedure.
2020-04-11 20:59:20 +02:00
Ludovic Courtès 683cba75ea
linux-boot: 'make-essential-device-nodes' root parameter is optional.
* gnu/build/linux-boot.scm (make-essential-device-nodes): Change 'root'
to an optional parameter.
* gnu/build/vm.scm (root-partition-initializer): Adjust accordingly.
2020-04-11 20:48:12 +02:00
Ludovic Courtès 6a488a3504
vm: Preserve file permissions on /dev.
Previously, when REGISTER-CLOSURES? was false, we'd set all the files
under /dev to #o644, including /dev/null, /dev/zero, etc.

* gnu/build/vm.scm (root-partition-initializer): Call 'reset-timestamps'
separately for /dev, with #:preserve-permissions? #t.
2020-04-11 20:48:12 +02:00
Ludovic Courtès 4d1ff68d73
vm: 'qemu-image' can pass options to the 'mkfs' command.
* gnu/build/vm.scm (<partition>)[file-system-options]: New field.
(create-ext-file-system, create-fat-file-system)
(format-partition): Add #:options and honor it.
(initialize-partition): Pass #:options to 'format-partition'.
* gnu/system/vm.scm (qemu-image): Add #:file-system-options and use it
for the root partition.
2020-04-11 19:22:25 +02:00
Ludovic Courtès 82782d8cec
vm: 'qemu-image' accepts a list of extra populate directives.
* gnu/build/vm.scm (root-partition-initializer): Add #:extra-directives
parameter and pass it to 'populate-root-file-system'.
* gnu/system/vm.scm (qemu-image): Add #:extra-directives parameter and
pass it to 'root-partition-initializer'.
2020-04-11 19:22:25 +02:00
Ludovic Courtès 87241947aa
install: 'populate-root-file-system' can be passed extra directives.
* gnu/build/install.scm (evaluate-populate-directive): Handle 'file'
directives.
(populate-root-file-system): Add #:extras parameter and honor it.
2020-04-11 19:22:25 +02:00
Marius Bakke bdb90df764
Merge branch 'master' into core-updates 2020-04-11 00:10:23 +02:00
Tobias Geerinckx-Rice 26c1bd9dfa
vm: Transparently compress iso9660 images.
* gnu/build/vm.scm (make-iso9660-image): Use the ‘--zisofs’ xorriso
filter at the highest compression settings for supported directories.
2020-04-10 01:52:36 +02:00
Marius Bakke ae0badf5bb
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/admin.scm
	gnu/packages/commencement.scm
	gnu/packages/guile.scm
	gnu/packages/linux.scm
	gnu/packages/package-management.scm
	gnu/packages/pulseaudio.scm
	gnu/packages/web.scm
2020-03-30 12:17:33 +02:00
Marius Bakke 18af687037
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/icu4c.scm
	gnu/packages/man.scm
	gnu/packages/python-xyz.scm
	guix/scripts/environment.scm
	guix/scripts/pack.scm
	guix/scripts/package.scm
	guix/scripts/pull.scm
	guix/store.scm
2020-03-27 00:12:15 +01:00
Ludovic Courtès be6520e6a5
vm: Distinguish between success and failure of the guest code.
Fixes <https://bugs.gnu.org/34276>.
Reported by Tobias Geerinckx-Rice <me@tobias.gr>.

* gnu/system/vm.scm (expression->derivation-in-linux-vm)[loader]:
Produce '/xchg/.exit-status' file upon success.
* gnu/build/vm.scm (load-in-linux-vm): Check for 'xchg/.exit-status'
once QEMU has completed and respond accordingly.
2020-03-26 23:45:41 +01:00
Danny Milosavljevic 5c79f23863
system: Add kernel-loadable-modules to operating-system.
* gnu/system.scm (<operating-system>): Add kernel-loadable-modules.
(operating-system-directory-base-entries): Use it.
* doc/guix.texi (operating-system Reference): Document
KERNEL-LOADABLE-MODULES.
* gnu/build/linux-modules.scm (depmod): New procedure.
(make-linux-module-directory): New procedure.  Export it.
* guix/profiles.scm (linux-module-database): New procedure.  Export it.
* gnu/tests/linux-modules.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]:
Disable depmod.  Remove "build" and "source" symlinks.
[native-inputs]: Remove kmod.
2020-03-22 12:51:50 +01:00
Marius Bakke ebb7cf9e21
Merge branch 'master' into core-updates 2020-03-04 23:16:17 +01:00
Maxim Cournoyer 85a7466e22
build: file-systems: Do not warn about file system check for NFS.
* gnu/build/file-systems.scm (check-file-system): Define a dummy checker
procedure for NFS that always passes to prevent a warning from being emitted.
2020-03-02 23:59:45 -05:00
Maxim Cournoyer cc9b889e8f
linux-boot: Ensure volatile root is mounted read-only.
* gnu/build/linux-boot.scm (mount-root-file-system): Ensure MS_RDONLY is
present among the root file system flags when VOLATILE-ROOT? is #t.
2020-03-02 23:24:47 -05:00
Ludovic Courtès b6ec284fe8
marionette: Provide portable US-layout keystrokes for "<" and ">".
* gnu/build/marionette.scm (%qwerty-us-keystrokes): Use shit-comma and
shift-dot for #\< and #\> because the "less" key doesn't work the same
in "US intl." layouts.
2020-02-22 00:45:42 +01:00
Ludovic Courtès 1708ed6e9d
marionette: 'wait-for' procedures no longer leak a port.
* gnu/build/marionette.scm (wait-for-tcp-port): Close SOCK upon
success.
(wait-for-unix-socket): Likewise.
2020-02-22 00:45:42 +01:00
Ludovic Courtès 89da127035
gnu: cross-base: Switch back to 'CROSS_C_INCLUDE_PATH' & co.
This is a followup to 2073b55e6b.

* gnu/build/cross-toolchain.scm (%gcc-include-paths): Switch back to
'C_INCLUDE_PATH' & co.
* gnu/packages/cross-base.scm (%gcc-include-paths): Likewise.
(cross-gcc-arguments): Remove 'treat-glibc-as-system-header' phase.
(cross-gcc)[native-inputs]: Reorder so that libc comes last.
[search-paths]: Add "include/c++" for 'CROSS_CPLUS_INCLUDE_PATH'.
* guix/build-system/gnu.scm (standard-cross-packages): Have "cross-gcc"
appear both for 'host and 'target.
2020-02-12 20:35:43 +01:00
kanichos@yandex.ru 83460433b9
activation: Check whether /proc/sys/kernel/modprobe exists.
* gnu/build/activation.scm (activate-modprobe): Check whether
/proc/sys/kernel/modprobe exists before writing to it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2020-01-06 16:31:54 +01:00
David Trudgian 7aa28eb339
file-systems: Handle LUKS2 header.
* gnu/build/file-systems.scm (luks-superblock?): Handle LUKS2 header.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
2020-01-05 11:14:00 +01:00
Tobias Geerinckx-Rice 1abbe7c64b
file-systems: Add support for JFS.
* gnu/build/file-systems.scm (%jfs-endianness): New syntax.
(jfs-superblock?, read-jfs-superblock, jfs-superblock-uuid)
(jfs-superblock-volume-name, check-jfs-file-system): New procedures.
(%partition-label-readers, %partition-uuid-readers, check-file-system):
Register them.
2020-01-03 13:54:13 +01:00