Commit graph

37 commits

Author SHA1 Message Date
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
Ludovic Courtès
c6a0536d08 activation: Make sure /etc/sudoers & co. are regular files.
Before that, 'sudo' would exit with:

  sudo: /etc/sudoers is not a regular file
  sudo: no valid sudoers sources found, quitting

* gnu/build/activation.scm (activate-etc): Check if SOURCE matches
  'file-is-directory?'.  If not, use 'copy-file' instead of 'symlink'.
2014-09-12 00:14:52 +02:00
Ludovic Courtès
286cacaded activation: Remove outdated comment.
* gnu/build/activation.scm (activate-etc): Remove outdated comment.
2014-09-12 00:14:52 +02:00
Ludovic Courtès
095f4deb4b activation: Factorize the link-or-copy trick.
* gnu/build/activation.scm (link-or-copy): New procedure.
  (activate-setuid-programs): Use it.
2014-09-12 00:14:52 +02:00
Ludovic Courtès
a4888e2e0f install: Gracefully handle corner cases with 'guix system init foo /'.
* gnu/build/install.scm (evaluate-populate-directive): Wrap body in
  "catch 'system-error", and report clear errors.  In the symlink case,
  retry up EEXIST.
  (populate-root-file-system): Remove /var/guix/profiles/system-1-link
  before attempting to create it.
2014-09-10 21:39:47 +02:00
Ludovic Courtès
42d10464be linux-initrd: Store Linux modules in a normal store directory.
* gnu/system/linux-initrd.scm (expression->initrd): Remove #:linux and
  #:linux-modules parameters.  Remove call to
  'float-linux-module-directory'.
  (base-initrd): Add call to 'float-linux-module-directory'.  Use it in
  #:linux-modules argument in the gexp.  Remove #:linux and
  #:linux-modules arguments to 'expression->initrd'.
* gnu/build/linux-initrd.scm (build-initrd): Remove
  #:linux-module-directory parameter.  Don't create 'modules'
  sub-directory.
* gnu/build/linux-boot.scm (boot-system): Mentin that LINUX-MODULES is a
  list of absolute file names.  Don't prepend "/modules/" to
  LINUX-MODULES.
* doc/guix.texi (Initial RAM Disk): Adjust accordingly.
2014-09-08 23:47:29 +02:00
Ludovic Courtès
1621cf97aa linux-initrd: Move initrd creation code to (guix build linux-initrd).
* gnu/build/linux-initrd.scm (cache-compiled-file-name,
  compile-to-cache, build-initrd): New procedures.
* gnu/system/linux-initrd.scm (expression->initrd)[builder]: Remove code
  now moved above.  Use 'build-initrd'.
2014-09-08 23:47:28 +02:00
Ludovic Courtès
70608adb4a linux-initrd: Copy all the script's closure to the initrd.
* gnu/system/linux-initrd.scm (expression->initrd): Remove calls to
  'imported-modules' and 'compiled-modules'.  Use 'gexp->script' with
  EXP.  Add the result to TO-COPY.  Make /init a symlink to that script,
  and copy its closure into the "contents" directory.  Add fake
  /proc/self/exe symlink.
* gnu/build/linux-boot.scm (load-linux-module*): Add comment about mmap.
* gnu/system/vm.scm (system-qemu-image/shared-store-script): Add "-m
  256".  This turns out to be needed for initrds containing things like
  e2fsck and several modules; with the default of 128 MiB, loading
  libahci.ko may fail with -1.
2014-09-08 23:47:28 +02:00
Ludovic Courtès
84da4ad4b0 linux-initrd: Build cpio archives without '--no-absolute-filenames'.
* gnu/build/linux-initrd.scm (write-cpio-archive): Remove
  '--no-absolute-filenames'.
2014-09-08 00:03:38 +02:00
Ludovic Courtès
6fd1a79674 vm: Move store copy handling to (guix build store-copy).
* gnu/build/vm.scm (read-reference-graph, populate-store): Move to...
* guix/build/store-copy.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Adjust default
  #:modules values accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): New test.
2014-09-04 23:24:54 +02:00
Ludovic Courtès
fbb3555809 linux-initrd: Factorize cpio archive creation.
* gnu/build/linux-initrd.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* gnu/system/linux-initrd.scm (expression->initrd): Use (gnu build
  linux-initrd) and 'write-cpio-archive' instead of the inlined code.
2014-09-03 15:43:07 +02:00
Ludovic Courtès
e2f4b305d0 Move part of (gnu build linux-boot) to (gnu build file-systems).
* gnu/build/linux-boot.scm (%ext2-endianness, %ext2-sblock-magic,
  %ext2-sblock-creator-os, %ext2-sblock-uuid, %ext2-sblock-volume-name,
  read-ext2-superblock, ext2-superblock-uuid,
  ext2-superblock-volume-name, disk-partitions,
  partition-label-predicate, find-partition-by-label,
  canonicalize-device-spec, MS_RDONLY, MS_NOSUID, MS_NODEV, MS_NOEXEC,
  MS_BIND, MS_MOVE, bind-mount, check-file-system,
  mount-flags->bit-mask, mount-file-system): Move to...
* gnu/build/file-systems.scm: ... here.  New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* gnu/services/base.scm: Use (gnu build file-systems).
* gnu/services/dmd.scm (dmd-configuration-file): Likewise.
* gnu/system.scm (operating-system-activation-script): Likewise.
* gnu/system/linux-initrd.scm (base-initrd): Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Likewise.
2014-09-03 15:43:07 +02:00
Ludovic Courtès
8a9e21d1f7 Rename (gnu build linux-initrd) to (gnu build linux-boot).
* gnu/build/linux-initrd.scm: Rename to...
* gnu/build/linux-boot.scm: ... this.
* gnu-system.am (GNU_SYSTEM_MODULES): Adjust accordingly.
* gnu/build/activation.scm, gnu/build/vm.scm, gnu/services/base.scm,
  gnu/services/dmd.scm, gnu/system.scm, gnu/system/linux-initrd.scm,
  gnu/system/vm.scm: Adjust accordingly.
2014-09-03 15:43:07 +02:00
Ludovic Courtès
548f7a8fa2 Move operating system helpers from (guix build …) to (gnu build …).
* guix/build/activation.scm, guix/build/install.scm,
  guix/build/linux-initrd.scm, guix/build/vm.scm: Move to...
* gnu/build: ... here.
* Makefile.am (MODULES): Remove the above guix/build/ files.
* gnu-system.am (GNU_SYSTEM_MODULES): Add the above gnu/build/ files
  here.
* gnu/services/base.scm, gnu/services/dmd.scm, gnu/system.scm,
  gnu/system/linux-initrd.scm, gnu/system/vm.scm,
  guix/scripts/system.scm: Adjust to the new module names.
2014-09-03 15:43:07 +02:00