Commit Graph

163 Commits

Author SHA1 Message Date
Ludovic Courtès 2fe4ceee18
file-systems: Do not read superblocks past the end of a device.
Fixes <http://bugs.gnu.org/25573>.
Reported by Alex Kost <alezost@gmail.com>.

* gnu/build/file-systems.scm (seek*): New procedure.
(read-superblock): Use it instead of 'seek' and ensure it returns
OFFSET.
2017-01-31 23:21:59 +01:00
Marius Bakke 5a64a79131
utils: Add helper method to make files writable.
* gnu/build/activation.scm (make-file-writable): Move this to ...
* guix/build/utils.scm (make-file-writable): ... here. Export it.
* guix/build/gnu-build-system.scm (strip): Use it.
2017-01-26 22:19:16 +01:00
David Craven b1a505baf6
system: Add btrfs file system support.
* gnu/build/file-systems.scm (%btrfs-endianness, btrfs-superblock?,
  read-btrfs-superblock, btrfs-superblock-uuid,
  btrfs-superblock-volume-name, check-btrfs-file-system): New variables.
  (%paritition-label-readers, %partition-uuid-readers): Add btrfs
  readers.
* gnu/system/linux-initrd.scm (linux-modules): Add btrfs modules when a
  btrfs file-system is used.
* gnu/tests/install.scm (%btrfs-root-os %btrfs-root-os-source,
  %btrfs-root-installation-script, %test-btrfs-root-os): New system
  test.
* doc/guix.texi: Adjust accordingly.

Fixes <http://bugs.gnu.org/19280>.
2017-01-10 12:00:35 +01:00
David Craven ab4e939c50
file-systems: Refactor file-system predicates.
* gnu/build/file-systems.scm (partition-field-reader,
  read-partition-field, %partition-label-readers,
  %partition-uuid-readers, read-partition-label, read-partition-uuid):
  New variables.
  (partition-predicate, partition-label-predicate,
  partition-uuid-predicate, luks-partition-uuid-predicate): Use
  partition field readers.
  (find-partition): New variable.
  (find-partition-by-label, find-partition-by-uuid,
  find-partition-by-luks-uuid): Use find-partition-by.
2017-01-10 12:00:05 +01:00
David Craven 26905ec8a6
file-systems: Refactor check-file-system.
* gnu/build/file-systems.scm (check-file-system): Use file-system type
  specific checker.
  (check-ext2-file-system): New variable.
2017-01-10 11:58:11 +01:00
David Craven 974e02da76
file-systems: Refactor file system detection logic.
* gnu/build/file-systems.scm (read-superblock,
  null-terminated-latin1->string): New variables.
  (sub-bytevector): Move to general section.
  (ext2-superblock?, read-ext2-superblock): New variables.
  (ext2-superblock-uuid, ext2-superblock-volume-name): Use
  sub-bytevector and null-terminated-latin1->string.
  (%ext2-sblock-magic, %ext2-sblock-creator-os, %ext2-sblock-uuid,
  %ext2-sblock-volume-name): Inline constants.
  (luks-superblock?, read-luks-header): New variables.
  (%luks-header-size, %luks-magic): Inline.
  (partition-label-predicate, partition-uuid-predicate,
  luks-partition-uuid-predicate): Use new functions.
2017-01-06 15:06:42 +01:00
Ludovic Courtès 3593e5d5c5
gnu: cross-base: Move phases to (gnu build cross-toolchain).
* gnu/packages/cross-base.scm (cross-gcc-arguments) <#:phases>: Use
'cross-gcc-build-phases', and move body cross-toolchain.scm.
(cross-gcc): Add #:imported-modules.  Add (gnu build cross-toolchain) to
 #:modules.
* gnu/build/cross-toolchain.scm: New file, with code from
'cross-gcc-arguments'.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
2016-12-07 21:52:26 +01:00
John Darrington 0c85db79f7
gnu: Allow nfs file systems to be automatically mounted.
* gnu/build/file-systems.scm (mount-file-system): Append target addr= when
mounting nfs filesystems.
2016-11-29 07:21:15 +01:00
Ludovic Courtès d2bcf35e18
vm: Avoid needless file copy in 'load-in-linux-vm'.
Reported by Chris Webber.

