Commit Graph

54 Commits

Author SHA1 Message Date
Christian Hesse
a2c8dd3173 archiso_pxe_common: remove resolv.conf before copy
Booting via PXE we want to keep our DNS configuration. So remove
/etc/resolv.conf in new root before copying the current file.

Without this systemd-resolved fallback nameservers are used and we see an
error message when the root ships a symbolic link to systemd-resolved's
stub-resolv.conf:

cp: not writing through dangling symlink '/new_root/etc/resolv.conf'
2021-01-26 21:59:01 +00:00
fdupoux
2c99df5c9b Reset network interfaces at the end of the PXE boot to allow DHCP to run 2020-11-18 21:16:27 +00:00
nl6720
8e82bbbe4a
archiso/initcpio/hooks/archiso: remove option terminator from the blockdev command
Apparently blockdev does not support it.
In an ISO made using '-s img' (Squashfs with dm-snapshot), it results in:

    blockdev: Unknown command: --
2020-08-11 06:58:06 +03:00
nl6720
b8dc4484e8
archiso/initcpio/install/archiso: fix GnuPG home directory permissions
Gets rid of a gpg warning:
gpg: WARNING: unsafe permissions on homedir '/tmp/mkinitcpio.*/root/gpg'
2020-07-29 18:05:16 +03:00
David Runge
e264b44682
Add license and basic documentation
LICENSE:
Add GPL-3.0 license.

