Commit graph

77 commits

Author SHA1 Message Date
Roland Schwarzkopf f3ee66b9e5 cowpacman2srm fix - check if directory exists before searching unit files 2022-12-15 10:46:21 +01:00
Gerd v. Egidy 54bd03d4fd use new pacman-faketime wrapper in yay-prepare 2022-12-10 21:05:17 +01:00
Gerd v. Egidy f2134ca4ab add "pacman-faketime" wrapper to work around expiring package signing keys (#313)
Also disable gpg trust caching & regeneration to not "burn" the trust database by
running pacman without the faketime wrapper once.
2022-12-10 21:02:45 +01:00
Gerd v. Egidy 711a9f6ea5 don't parse yaml files twice when using copytoram
since recently /run/archiso/copytoram is bind-mounted to /run/archiso/bootmnt.
This means sysrescue-configuration.lua should just load yaml files from
/run/archiso/bootmnt and not both, otherwise they would be loaded twice.
2022-10-19 20:20:13 +02:00
Gerd v. Egidy 98a9623a91 yay-prepare: don't reinstall packages from the sysrescuerepo
They aren't available by default. Also it is quite unlikely that a package
from AUR would actually need includes or libraries from one of them.
2022-10-11 22:36:44 +02:00
Gerd v. Egidy 704d7a9e5c add yay AUR-helper (#139)
- call yay through a wrapper to take care of root/sudo handling
- add yay-prepare to reinstall everything that was stripped for size (like /usr/include)
- yay-prepare creates a yay user and sudo rights
- the wrapper is installed in /usr/bin/yay, we want it to clash with yay-packages that aren't adapted to SystemRescue
2022-10-02 15:34:00 +02:00
Gerd v. Egidy dcc27afc06 add mkpasswd: hash a password for use in /etc/shadow or htpasswd
mkpasswd is finally available packaged on Arch, so add it to allow
manually replacing a password in /etc/shadow, for when chroots or
pam don't work as wanted. Also supports advanced hash algos like
yescrypt that can't be set via the pam stack yet.

Because the source for mkpasswd is part of the whois package, it
is currently packaged as part of whois. But it might get it's own
package in the future, so add a check for /usr/bin/mkpasswd during
build time.
2022-09-15 20:58:33 +02:00
Gerd v. Egidy c52dcbeeb0 mountall: show target mountpoint in output 2022-09-06 20:24:46 +02:00
Gerd v. Egidy d8de1c8199 mountall: use udevadm settle to wait for newly opened cryptodisks to appear in /dev/mapper 2022-09-06 20:19:53 +02:00
Gerd v. Egidy e9549eba34 don't do certificate verification for https downloads in the lua script
it is usually run during initramfs: we don't have a CA database there, so
all https downloads would fail otherwise.

Not doing cert verification at this step is clearly documented, so no
unexpected security risk for the user.
2022-08-07 12:56:41 +02:00
Gerd v. Egidy 81db3b13db improve error message in case the lua script can't download a file
Now prints the actual error message from the http library instead of a
generic "Could not connect" message.
2022-08-07 12:53:16 +02:00
Gerd v. Egidy 533a4cab7e add cow_label and cow_directory options to the global scope of the yaml config file
Allows to set to set the persistent backing store options via the yaml config too and
not only through boot commandline options.
2022-08-05 22:05:02 +02:00
Gerd v. Egidy c0cddfc630 add --readonly option to mountall 2022-08-01 22:40:48 +02:00
Gerd v. Egidy e3b7b2079e use already existing mountpoints in mountall when they are empty and nothing mounted 2022-08-01 22:12:52 +02:00
Gerd v. Egidy 4109b1ea38 add "nomdlvm" boot commandline option to not activate md raid or lvm devices
Activating md raid or lvm means that the kernel changes the metadata like
timestamps and mount counts of the devices and writes them to disk.
Also reconstructing degraded md raid devices is automatically activated.
There are cases when writing to disks is absolutely not wanted. For example
when restoring data from broken disks or when doing forensics.

The nomdlvm boot commandline option prevents any activation and thus
not wanted writes. If the user wants to use md or lvm with the option
set, all md or lvm devices have to be manually found and activated.

nomdlvm is only implemented as boot commandline option and does not use
the YAML config file. The reason is that the udev rules are evaluated
before sysrescue-configuration.lua is run, so the YAML config is not
ready yet. Moving nomdlvm after sysrescue-configuration.lua would be
an invasive operation and modify the activation order of all md and lvm
devices for all cases, increasing the probability of regressions.
Also udev rules offer a direct access to boot commandline options, making
implementation straightforward and robust.
2022-07-27 22:27:11 +02:00
Gerd v. Egidy 09fcf3a452 improve check if already mounted for btrfs filesystems in mountall 2022-07-24 19:56:47 +02:00
Gerd v. Egidy f38c7ba8ca detect and open LUKS encrypted devices in mountall 2022-07-24 19:46:56 +02:00
Gerd v. Egidy 2d8bb769c1 use /sys/class/block instead of /sys/block in mountall to get all partitions 2022-07-24 19:13:47 +02:00
Gerd v. Egidy c0a1af428a don't try to mount swap space in mountall 2022-07-24 19:07:04 +02:00
Gerd v. Egidy 815ae32dde fix parsing command line option when there is no default yaml file at all 2022-06-06 12:36:16 +02:00
Gerd v. Egidy 64eabbbbaa wait until we are online before doing a http/https load-srm
There is no dependency on NetworkManager being actually online when
sysrescue-initialize.py calls load-srm to honor the late_load_srm config
option. So without this patch this can fail when the network takes a
few seconds until the link is actually up.

Fixes #288
2022-06-04 17:10:43 +02:00
Gerd v. Egidy c2060e8a73 implement handling of serial consoles for autoterminal
serial consoles have separate systemd services (serial-getty@.service). We need to adapt
the handling and also need some different options for them than for regular gettys.

To allow sysrescue-initialize.py to differentiate between regular consoles and serial ones
they must be configured with the prefix "serial:" in the yaml, for example like this:

autoterminal:
    "serial:ttyS0": "/usr/bin/bash"
2022-05-12 22:53:57 +02:00
Gerd v. Egidy c3b0b576a4 Implement main part of autoterminal feature
See #258
2022-05-12 22:51:48 +02:00
Francois Dupoux 31dc85c0b3 Merge branch 'mountall' into 'main'
add "mountall" command

See merge request systemrescue/systemrescue-sources!194
2022-05-09 11:27:06 +00:00
Francois Dupoux cfcfd6dd7a Merge branch 'lua-config-once' into 'main'
execute sysrescue-configuration.lua only once

See merge request systemrescue/systemrescue-sources!193
2022-05-09 11:26:49 +00:00
Gerd v. Egidy e87660beeb execute sysrescue-configuration.lua only once
Before this patch sysrescue-configuration.lua was executed twice each boot:
(1) during initramfs stage (2) in the regular system as sysrescue-configuration.service

While in theory both runs should create the same output, this isn't guaranteed and
differences could appear for example because of network issues. Finding and debugging
these is difficult because the output of sysrescue-configuration.lua created during
initramfs isn't available anymore when the final system is running.

This patch lets sysrescue-configuration.lua just run once during initramfs. The
output JSON file is then written to the new tmpfs mounted dir /run/archiso/config/.
This dir is also made the new default location for sysrescue-effective-config.json.

A symlink from /etc/sysrescue/sysrescue-effective-config.json to the new location
is created for compatibility with previous releases.
2022-04-25 20:31:18 +02:00
Gerd v. Egidy a424ed7991 add "mountall" command
It loops through all available block devices in the system and tries to mount them.
They are mounted to /mnt/<devicename>.

If they have "dev", "proc" or "sys" dirs in them, then the respective dirs of the
running SystemRescue are bind-mounted into it. This allows running some commands
like grub-install when chrooting into the dir.
2022-04-24 21:53:21 +02:00
Gerd v. Egidy b11a052e69 change logic of the sysrescuecfg boot command line option: merge instead of replace
When you set a "sysrescuecfg" option on the boot command line before this change,
only the files given on the boot command line were read, not the files in the
sysrescue.d dir. But previous versions of sysrescue-configuration.lua had a set of
built-in default values, these were still used.

Current sysrescue-configuration.lua does not include default values anymore, they
are now all in 100-defaults.yaml. So it is better to always read the default values
from the sysrescue.d dir and just merge files given with the sysrescuecfg option
additionally, with a higher priority.

The sysrescuecfg now also allows absolute paths for local files. When using relative
paths, the common sysrescue.d dirs are prefixed. In this case the file will usually
be loaded again, but at a higher priority.
2022-04-24 01:52:43 +02:00
Gerd v. Egidy 24529bbb58 change yaml config loading logic to full merge
Previously when loading a YAML config, it overrode single values on the second hierarchy level.
But on all deeper levels new values were completely overwritten. This was inconsistent and poses
a problem for config entries that use these levels, like the ca-trust or the in-development autoterminal.

This change implements full merging of dictionaries on all levels to solve this. Values in files later
in precedence overwrite previous values. If the the old and the new config values are both dictionaries,
then the hierarchy levels are merged down recursively.

You can remove a previously existing dict entry again in a later file by assigning it an empty value.

Also fix handling of invalid YAMLs: ignore them instead of aborting execution
2022-04-23 23:18:23 +02:00
Francois Dupoux 770fc6bf15 Update check-binaries.sh script with new custom packages 2022-04-10 18:58:54 +01:00
Gerd v. Egidy a100257d96 Add script and config.yaml parameter for late-loading of SystemRescueModules 2022-03-27 14:07:38 +00:00
Francois Dupoux afcebda039 Merge branch 'xorriso-parameter-check' into 'main'
ensure that the installed xorriso version supports the -drive_access parameter

See merge request systemrescue/systemrescue-sources!179
2022-02-23 17:58:17 +00:00
Francois Dupoux 860df60dab Fix the type of the default definition of parameter "ar_attempts" (#266) 2022-02-23 07:19:31 +00:00
Gerd v. Egidy aa6dac4bb4 ensure that the installed xorriso version supports the -drive_access parameter 2022-02-22 21:11:56 +01:00
Francois Dupoux c15d70c558 Added support for loading remote yaml configuration files over http/https (#254) 2022-01-30 09:17:14 +00:00
fdupoux 21bd2294db Update exit status if there are errors in /usr/bin/sysrescue-configuration.lua 2022-01-29 17:59:54 +00:00
Francois Dupoux 0f0d899552 Allow to use option sysrescuecfg to restrict which local yaml config files to process (#254) 2022-01-29 12:34:03 +00:00
fdupoux 520b80e65e Improve processing of options passed on the boot command line 2022-01-28 21:50:17 +00:00
Francois Dupoux 35bd8314f3 Use generic logic for overriding config entries from values in yaml config files (#251) 2022-01-28 20:34:23 +00:00
Francois Dupoux ca6bcd6548 Implement the primary configuration processing script in lua (#251) 2022-01-26 20:07:53 +00:00
Gerd v. Egidy 0d040c97f8 add the directory names for --auto mode to the help output 2022-01-15 22:50:57 +01:00
Gerd v. Egidy 90d494026f fix confusion of sysrescue-customize and systemrescue-customize in online help
The script is called "sysrescue-customize", so make sure to use that everywhere.
2022-01-15 22:43:13 +01:00
Gerd v. Egidy 770ce976ba fix typo in help message of systemrescue-customize 2022-01-11 23:51:36 +01:00
Gerd v. Egidy 048c1724bf easy way to use squashfs pseudofile: allows to override mode uid gid of files in the SRM
When using a non-root user to execute sysrescue-customize with the srm building function,
you won't have the rights to create files owned by root. When you want to keep the build_into_srm
dir in a git tree, you won't be able to store the file mode there. But using a specific file
mode is important for example for /root/.ssh

The mksquashfs pseudo file allows to solve this by overriding individual file modes like this:

cat <<EOF >recipe_dir/build_into_srm/.squashfs-pseudo
/root/.ssh m 700 root root
/root/.ssh/authorized_keys m 600 root root
EOF
2022-01-10 22:47:21 +01:00
fdupoux 13723f10b0 Rename default yaml config files 2022-01-09 17:19:53 +00:00
Gerd v. Egidy e66518dbae add sysrescue-customize script: allows to modify existing SystemRescue .iso images 2022-01-09 17:14:40 +00:00
Gerd v. Egidy 89b721e142 add ldd check for modesetting_drv.so too
modesetting_drv.so is the library that links to libgbm.so. We not only want
that libgbm.so has all dependecies satisfied, but also the lib that needs
libgbm.so in the first place.
2021-12-31 11:53:00 +01:00
fdupoux a00ea8d566 Update /usr/bin/check-binaries.sh to reflect the current custom packages 2021-12-31 08:10:34 +00:00
Gerd v. Egidy 885dce5e11 add the SystemRescue website as offline documentation 2021-12-30 14:09:33 +00:00
fdupoux 77dbde7a8b Add dump/restore utilities (#226) 2021-11-07 11:16:00 +00:00