* gnu/build/vm.scm (load-in-linux-vm)[image-file]: Remove.  Directly
refer to OUTPUT instead.
2016-11-28 22:58:18 +01:00
Ludovic Courtès f7f292d359
install: Enable "cryptodisk" handling in GRUB.
This allows 'grub-install' to do the right thing when / or /boot is a
LUKS-encrypted partition.

Fixes <http://bugs.gnu.org/21843>.

* gnu/build/install.scm (install-grub): Add 'setenv' to set
'GRUB_ENABLE_CRYPTODISK'.
(wait-for-screen-text): New test.
* gnu/tests/base.scm (run-basic-test): Add #:initialization parameter
and honor it.
* gnu/tests/install.scm (%encrypted-root-os)[kernel-arguments]: Remove.
(%encrypted-root-installation-script): Pass '--uuid' to 'cryptsetup
luksFormat'.  Remove 'sed' invocation.
(enter-luks-passphrase): New procedure.
(%test-encrypted-os)[value]: Pass #:initialization to 'run-basic-test'.
2016-11-23 21:13:18 +01:00
Ludovic Courtès fe93383350
marionette: Add 'marionette-screen-text' using OCR.
* gnu/build/marionette.scm (marionette-screen-text): New procedure.
* gnu/tests/base.scm (run-basic-test)["screen text"]: New test.
2016-11-23 21:13:18 +01:00
Ludovic Courtès f25c9ebc80
marionette: Delay synchronization with the host's REPL.
* gnu/build/marionette.scm (<marionette>)[marionette-repl]: Rename to...
[%marionette-repl]: ... this.
(marionette-repl): New macro.
(make-marionette): Wrap last 'read' call into 'delay', making the last
argument to 'marionette' a promise of a port.
(marionette-eval): Use 'force' in 'match' clause.
2016-11-23 21:13:18 +01:00
Ludovic Courtès ad17470551
marionette: Avoid use of SIGALRM for timeouts.
* gnu/build/marionette.scm (make-marionette)[accept*]: New procedures.
Remove calls to 'sigaction'.  Use 'accept*' instead of 'accept'.
2016-11-22 23:45:08 +01:00
Ludovic Courtès 5970e8e248
container: Pass a list of <file-system> objects as things to mount.
* gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a
list of <file-system> objects instead of a list of lists ("specs").
Add call to 'file-system->spec' as the argument to 'mount-file-system'.
(run-container, call-with-container): Adjust docstring accordingly.
* gnu/system/file-systems.scm (spec->file-system): New procedure.
* gnu/system/linux-container.scm (container-script)[script]: Call
'spec->file-system' inside gexp.
* guix/scripts/environment.scm (launch-environment/container): Remove
call to 'file-system->spec'.
* tests/containers.scm ("call-with-container, mnt namespace")
("call-with-container, mnt namespace, wrong bind mount"): Pass a list of
<file-system> objects.
2016-11-10 18:01:44 +01:00
Chris Marusich 1e17a2d5f2
install: Extract procedure: install-grub-config.
* gnu/build/install.scm (install-grub-config): New procedure.
(install-grub): Use it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-11-06 18:08:53 +01:00
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
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
宋文武 9331ba5dd9 linux-boot: Make /etc/mtab a symlink to /proc/self/mounts.
Fixes <http://bugs.gnu.org/19491>.

* gnu/build/linux-boot.scm (mount-root-file-system): Make /root/etc/mtab
  a symlink to /proc/self/mounts.
* gnu/build/file-systems.scm (mount-file-system): Don't update /etc/mtab.
* guix/build/syscalls.scm (mount, umount): Have #:update-mtab? default to
  #f.
2015-01-05 22:24:00 +08:00
Ludovic Courtès 45c5b47b96 activation: Copy the account skeletons when creating the 'root' account.
* gnu/build/activation.scm (%skeleton-directory): New variable.
  (dot-or-dot-dot?, copy-account-skeletons): New procedure.
  (add-user): Use 'copy-account-skeletons'.
  (activate-etc): Use 'dot-or-dot-dot?'.
2014-12-13 22:31:08 +01:00
Ludovic Courtès 6412e58a68 system: Don't make /boot/grub/grub.cfg a symlink to the store.
This would not work when /boot is a separate partition, as reported by
Nikita Karetnikov <nikita@karetnikov.org> in <http://bugs.gnu.org/19220>.
This fixes a regression introduced in 39d1f82.