{{archiso,configs}/*,.editorconfig,.gitlab-ci.yml}:
Add SPDX license identifier.

Makefile:
Add SPDX license identifier.
Install the `run_archiso.sh` script as global executable `run_archiso`.
Use -D and -t flags to install to install files more generically (without a previous call to install the directory).

README.rst:
Add README outlining the project's scope, how to build images from the profiles and how to test.

AUTHORS.rst:
Add list of all direct contributors to the repository.

CONTRIBUTING.rst:
Add basic contribution guidelines, explaining the linter and the license in use.

Closes #7
Closes #3
2020-07-29 14:27:48 +02:00
nl6720
b40fb2ae53
Separate custom comments from shellcheck comments
Having a shellcheck directive and custom comments in the same line can trigger SC1107 on old versions of shellcheck.
2020-07-17 10:42:14 +03:00
David Runge
e2032db4e7
Adding linting for initcpio scripts
archiso/initcpio/install/*:
Setting bash shebang for all scripts and making them comform with shellcheck.

archiso/initcpio/{hooks,script}/*:
Setting ash shebang for all scripts and making them comform with shellcheck (for dash, as shellcheck has no ash specific
ruleset). Essentially the ash based scripts should be POSIX compliant as much as possible to have an easier time
writing, debugging and maintaining them.
Ensuring that variables are not treated as options and introducing variable quoting.

.gitlab-ci.yml:
Integrating shellcheck for initcpio scripts.

Closes #32
2020-07-11 20:58:01 +02:00
nl6720
24a68d5879
Add amdgpu and mgag200 to the archiso_kms mkinitcpio hook
See https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start .
2020-07-01 12:05:52 +03:00
Christian Hesse
a00ba0f499 Remove cow file early for non-persistent systems
The kernel has an open file handle after setting up the mapping. We can
remove it early to make sure it is gone on shutdown.

This helps to keep the cow_device clean for non-persistent systems where
cow_directory contains a version specific string.

Signed-off-by: Christian Hesse <mail@eworm.de>
2018-06-29 13:08:24 -03:00
Christian Hesse
acf3ac9884 use a stronger hashing algorithm
Nobody wants to use md5 these days...

Signed-off-by: Christian Hesse <mail@eworm.de>
2017-10-17 23:54:55 -03:00
Gerardo Exequiel Pozzi
bfc0c81530 [archiso] Add ca-certificates.crt
Fix FS#54275

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2017-06-04 16:07:54 -03:00
David Thurstenson
3fec501225 Handle case where ip=dhcp
Signed-off-by: David Thurstenson <thurstylark@gmail.com>
2017-03-14 11:12:29 -03:00
David Thurstenson
ae854ed712 Add timeout to ipconfig call
Signed-off-by: David Thurstenson <thurstylark@gmail.com>
2017-03-14 11:12:29 -03:00
Christian Hesse
a04548ce2a pxe-common: not only search, but also domain entry in resolv.conf
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-09-29 19:34:51 -03:00
Christian Hesse
7b5d876742 pxe-common: add dns domain name in resolv.conf
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-09-29 19:34:51 -03:00
Christian Hesse
38b81f0384 pxe-common: add a comment what added settings to resolv.conf
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-09-29 19:34:51 -03:00
Christian Hesse
43a8571a6c always set copytoram for pxe boot via http
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-07-05 22:27:27 -03:00
Christian Hesse
50da696b5a fix indention and add EditorConfig configuration
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-29 13:58:04 -03:00
Christian Hesse
a9e7b0d50b flush and set down only if boot interface is known
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-28 13:47:10 -03:00
Christian Hesse
ca288915c0 do not declare bootif_dev local
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-27 18:57:54 -03:00
Christian Hesse
1bd3d4ec55 use ip syntax according to ip-address(8)
According to ip-address(8) flushing an interface requires the
keyword 'dev'.
Also add proper quoting.

Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-27 13:49:24 -03:00
Christian Hesse
63c62911ac move modprobe to run_earlyhook()
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-25 16:42:46 -03:00
Christian Hesse
51b7ed7f18 only run pxe late hook if $ip is given
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-24 21:31:37 -03:00
Christian Hesse
ca85896bfc fix NBD boot without copy-to-ram
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-05-24 21:31:37 -03:00
Gerardo Exequiel Pozzi
e018653a23 [archiso] Set net iface down if copytoram=y (default)
This should fix FS#36749

Also flush address on specified device (default)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2016-03-18 22:04:16 -03:00
Thomas Bächler
1a59eb3792 Add the verify=y option to verify the squashfs signature with gpg 2016-02-28 17:09:08 -03:00
Thomas Bächler
249a52d941 Add gpg to the image and optionally create a keyring
If the ARCHISO_GNUPG_FD environment variable is set, its contents will be interpreted as an open file
descriptor and its contents will be used to create a keyring in the initramfs in /gpg.
2016-02-28 17:09:08 -03:00
Christian Hesse
5725183716 fix boot parameters for mount options
Fixes: 03c296cb4f
Signed-off-by: Christian Hesse <mail@eworm.de>
2016-02-04 23:13:28 -03:00
Christian Hesse
03c296cb4f add boot params archisoflags= and cow_flags= for mount options
Having files on btrfs subvolumes requires to give mount options. Add
boot params archisoflags= and cow_flags= for this purpose. Boot
parameters could look like this:

... archisodevice=/dev/sdaX archisoflags=subvolume=isos
cow_device=/dev/sdaX cow_flags=subvolume=persist ...

Signed-off-by: Christian Hesse <mail@eworm.de>
2015-12-13 12:21:43 -03:00
Adam Purkrt
d35d87f252 cleaner boot from loopmounted iso file
Currently, when booting loopmounted iso file, it is necessary to
specify not only img_dev and img_loop (which should be sufficient),
but also archisolabel or archisodevice. With this patch, archisodevice
is directly populated with the correct loop device, and it is not
necessary to specify the label when booting from loopmounted iso,
which makes for leaner and cleaner grub.cfg.
2015-09-13 14:45:20 -03:00
Christian Hesse
f21da59e81 flush ip addresses after copy to RAM
We received an IP address from DHCP server and configure it statically.
This is required if we continue to use network connectivity to access
the root device (for example via NBD or NFS).

The lease is not updated, though. This can cause trouble in networks
with low lease times. So let's flush the addresses if root filesystem
has been copied to RAM. A dhcp client in main system can handle the
network connectivity then.

Signed-off-by: Christian Hesse <mail@eworm.de>
2015-06-24 21:52:40 -03:00
Christian Hesse
dc845b3f13 limit access to cow directory
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-05-29 17:03:10 -03:00
Christian Hesse
b1a397e98d launch interactive shell if ipconfig fails
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-05-29 13:10:42 -03:00
Christian Hesse
b1011376cf explicitly detach loop device on umount and silent losetup error
Umount detaches the loop device automatically, but let's make it
explicit to be sure. Additionally losetup gives:

losetup: /dev/loop0: detach failed: No such device or address

This is kind of expected, let's silent the error message.

Signed-off-by: Christian Hesse <mail@eworm.de>
2015-05-29 13:10:37 -03:00
Gerardo Exequiel Pozzi
9322a0d3b7 [archiso] Rename cowfile_size to cow_spacesize=
The name is more relevant since the usage is shared for both
dm-snapshot and overlayfs.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2015-01-27 14:37:05 -03:00
Gerardo Exequiel Pozzi
a637bdb857 [archiso] Add optional OverlayFS support
This is the first attemp to test overlayfs in archiso.
The current dm-snapshot mode is keep and is enabled by default,
while the new mode is enabled via "-s sfs" to mkarchiso.
No new boot parameters are added, since archiso hooks detects
if the .sfs file is for dm-snapshot (airootfs.img inside)
or for overlayfs.
Persistence is supported in overlayfs mode using the same options
(cowlabel or cowdevice), but warning while in dm-snapshot mode,
only one file is used (airootfs.cow), in overlayfs mode internal
files for workdir/ and upperdir/ are allocated, so you can not use
VFAT or NTFS.

To test this, you need to enable [testing] in pacman.conf from
releng profile and edit build.sh then add "-s sfs" in make_prepare()

Look at:
    setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
Replace with:
    setarch ${arch} mkarchiso ${verbose} -w "${work_dir}" -s sfs -D "${install_dir}" prepare

The build requires just half of space that the build for dm-snapshot,
since there is no ext4 img ;)

Just to remember: there is no space gain in .sfs (just about 2M)

There is at least one thing during boot with machine-id service:
Dec 24 03:31:39 archiso systemd-machine-id-commit[183]: Failed to unmount transient /etc/machine-id file in our private namespace: Invalid argument

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2015-01-27 14:37:05 -03:00
Christian Hesse
156b9a6093 allow to change dm snapshot chunksize
Copying big amount of data results in bad performance as data is
written in chunks of 4kiB (8 * 512 bytes).

The default is not changed but can be overwritten.

Signed-off-by: Christian Hesse <mail@eworm.de>
2015-01-02 15:13:36 -03:00
Christian Hesse
0b7a77cfc3 use consistent syntax for boot parameter processing
Signed-off-by: Christian Hesse <mail@eworm.de>
2015-01-02 15:13:35 -03:00
Gerardo Exequiel Pozzi
f5518de732 [archiso] Merge cowspace_size= option in cowfile_size=
Since now cowspace_size == cowfile_size (only one file inside)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2014-12-13 16:53:06 -03:00
Gerardo Exequiel Pozzi
edfdd37ba0 [archiso] Change cowfile_size= behavior
Move from percent to explicit size and set a default of 256M (sparse)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2014-10-13 21:15:22 -03:00
Lukas Fleischer
f5b84dad94 archiso_pxe_http: Fix location of airootfs.md5
Currently, when booting via HTTP, the airootfs.md5 file is downloaded to
/run/archiso/bootmnt/arch/. However, the checksum file is later assumed
to be located at "/run/archiso/bootmnt/arch/${arch}". Fix the _curl_get
invocation and directly place the file in the right directory.

Fixes a regression introduced in commit b3e1d31 ([archiso] Rework
checksum function, 2014-06-28).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-08-12 19:32:31 -03:00
Lukas Fleischer
5a8a8c7b10 Reintroduce the possibility to force an architecture
Among other things, 36459f3 ([archiso] Drop aitab support, 2014-06-28)
removed the possibility to manually set a specific architecture by using
kernel parameters. This, however, is useful, e.g. when installing Arch
Linux on a device that reports itself as i586 but works fine with the
i686 flavor.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-08-08 13:37:30 -03:00
Gerardo Exequiel Pozzi
eea299fa19 [archiso] Remove workwaround for nls/vfat
The proper fix in now in mkinitcpio-18

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@gmail.com>
2014-07-26 17:26:16 -03:00
Gerardo Exequiel Pozzi
b3e1d31343 [archiso] Rework checksum function 2014-06-28 00:35:51 -03:00
Gerardo Exequiel Pozzi
ba40f273f6 [archiso] rename airootfs.fs.sfs to airootfs.sfs
* Make it ISO9660 friendly (extra dot "." is replaced by "_")
* Was used when support both .fs.sfs and .sfs
2014-06-28 00:35:50 -03:00
Gerardo Exequiel Pozzi
36459f3acc [archiso] Drop aitab support
Always create one filesystem of a fixed size (32G), format (ext4) and
know name "airootfs".

Simplify logic a lot.
2014-06-28 00:35:50 -03:00
Gerardo Exequiel Pozzi
4f4af3df6e [archiso] Add nls_iso8859-1 to initramfs.
Fix FS#40217

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2014-05-21 20:45:29 -03:00
Gerardo Exequiel Pozzi
00d1126f70 [archiso] Avoid integer overflow when .fs is > 10.2G 2013-01-08 20:20:03 -03:00
Gerardo Exequiel Pozzi
21aa378007 [archiso] Allow set copytoram=n for NBD/NFS
On low memory systems installing via PXE is not possible.
Do not force copytoram=y for NFS/NDB.
Broken/hang things:
* On shutdown.
* On run-time if some network settings changed.

Implements FS#32006.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-10-16 19:10:17 -03:00
Gerardo Exequiel Pozzi
1746e31049 [archiso] Introduce cowfile_size= bootparam
If not set, nothing is changed in current behaviour.

Since dm-snapshot allows to use as "COW" a file with any size,
without caring about the the size of "origin", we can avoid creating a
"COW" file of the same size as the "origin". This is really useful,
when using as cow_device= a filesystem that is VFAT where sparse files
are not supported, so if root-image.fs is 1000M, passing cowfile_size=25%
will create a root-image.cow of 250M instead of 1000M.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-10-13 14:40:41 -03:00