Commit Graph

207 Commits

Author SHA1 Message Date
Morten Linderud
ddafd7477e
Merge branch 'pr-30' 2022-10-28 00:12:27 +02:00
Morten Linderud
8f9725afc8
Merge branch 'pr-28' 2022-10-28 00:11:11 +02:00
Mike Yuan
ddf3134077
pacstrap: add option '-P' to copy the host's pacman config to the target 2022-10-22 20:51:54 +08:00
Mike Yuan
58849024de
common: disable btrfs's fsck in fsck_types
btrfs doesn't need nor use a regular fsck utility.
This was wrongly added in b31a5d9f94 and made `genfstab` generate btrfs entries with `fs_passno` not
set to `0`.
2022-10-20 17:16:03 +08:00
Morten Linderud
acb8a7b9a7
prepare v27
Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-09-28 18:48:20 +02:00
Morten Linderud
2aa70691e5
Merge commit 'refs/pull/20/head' of github.com:archlinux/arch-install-scripts 2022-08-28 14:57:52 +02:00
Morten Linderud
e6dd0455db
Merge commit 'refs/pull/23/head' of github.com:archlinux/arch-install-scripts 2022-08-28 14:57:23 +02:00
Mike Yuan
8be9340001
pacstrap: add option '-K' to initialize an empty keyring in the new root 2022-08-25 22:45:07 +08:00
éclairevoyant
405d60b462 update pseudofs list 2022-08-04 07:42:23 -04:00
éclairevoyant
b31a5d9f94 update fsck list 2022-08-04 07:42:23 -04:00
Morten Linderud
5ba7798f81
Merge commit 'refs/pull/22/head' of github.com:archlinux/arch-install-scripts 2022-07-30 00:50:36 +02:00
Sean Anderson
58ff428757 Use separate pid namespace for worker processes
As described in 2be79c6 ("run the chroot in a new PID namespace"), child
processes can hang around and keep various files open. This may prevent
filesystems from being unmounted (as they are still in-use).

