Commit Graph

98 Commits

Author SHA1 Message Date
ng0 de975de39b
gnu: build: file-system: Change url of LUKS specification.
* gnu/build/file-system.scm: Change url of LUKS specification.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
2016-11-06 14:35:36 +02:00
Ludovic Courtès 49baaff4d2
file-systems: 'disk-partitions' detected partitions from mapped devices.
Previously, partitions of mdadm- or cryptsetup-produced block devices
would not be returned by 'disk-partitions'.

* gnu/build/file-systems.scm (disk-partitions)[last-character]: New
procedure.
[partition?]: Add 'name' parameter and rewrite.  Adjust caller.
* gnu/build/file-systems.scm (ENOENT-safe): Silently ignore ENOMEDIUM.
2016-10-27 13:48:52 +02:00
Ludovic Courtès 8ce84bf1f5
svg: Autoload Guile-RSVG and Guile-Cairo.
Fixes compilation by 'guix pull' where Guile-{RSVG,Cairo} are missing.
Reported by Efraim Flashner.

* gnu/build/svg.scm: Use 'module-autoload!' rather than 'module-use!'.
2016-10-25 13:57:28 +02:00
Ludovic Courtès ffde82c9ec
system: grub: Use Guile-{RSVG,Cairo} instead of Inkscape + ImageMagick.
Based on a suggestion by Andy Wingo at
<https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00753.html>.

* gnu/build/svg.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* gnu/system/grub.scm (svg->png): Add #:width and #:height.  Rewrite to
use (gnu build svg).
(resize-image): Remove.
(grub-background-image): Adjust accordingly.
2016-10-25 01:21:28 +02:00
Ludovic Courtès 7fee5b5397
container: Allow 'container-excursion' to the same namespaces.
Before that, 'container-excursion' would call 'setns' even when the
target namespace is the one the caller is already in, which would fail.

* gnu/build/linux-container.scm (container-excursion): Introduce
'source' and 'target'.  Compare the result of 'readlink' on these
instead of comparing file descriptors to decide whether to call
'setns'.
* tests/containers.scm ("container-excursion, same namespace"): New test.
2016-10-19 15:54:10 +02:00
Leo Famulari a7199b7d99
activation: Don't fail if /var/lib exists.
This is a followup to commit 6526d43ea4.

* gnu/build/activation.scm (activate-user+groups): Use mkdir-p to create
/var/lib.
2016-09-06 14:41:48 -04:00
David Craven 6526d43ea4
activation: Allow home directories to be created under /var/lib.
* gnu/build/activation.scm (activate-user+groups): Make sure /var/lib
  exists.
2016-09-06 17:48:59 +02:00
Ludovic Courtès 2ff0da0257
file-systems: Always use (guix build syscalls).
* gnu/build/file-systems.scm: Use (guix build syscalls)
unconditionally.  Override the 'mount' and 'umount' bindings
when (guile) provides them.
(MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC, MS_REMOUNT)
(MS_BIND, MS_MOVE): Remove.
* guix/build/syscalls.scm (%libc-errno-pointer): Add
'false-if-exception' around 'dynamic-func'.
2016-09-05 00:06:47 +02:00
Ludovic Courtès 334bda9a9e
tests: Make sure /var/guix/gcroots/profiles is a valid symlink.
Reported by csanchezdll@gmail.com (Carlos Sánchez de La Lama)
at <https://lists.gnu.org/archive/html/guix-devel/2016-08/msg01641.html>.

