Commit Graph

86 Commits

Author SHA1 Message Date
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
Ludovic Courtès
aea9b23213 install: Really overwrite TARGET/var/guix/profiles/system-1-link.
* gnu/build/install.scm (populate-root-file-system): Delete system-1-link
  under TARGET, not under /.  Use 'catch' and check for EEXIST instead of
  (false-if-exception (delete-file ...)).
2015-06-10 10:31:25 +02:00
Ludovic Courtès
40245ef316 gnu: linux-boot: Remove outdated and misleading comment.
* gnu/build/linux-boot.scm (boot-system): Remove outdated comment.
2015-05-24 00:26:12 +02:00
Mark H Weaver
15f0de0581 system: activate-ptrace-attach: Handle kernels without YAMA support.
* gnu/build/activation.scm (activate-ptrace-attach): Check for the existence
  of /proc/sys/kernel/yama/ptrace_scope before trying to write to it.
2015-05-09 13:14:31 -04:00
Ludovic Courtès
356a62b8e6 activation: Make user copies of the skeletons writable.
* gnu/build/activation.scm (make-file-writable,
  make-skeletons-writable): New procedures.
  (copy-account-skeletons): Call 'make-file-writable' after 'copy-file'.
  (add-user): Add call to 'make-skeletons-writable'.
2015-05-05 23:46:54 +02:00
Ludovic Courtès
d9c41939bd install: Make /var/lock.
Reported by 宋文武 <iyzsong@gmail.com>.

* gnu/build/install.scm (directives): Add /var/lock.
2015-04-29 22:27:46 +02:00
Ludovic Courtès
b86fee7848 file-systems: Use a second 'mount' call for read-only bind mounts.
* gnu/build/file-systems.scm (MS_REMOUNT): New constant.
  (mount-file-system): Add 'flags' local variable.   When FLAGS has
  MS_BIND & MS_RDONLY, call 'mount' with MS_REMOUNT.
* gnu/services/base.scm (file-system-service) <start>: Likewise.
2015-04-20 22:16:13 +02:00
Ludovic Courtès
9d3fb6c767 install: Add a procedure to build a self-contained binary tarball.
Suggested by Pjotr Prins <pjotr.public12@thebird.nl>
at <http://lists.gnu.org/archive/html/guix-devel/2015-04/msg00229.html>.

* gnu/build/install.scm (populate-single-profile-directory): New procedure.
* gnu/system/install.scm (self-contained-tarball): New procedure.
* Makefile.am (guix-binary.%.tar.xz): New target.
2015-04-14 23:20:26 +02:00
Ludovic Courtès
b158f1d751 system: Allow users to PTRACE_ATTACH to their own processes.
* gnu/build/activation.scm (activate-ptrace-attach): New procedure.
* gnu/system.scm (operating-system-activation-script): Use it.
2015-04-12 15:33:42 +02:00
Ludovic Courtès
9bea87a542 activation: Remove undeclared user accounts and groups.
Fixes <http://bugs.gnu.org/19795>.
Reported by David Thompson <dthompson2@worcester.edu>.

* gnu/build/activation.scm (enumerate, current-users, current-groups,
  delete-user, delete-group): New procedures.
  (activate-users+groups): Add calls to 'delete-user' and
  'delete-group'.
* doc/guix.texi (User Accounts): Add a paragraph about statelessness.
  Explain that passwords are preserved.
2015-04-08 21:41:04 +02:00
Ludovic Courtès
f73b8e3d0a install: Create /var/tmp.
Suggested by Mark H Weaver <mhw@netris.org>.

* gnu/build/install.scm (directives): Add /var/tmp.
2015-03-31 13:59:37 +02:00
Mark H Weaver
78ab0746a5 system: Add /etc/ssl symlink; set needed variables in /etc/profile.
* gnu/build/activation.scm (activate-etc): Create /etc/ssl symlink.
* gnu/system.scm (etc-directory): Set SSL_CERT_DIR, SSL_CERT_FILE,
  and GIT_SSL_CAINFO in /etc/profile.

Co-Authored-By: Ludovic Courtès <ludo@gnu.org>
2015-03-03 13:49:12 -05:00
Ludovic Courtès
01ed3c4fe5 linux-boot: Don't fail if /root/etc/mtab is a dangling symlink.
Reported Joshua Grant.
Patch suggested by Mark H Weaver.

* gnu/build/linux-boot.scm (mount-root-file-system): Use
  'false-if-exception' instead of 'when (file-exists? ...)' to account
  for dangling symlinks.
2015-01-28 21:32:58 +01:00