When adding unshare mode, I did not quite understand this distinction
(and I wasn't testing with e.g. gnupg) so I didn't catch this. Fix this
by always using unshare to create a second pid namespace for "worker"
processes. This ensures that all children are dead when we start
unmounting things. As the top-level unshare is no longer always
necessary, convert the unshare variable to a binary value.

Fixes: ee9db7d ("Add unshare mode to pacstrap")
Closes: #21
2022-07-28 10:02:31 -04:00
Morten Linderud
8a56133926
common: Make run a tmpfs mount
Reverts aea51ba901
Fixes https://github.com/archlinux/arch-install-scripts/issues/15

Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-07-03 14:01:26 +02:00
Morten Linderud
9ffd8bc6e3
common: include f2fs.fsck
Fixes FS#71760

Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-06-28 10:56:35 +02:00
Pete Anderson
20616bacc5
add_resolve_conf: recursive host + target symlinks 2022-06-28 10:32:19 +02:00
Morten Linderud
d5d3da33c7
Merge commit 'refs/pull/14/head' of github.com:archlinux/arch-install-scripts 2022-06-28 09:57:06 +02:00
Morten Linderud
2052c61529
Merge commit 'refs/pull/13/head' of github.com:archlinux/arch-install-scripts 2022-06-02 22:24:27 +02:00
Morten Linderud
5852434999
Merge commit 'refs/pull/18/head' of github.com:archlinux/arch-install-scripts 2022-06-02 22:23:10 +02:00
Jelle van der Waa
516cc7116c
README: document asciidoc optional dependency
Closes #9
2022-05-28 21:36:47 +02:00
Richard Hajek
2569d70d4e Added info to docs and improved readability 2022-04-25 20:16:09 +02:00
Richard Hajek
6d85a16785 Added info to arch-chroot --help 2022-04-25 20:16:09 +02:00
Sean Anderson
2623f8d76f Add unshare mode to arch-chroot
This is effectively the same transformation as in the previous patch.
We move the mountpoint warning later to avoid warning when we are about
to bind-mount the chroot dir ourselves.
2021-12-08 17:49:09 -05:00
Sean Anderson
ee9db7d580 Add unshare mode to pacstrap
This adds an "unshare" mode to pacstrap. This mode lets a regular user
create a new arch root filesystem. We use -N because both -U and -u are
taken in pacstrap and arch-chroot, respectively. There are two major
changes to pacstrap: we need to run many commands in under unshare, and
the setup process for mounts is different.

Because unshare starts a new shell, it is difficult to run many commands
in sequence. To get around this, we create a function for the rest of
the commands we wish to run, and then declare all functions and
variables in the unshare'd shell. This is pretty convenient. An
alternative method would be to generate the shell script as a HERE
document, and pipe it to bash.

Because unshare starts a new shell, we can only communicate using
stdin/out and any command line arguments. And we need to defer some
setup until after we are root. To get around this, we create a function
for the rest of the commands we wish to run, and then declare all
functions and variables in the unshare'd shell. I also considered having
a separate helper script which would contain the contents of pacstrap().
But I think this would be confusing, because the logic would then live
in a separate file (instead of just a separate function). That method is
also tricky because every variable has to be passed in through the
command-line arguments. One last method would be to generate a script on
the fly (e.g. using a HERE doc). I think that method could work as well.

The primary difference to the setup process is that we need to mount
filesystems in a different manner:
- We bind-mount the root directory. This is so commands which want to
  determine how much free space there is (or otherwise work with mounts)
  expect a mount on /. We unmount it with --lazy, since otherwise sys
  will cause an error (see below).
- proc can be mounted multiple times and is mounted in the same way
- sys cannot be mounted again, but we can recursively bind-mount it.
  When mounted this way, we can't unmount it until the mount namespace
  is deleted (likely because sys has a number of sub-mounts), so we have
  to use --lazy when unmounting it.
- dev can be bind-mounted, but this results in errors because some
  packages try and modify files in /dev if they exist. Since we don't
  have permission to do that on the host system, this fails. Instead, we
  just bind-mount a minimal set of files.
- run is not bind-mounted, but is instead created as a new tmpfs.
  According to aea51ba ("Bind mount /run from host into new root"), the
  reason this was done was to avoid lengthy timeouts when scanning for
  lvm devices. Because unshare does not (and cannot) use lvm devices, we
  don't need to bind-mount.
- tmp is created as usual.

Closes: #8
2021-12-08 17:44:51 -05:00
Sean Anderson
88c0c9db0b Don't warn if ownership changes when copying /etc/pacman.d/gnupg
In an unshare environment, /etc/pacman.d/gnupg is owned by the original
root, who is now "nobody". cp will warn about this, since we can't
create files owned by the original root, and it instead creates them as
the unshare'd root (the original user). This is benign, so ignore it.
2021-11-17 13:47:54 -05:00
Lara
bb04ab435a
Fix a typo in common 2021-09-06 17:40:43 +02:00
Tom Yan
ab30883f8a Bind mount /run read-only
Avoid e.g. systemd-tmpfiles from tampering /run (of the host):

fchownat() of /run/systemd/netif failed: Read-only file system
fchownat() of /run/systemd/netif/links failed: Read-only file system
fchownat() of /run/systemd/netif/leases failed: Read-only file system
fchownat() of /run/systemd/netif/lldp failed: Read-only file system

In this particular case, it could cause unexpected (and unnecessary)
change of ownership to these directories (because of automatic uid/gid
allocation), which could prevent systemd-networkd from working.

Besides, the chroot should under no circumstances (actually) need any
(read-)write access to /run. If there's such need, we should not bind
mount.

Ref.: https://bugs.archlinux.org/task/61808
2021-09-06 20:39:14 +08:00
Eli Schwartz
eef029adcc
prepare v24 2021-04-22 14:52:37 -04:00
Eli Schwartz
f3641171d9
doc: fix dumb typo, the pacman manpage is section 8 not 1
Fixes FS#70548
2021-04-22 14:02:27 -04:00
Eli Schwartz
4e1c8e548e
completion: fix leaky variable 2021-03-10 21:36:32 -05:00
Eli Schwartz
4cb00b3c21
completion: make usergroups split properly on ':' 2021-03-10 21:36:32 -05:00
Takeshi Suzuki
ca8e8f63ec
genfstab: disable appending subvol onto options
Options parsed from findmnt may already have the subvol option, so
appending the subvol option is unnecessary.

Fixes FS#65003

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2021-03-10 21:33:50 -05:00
Eli Schwartz
193c61db31
doc: update pacstrap description to account for default 'base' changing
It's no longer a group, and is now a metapackage.

Fixes FS#65216
2020-09-08 15:46:32 -04:00
Eli Schwartz
43b6090a74
release v23 2019-11-13 16:56:25 -05:00
Eli Schwartz
e1a84d1056
pacstrap: support local file mode
Allow passing files to the underlying pacman command, instead of relying
on the syncdb. This allows fine-grained control over the package files
to be installed, which can be useful when initializing a build chroot
for reproducible builds.
2019-11-13 12:03:38 -05:00
Eli Schwartz
4eb54af72a
genfstab: correctly trim root prefix on swapfiles
We remove the root prefix for all other devices by design, but omitted
doing so for swapfiles.

Fixes FS#63069
2019-07-02 11:20:33 -04:00
Eli Schwartz
c7fb67064a
release v22 2019-06-05 17:29:39 -04:00
Eli Schwartz
02bfbee971
doc: add note for arch-chroot regarding mountpoints 2019-06-05 17:29:29 -04:00
Eli Schwartz
55168a1917
zsh completion: remove option that no longer exists 2019-06-05 15:55:37 -04:00
Eli Schwartz
1cb88d9739
add initial bash completions 2019-06-05 15:44:58 -04:00
Eli Schwartz
d7031c7ccf
move completions into their own directory
And add infrastructure for installing bash-completions
2019-06-05 15:44:58 -04:00
Eli Schwartz
da67c1906f
doc: add manpages for all programs 2019-06-05 15:44:58 -04:00
Eli Schwartz
aeab95dbab
doc: add manpage infrastructure 2019-06-05 15:37:53 -04:00
Eli Schwartz
8652c5a724
consistently use -v <val> for help text descriptions 2019-06-05 15:26:59 -04:00
Eli Schwartz
53debcefab
pacstrap: try to copy the host keyring before installing packages
When there is no keyring in the new root, attempting to install e.g.
archlinux-keyring will result in the post-install script silently
failing to do anything (because there are no keys, and, critically, no
secret keys). The potentially very outdated keyring is then copied over
from the host, secret key and all, so subsequent pacman operations have
a trusted keyring that is at least as recent as the ISO or other host
system... but if there has been a keyring update between the date of the
ISO creation and the date of the install, those keys will continue to be
missing until the next keyring update, resulting in a bad out-of-the-box
experience.

This also means that if a thirdparty keyring package was scheduled to be
installed, it will not be populated at all; this affects downstream
archlinux32 build chroots.

There's no reason to delay this until after packages are installed -- we
aren't afraid of e.g. the mirrorlist resulting in file conflicts due to
a packaged pacman-mirrorlist, because the gnupg configuration should not
be getting packaged directly.

Fixes FS#61296 FS#61304 FS#61309 FS#61312 FS#62355
2019-05-21 01:32:52 -04:00
Dave Reisner
d5fe3b7bdb prepare v21 2019-01-05 11:25:50 -05:00
Dave Reisner
1f6e69f03e Clarify that -i means run interactively
ref: https://bugs.archlinux.org/task/60096
2019-01-05 11:21:09 -05:00
Dave Reisner
dad0ee7266 Only use explicitly set swap priorities
A priority of -2 seems to indicate "not defined" and we should simply
leave this alone.
2019-01-05 11:21:09 -05:00
Dave Reisner
aea51ba901 Bind mount /run from host into new root
ref: https://bugs.archlinux.org/task/61040
2019-01-05 11:21:06 -05:00
Dave Reisner
e7add12aba Add more pseudofs types 2018-12-11 07:25:20 -05:00
Dave Reisner
60961e397e prepare v20 2018-10-16 13:00:35 -04:00