* gnu/build/install.scm (directives): Add /var/guix/gcroots/profiles
symlink.
* gnu/tests/base.scm (run-basic-test)["/var/guix/gcroots/profiles is a
valid symlink"]: New test.
2016-08-29 00:09:44 +02:00
Ludovic Courtès eb56ee027b
system: Add 'create-home-directory?' field to <user-account>.
* gnu/system/shadow.scm (<user-account>)[create-home-directory?]: New
field.
(user-account->gexp): Serialize it.
* gnu/build/activation.scm (activate-users+groups)[activate-user]:
Update 'match-lambda' pattern accordingly.  Pass #:create-home? to
'ensure-user'.
(add-user, modify-user, ensure-user): Add #:create-home? parameter and
honor it.
* doc/guix.texi (User Accounts): Document it.
2016-08-28 15:11:18 +02:00
Ludovic Courtès b1dd6ac55d
vm: 'qemu-command' honors its argument.
* gnu/build/vm.scm (qemu-command): Refer to SYSTEM rather than
%HOST-TYPE in the body.
2016-06-20 23:50:46 +02:00
Ludovic Courtès c06f6db7a4
container: Gracefully report mount errors in the child process.
Fixes <http://bugs.gnu.org/23306>.

* gnu/build/linux-container.scm (run-container): Use 'socketpair'
instead of 'pipe'.  Rename 'in' to 'child' and 'out' to 'parent'.  Send
a 'ready message or an exception argument list from the child to the
parent; adjust the parent accordingly.
* tests/containers.scm ("call-with-container, mnt namespace, wrong bind
mount"): New test.
* tests/guix-environment-container.sh: Add test with
--expose=/does-not-exist.
2016-05-31 00:11:04 +02:00
Ludovic Courtès 4c14d4eaa7
container: Gracefully handle failure to set up user namespaces.
* gnu/build/linux-container.scm (run-container): Exit when the parent
process doesn't say 'ready.
2016-05-31 00:11:04 +02:00
Ludovic Courtès 957afcae3c
Add (gnu tests) and (gnu build marionette).
* gnu/build/marionette.scm, gnu/tests.scm: New files.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add them.
* gnu/system/vm.scm (common-qemu-options): Remove '-serial stdio'.
2016-05-04 23:35:55 +02:00
Ludovic Courtès a1ccefaa12 file-systems: Add 'find-partition-by-luks-uuid'.
* gnu/build/file-systems.scm (%luks-endianness, %luks-header-size): New
macros.
(%luks-magic): New variable.
(sub-bytevector, read-luks-header, luks-header-uuid): New procedures.
(partition-predicate): Add 'read' parameter; wrap it with 'ENOENT-safe'.
Use it instead of 'read-ext2-superblock*'.
(read-ext2-superblock*): Remove.
(partition-label-predicate, partition-uuid-predicate): Pass
'read-ext2-superblock' as the first argument.
(partition-luks-uuid-predicate): New variable.
(find-partition-by-luks-uuid): New procedure.
2016-04-17 01:23:52 +02:00
Ludovic Courtès 2447335625 file-systems: Separate ENOENT catching from ext2 superblock reads.
* gnu/build/file-systems.scm (ENOENT-safe): New procedure.
(read-ext2-superblock*): Rewrite in terms of it.
2016-04-17 01:23:52 +02:00
Ludovic Courtès 2fa909b27b activation: Copy account skeletons silently.
* gnu/build/activation.scm (copy-account-skeletons): Pass #:log to
'copy-recursively'.
2016-03-24 22:47:15 +01:00
Ludovic Courtès 4e8b7502e3 system: Allow account skeletons to be directories.
* gnu/system/shadow.scm (skeleton-directory): Use 'copy-recursively'
instead of 'copy-file'.
* gnu/build/activation.scm (copy-account-skeletons): Likewise.
2016-03-20 15:02:38 +01:00
Ricardo Wurmus e1a5615875 build: reset-timestamps: Include directories.
* guix/build/install.scm (reset-timestamps): Reset timestamps of
  directories as well.
2016-03-14 12:36:49 +01:00
Christopher Allan Webber 944d2b17b5 vm: Only pass "-enable-kvm" to qemu if /dev/kvm is present.
Fixes <http://bugs.gnu.org/22633>.

* gnu/build/vm.scm (load-in-linux-vm): Only pass "-enable-kvm" flag to qemu
  if "/dev/kvm" is present.
* gnu/system/vm.scm (common-kvm-options): Same as above.
2016-02-22 13:28:58 -08:00
Ludovic Courtès 5c7dd5ac3a linux-modules: Use normalized module names for 'modprobe.blacklist'.
* gnu/build/linux-modules.scm (normalize-module-name): New procedure.
(file-name->module-name): Use it.
(module-black-list): Expound docstring.
2016-02-21 13:04:10 +01:00
Ludovic Courtès 6eb439070a file-systems: Spawn a Bournish REPL upon fsck failure.
Fixes <http://bugs.gnu.org/22588>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/build/file-systems.scm (check-file-system): Pass
%BOURNISH-LANGUAGE as the argument to 'start-repl'.
* gnu/services.scm (activation-script): Add (guix build bournish).
* gnu/services/base.scm (file-system-shepherd-service)[imported-modules]:
Likewise.
* gnu/system/linux-container.scm (container-script): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2016-02-08 23:46:46 +01:00
Alex Kost 171a0a13a4 Rename 'dmd' to 'shepherd' in comments and strings.
* build-aux/hydra/demo-os.scm (operating-system)[issue]: Point to
  shepherd instead of dmd.
* ROADMAP: Likewise.
* gnu/build/install.scm (directives): Adjust comment.
2016-01-29 20:21:54 +03:00
Alex Kost b8c02c18b4 Rename '/root/etc/dmd' directory and 'do-not-kill' file.
* gnu/services/base.scm (%do-not-kill-file): Rename to
  "/etc/shepherd/do-not-kill".
* gnu/build/linux-boot.scm (mount-root-file-system): Rename
  "/root/etc/dmd" to "/root/etc/shepherd".
2016-01-29 20:20:19 +03:00
Mark H Weaver c5184468f5 build: container: Make 'unprivileged-user-namespace-supported?' more robust.
* gnu/build/linux-container.scm (unprivileged-user-namespace-supported?): Only
  read and check the first character, to cope with a possible newline in the
  (pseudo-)file.
2016-01-23 18:44:03 -05:00
Ludovic Courtès 7ba903b6db linux-modules: Support 'modprobe.blacklist' on the command line.
* gnu/build/linux-modules.scm (file-name->module-name)
(module-black-list): New procedure.
* gnu/build/linux-modules.scm (load-linux-module*): Add #:black-list
parameter.
[black-listed?, load-dependencies]: New procedures.
Use them.
2016-01-16 14:45:47 +01:00
Ludovic Courtès fb74174958 linux-boot: Remove verbose output for module loads.
* gnu/build/linux-boot.scm (boot-system): Leave
'current-module-debugging-port' unchanged.
* gnu/build/linux-modules.scm (load-linux-module*): Update comment about
'mmap'.
2016-01-05 00:28:42 +01:00
Ludovic Courtès f453f637d5 system: Allow the root file system to be named by UUID.
* gnu/build/file-systems.scm (canonicalize-device-spec)[canonical-title]:
Use 'string->uuid' to check whether SPEC is a UUID.
When SPEC is a string and CANONICAL-TITLE is 'uuid, call 'string->uuid'.
* gnu/system.scm (operating-system-grub.cfg): Add 'root-device'
variable and use it for the "--root=" argument.
2016-01-01 22:50:26 +01:00
Ludovic Courtès f8865db6a0 file-systems: Move 'string->uuid' to the build side.
* gnu/system/file-systems.scm (%uuid-rx, string->uuid): Move to...
* gnu/build/file-systems.scm (%uuid-rx, string->uuid): ... here.  New
variables.
2016-01-01 22:41:35 +01:00
David Thompson b7d48312bb build: container: Add feature test predicates.
* gnu/build/linux-container.scm (user-namespace-supported?,
  unprivileged-user-namespace-supported?, setgroups-supported?): New
  procedures.
* tests/container.scm: Use predicates.
* tests/syscalls.scm: Likewise.
2015-11-03 11:41:04 -05:00
Ludovic Courtès 35b50a7535 container: Remove unnecessary CLONE_CHILD_* flags.
* gnu/build/linux-container.scm (namespaces->bit-mask): Remove
  CLONE_CHILD_CLEARTID and CLONE_CHILD_SETTID, which are unneeded.
  Discussed at <http://bugs.gnu.org/21694>.
2015-10-28 15:31:44 +01:00
Ludovic Courtès 78981bb9bd file-systems: Do not truncate mount points that already exist.
Reported by David Thompson <dthompson2@worcester.edu>
at <https://lists.gnu.org/archive/html/guix-devel/2015-10/msg00284.html>.

* gnu/build/file-systems.scm (mount-file-system): When SOURCE matches
  'regular-file?', do not create MOUNT-POINT if it already exists.  This
  fixes a bug whereby we would be truncating MOUNT-POINT if it already
  existed.
2015-10-17 11:57:38 +02:00
David Thompson a72ccbc251 build: container: Fix call-with-clean-exit.
Before, call-with-clean-exit would *always* return an exit code of 1.

* gnu/build/linux-container.scm (call-with-clean-exit): Exit with status
  code of 0 if thunk does not throw an exception.
* tests/containers.scm: Add test.
2015-10-10 09:00:49 -04:00
Ludovic Courtès cc0e575a94 linux-boot: Mount /dev as a devtmpfs from the start.
Suggested by Petter <petter@mykolab.ch>
and Mark H Weaver <mhw@netris.org>.
Reported by Duncan Keall <duncan@duncankeall.com>.

Partly fixes <http://bugs.gnu.org/19190> by populating /dev/mapper
early enough.

* gnu/build/linux-boot.scm (mount-essential-file-systems): Mount /dev as
  a devtmpfs.
  (move-essential-file-systems): Add /dev.
  (mount-root-file-system): Mount /rw-root/dev as a devtmpfs instead of
  calling 'make-essential-device-nodes'.
  (boot-system): Remove call to 'make-essential-device-nodes'.
* gnu/system/file-systems.scm (%devtmpfs-file-system): Remove.
* doc/guix.texi (File Systems): Adjust accordingly.
2015-09-20 22:05:36 +02:00
Ludovic Courtès 0334ef2ab0 linux-initrd: Compress cpio archives deterministically.
* gnu/build/linux-initrd.scm (write-cpio-archive): Use '--no-name'.
2015-09-09 23:27:10 +02:00
David Thompson ee78d02452 build: container: Use the same clone flags as fork(3).
The intent is to make 'clone' behave a lot more like 'primitive-fork', which
calls clone(2) with SIGCHLD, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
flags.  Notably, running 'clone' at the REPL without these flags would break
the REPL beyond repair.

* guix/build/syscalls.scm (CLONE_CHILD_CLEARTID, CLONE_CHILD_SETTID): New
  variables.
* gnu/build/linux-container.scm (namespaces->bit-mask): Add
  CLONE_CHILD_CLEARTID and CLONE_CHILD_SETTID to bit mask.
2015-09-07 13:09:58 -04:00
David Thompson 4949ada9da build: container: Setup /dev/console.
* gnu/build/linux-container.scm (mount-file-systems): Bind mount the
  controlling terminal as /dev/console.
2015-09-07 13:09:58 -04:00
David Thompson 831bc1468e build: container: Add #:host-uids argument to call-with-container.
It's not always possible to map 65536 uids when creating a container as the
root user within another user namespace.  This is true when building Guix
within the build daemon's container.  By using a uid range of 1 by default,
even as the root user, the tests now pass.

* gnu/build/linux-container.scm (initialize-user-namespace, run-container):
  Add 'host-uids' argument.
  (call-with-container): Add #:host-uids keyword argument.
* tests/containers.scm ("container-excursion"): Update 'run-container' call.
2015-08-08 14:04:13 -04:00
David Thompson 8c812f2aee build: file-systems: Allow for bind mounting regular files.
* gnu/build/file-systems.scm (regular-file?): New procedure.
  (mount-file-system): Create a regular file instead of a directory when bind
  mounting a regular file.
2015-08-08 14:04:00 -04:00
Ludovic Courtès 72b891e50e vm: Make the list of partitions to build a parameter.
* gnu/build/vm.scm (<partition>): New record type.
  (fold2): New procedure.
  (initialize-partition-table): Remove #:bootable? and
  'partition-size' parameters.  Add 'partitions' parameter.  Invoke 'parted'
  with '--script'.
  (initialize-root-partition): Remove.
  (initialize-partition, root-partition-initializer): New procedures.
  (initialize-hard-disk): Remove #:system-directory, #:disk-image-size,
  #:file-system-type, #:file-system-label, #:closures, #:copy-closures?,
  #:bootable?, and #:register-closures? parameters.  Add #:partitions.
  Rewrite to use 'initialize-partition' for each item of PARTITIONS.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Add (guix records)
  to #:modules default value.
  (qemu-image): Adjust accordingly.
2015-07-26 00:57:44 +02:00
Ludovic Courtès ec2406efc7 vm: Use the 'umount' procedure instead of util-linux's 'umount' command.
* gnu/build/vm.scm (initialize-root-partition, initialize-hard-disk): Use the
  'umount' procedure instead of invoking the 'umount' command.
* gnu/system/vm.scm (qemu-image): Remove UTIL-LINUX from INPUTS.
2015-07-24 01:19:57 +02:00
Ludovic Courtès 0ec5ee9486 file-systems: Implement partition lookup by UUID.
* gnu/build/file-systems.scm (read-ext2-superblock*, partition-predicate): New
  procedures.
  (partition-label-predicate): Rewrite in terms of 'partition-predicate'.
  (partition-uuid-predicate, find-partition-by-uuid, uuid->string): New
  procedures.
  (%network-byte-order): New macro.
  (canonicalize-device-spec)[canonical-title]: Check whether SPEC is a string.
  [resolve]: New procedure.
  Add 'uuid' case and use it.
2015-07-14 15:24:19 +02:00
Ludovic Courtès 2de3cd8972 file-systems: Use (guix build syscalls) at build time if needed.
* gnu/build/file-systems.scm: Wrap 'module-use!' statement in 'eval-when'.
2015-07-14 15:24:18 +02:00
David Thompson c1f6a0c2ed gnu: build: Add Linux container module.
* gnu/build/linux-container.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* .dir-locals.el: Add Scheme indent rules for 'call-with-container', and
  'container-excursion'.
* tests/containers.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2015-07-09 08:23:03 -04:00
David Thompson 85c3127fa9 build: file-systems: Import (guix build syscalls) for non-static Guiles.
* gnu/build/file-systems.scm: Import (guix build syscalls) when 'mount' is not
  defined.
* gnu/system.scm (operating-system-activation-script): Include (guix build
  syscalls) module in derivation.
2015-07-09 08:23:03 -04:00
Ludovic Courtès eae5b3fff5 linux-initrd: Produce cpio archives with zeroed timestamps, etc.
* guix/cpio.scm (file->cpio-header*): New procedure.
* gnu/build/linux-initrd.scm (write-cpio-archive): Add #:file->header argument
  to 'cpio:write-cpio-archive'.
2015-06-24 18:05:03 +02:00
Ludovic Courtès 583323ca1d linux-initrd: Populate cpio archives in a deterministic order.
* gnu/build/linux-initrd.scm (write-cpio-archive)[files]: Use 'sort' instead
  of 'reverse'.
2015-06-24 18:05:03 +02:00
Ludovic Courtès e8277f90c8 linux-initrd: Use (guix cpio) instead of GNU cpio.
* gnu/build/linux-initrd.scm (write-cpio-archive): Remove 'open-pipe*' and
  related calls.  Compute list of files in 'files' variable.  Use
  'cpio:write-cpio-archive'.  Remove #:cpio parameter.
  (build-initrd): Remove #:cpio parameter.
* gnu/system/linux-initrd.scm (expression->initrd): Likewise, and adjust
  BUILDER accordingly.  Add (guix cpio) to #:modules.
2015-06-24 18:05:03 +02:00
David Thompson 5fd77f3f43 gnu: Make 'mount' interface in static Guile consistent with Guix API.
Rather than expecting a pointer, the version of 'mount' in
guile-static-stripped now takes a string for the 'options' argument, just like
the 'mount' procedure in (guix build syscalls).

* gnu/packages/patches/guile-linux-syscalls.patch (mount): Expect a string or
  #f for 'options' argument.
* gnu/build/file-systems.scm (mount-file-system): Use new 'mount' interface.
2015-06-19 07:49:18 -04:00
Ludovic Courtès 08fa76131e install: Turn off deduplication for the binary tarball.
* gnu/build/install.scm (register-closure): Add #:deduplicate? parameter and
  honor it.
  (populate-single-profile-directory): Likewise.
* gnu/system/install.scm (self-contained-tarball): Pass #:deduplicate? #f.
  Invoke tar with --check-links.
2015-06-18 00:25:48 +02:00