* gnu/build/install.scm (install-grub): Copy GRUB.CFG instead of
  symlinking it, as was the case before 39d1f82.
* gnu/build/vm.scm (register-grub.cfg-root): Add 'grub.cfg' parameter.
  Make it a permanent GC root instead of an indirect GC root.
  (initialize-hard-disk): Adjust accordingly.
* guix/scripts/system.scm (install-grub*): Replace use of
  'add-indirect-root' by the addition of a permanent GC root in
  %GC-ROOTS-DIRECTORY.
2014-12-09 11:06:50 +01:00
Ludovic Courtès 6496de9bc2 activation: Don't create unneeded "/var/guix/gcroots/etc-directory".
* gnu/build/activation.scm (activate-etc): Don't create
  "/var/guix/gcroots/etc-directory".
2014-12-06 16:03:49 +01:00
Ludovic Courtès 39d1f82b52 system: Make /boot/grub/grub.cfg an indirect GC root.
Fixes <http://bugs.gnu.org/19160>.

* guix/scripts/system.scm (install-grub*): Make /boot/grub/grub.cfg an
  indirect GC root.
* gnu/build/install.scm (install-grub): Make TARGET a symlink.
* gnu/build/vm.scm (register-grub.cfg-root): New procedure.
  (initialize-hard-disk): Use it.
2014-12-04 23:53:16 +01:00
Ludovic Courtès 7c4885f0d7 linux-modules: Correctly propagate error code from 'init_module'.
* gnu/packages/patches/guile-linux-syscalls.patch (scm_load_linux_module):
  Leave 'errno' unchanged when ERR != 0.
* gnu/build/linux-modules.scm (load-linux-module*): Check for the errno
  value of ARGS to determine whether the module was already loaded.
2014-11-28 15:08:56 +01:00
Ludovic Courtès 0e704a2d4e linux-boot: Load modules and their dependencies, à la 'modprobe'.
* gnu/build/linux-boot.scm: Use (gnu build linux-modules).
  (load-linux-module*): Remove.
  (boot-system): Add #:linux-module-directory parameter.
  [lookup-module]: New procedure.
  Call 'current-module-debugging-port'.  Pass #:lookup-module to
  'load-linux-module*'.  Map LOOKUP-MODULE on LINUX-MODULES.
* gnu/system/linux-initrd.scm (base-initrd): Adjust 'boot-system' call
  accordingly.  Adjust #:modules argument as well.
* gnu/system.scm (operating-system-activation-script)[%modules]: Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2014-11-28 00:10:28 +01:00
Ludovic Courtès fcaa5f44a1 system: Add (gnu build linux-modules).
* gnu/build/linux-modules.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
2014-11-28 00:10:28 +01:00
Ludovic Courtès 67979e42c3 linux-boot: Call 'pre-mount' before 'mount-root-file-system'.
Partly fixes <http://bugs.gnu.org/19190>.
Reported by Nikita Karetnikov <nikita@karetnikov.org>.

* gnu/build/linux-boot.scm (boot-system): Move PRE-MOUNT call before
  'mount-root-file-system' is called.
2014-11-26 11:58:06 +01:00
Ludovic Courtès 76bacc8264 linux-boot: Error out when 'pre-mount' returns #f.
* gnu/build/linux-boot.scm (boot-system): Call 'error' when PRE-MOUNT
  returns #f.
2014-11-26 11:54:21 +01:00
Ludovic Courtès 4dfbdcbcb4 linux-boot: Don't catch exceptions thrown by 'mount-root-file-system'.
* gnu/build/linux-boot.scm (mount-root-file-system): Remove 'catch #t'
  around body.  This was unneeded and even inconvenient because this
  procedure is called from within 'call-with-error-handling' already.
2014-11-20 22:43:47 +01:00
Ludovic Courtès 1c27641f46 file-systems: Always write the options field in /etc/mtab.
* gnu/build/file-systems.scm (mount-file-system): When OPTIONS is false,
  write "rw" to /etc/mtab.  This fixes a bug whereby 'remove-from-mtab'
  in (guix syscalls) would otherwise raise a 'match-error' because of
  the missing field.  This affected file systems mounted from the
  initrd, such as devtmpfs, which has options == #f.
2014-11-20 21:14:39 +01:00
Ludovic Courtès bff39668b9 vm: Set the boot flag on the root partition.
Reported by nebuli on #guix.

* gnu/build/vm.scm (initialize-partition-table): Add #:bootable?
  parameter and honor it.
  (initialize-hard-disk): Likewise.
2014-11-13 13:42:44 +01:00
Ludovic Courtès ced0106a44 linux-boot: Make more disk partition block devices.
Reported by nebuli on #guix.

* gnu/build/linux-boot.scm (make-disk-device-nodes): Make 16 block
  devices for disk partitions.
2014-11-13 13:34:31 +01:00
Ludovic Courtès f34c56be3a activation: Set the firmware search path.
* gnu/build/activation.scm (activate-firmware): New procedure.
* gnu/system.scm (<operating-system>)[firmware]: New field.
  (directory-union): New procedure.
  (%base-firmware): New variable.
  (operating-system-activation-script): Use 'directory-union', and call
  'activate-firmware'.
* doc/guix.texi (operating-system Reference): Document 'firmware'.
2014-11-11 22:42:39 +01:00
Ludovic Courtès d460204f2e system: Allow Linux-libre to find our 'modprobe' command.
Fixes <http://bugs.gnu.org/18525>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/build/activation.scm (activate-modprobe): New procedure.
* gnu/system.scm (modprobe-wrapper): New procedure.
  (operating-system-activation-script): Use both.
2014-11-02 23:06:17 +01:00
Ludovic Courtès de1c158f32 system: Add support for boot-time mapped devices.
* gnu/build/linux-boot.scm (boot-system): Add #:pre-mount parameter and
  honor it.
* gnu/system/linux-initrd.scm (base-initrd): Add #:mapped-devices
  parameter.  Add 'device-mapping-commands' variable, and use it to
  build the #:pre-mount argument of 'boot-system'.
* gnu/system.scm (mapped-device-user,
  operating-system-user-mapped-devices,
  operating-system-boot-mapped-devices): New procedures.
  (device-mapping-services): Use 'operating-system-user-mapped-devices'
  instead of 'operating-system-mapped-devices'.
  (operating-system-initrd-file): Call the initrd with #:mapped-devices.
2014-09-22 11:20:41 +02:00
Ludovic Courtès e2b464b7f4 activation: Ensure existing user accounts have the right settings.
* gnu/build/activation.scm (modify-user, ensure-user): New procedures.
  (activate-users+groups): Systematically call 'ensure-user'.
2014-09-22 10:10:08 +02:00
Ludovic Courtès 4359378a2c linux-boot: Ask fsck for a progress bar.
* gnu/build/file-systems.scm (check-file-system): Pass '-C 0' to FSCK.
  Suggested by Mark H. Weaver.
2014-09-19 21:51:36 +02:00
Ludovic Courtès 6c1df0819c linux-initrd: Remove now obsolete #:guile-modules-in-chroot? parameter.
* gnu/build/linux-boot.scm (boot-system): Remove
  #:guile-modules-in-chroot? and related code.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Remove
  #:guile-modules-in-chroot? argument in 'base-initrd' call.
2014-09-18 23:05:22 +02:00
Ludovic Courtès 6d49355d8b activation: Honor $GUIX_NEW_SYSTEM for use by 'guix system reconfigure'.
* gnu/build/activation.scm (activate-current-system): Honor
  $GUIX_NEW_SYSTEM by default.
* guix/scripts/system.scm (switch-to-system): Set $GUIX_NEW_SYSTEM
  before loading SCRIPT.
2014-09-12 22:13:52 +02:00
Ludovic Courtès ee7bae3bbd activation: Set the permissions of /etc/sudoers to 440.
* gnu/build/activation.scm (activate-etc): Move 'rm-f' to a local
  'define'.  When TARGET is "sudoers", make it 440.
2014-09-12 00:14:52 +02:00
Ludovic Courtès ee248b6a70 activation: Make the /bin/sh symlink at activation time.
* gnu/build/install.scm (directives): Remove "/bin/sh".
* gnu/build/activation.scm (activate-/bin/sh): New procedure.
* gnu/system.scm (operating-system-activation-script): Use it.
2014-09-12 00:14:52 +02:00