Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/luks.py
AgeCommit message (Collapse)Author
2023-05-11Cleanup imports and unused code (#1801)Daniel Girtler
* Cleanup imports and unused code * Update build check * Keep deprecation exception * Simplify logging --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
2023-05-04Update `SysCommand()` calls in remaining files (#1707)Daemon Coder
2023-04-19PyParted and a large rewrite of the underlying partitioning (#1604)Daniel Girtler
* Invert mypy files * Add optional pre-commit hooks * New profile structure * Serialize profiles * Use profile instead of classmethod * Custom profile setup * Separator between back * Support profile import via url * Move profiles module * Refactor files * Remove symlink * Add user to docker group * Update schema description * Handle list services * mypy fixes * mypy fixes * Rename profilesv2 to profiles * flake8 * mypy again * Support selecting DM * Fix mypy * Cleanup * Update greeter setting * Update schema * Revert toml changes * Poc external dependencies * Dependency support * New encryption menu * flake8 * Mypy and flake8 * Unify lsblk command * Update bootloader configuration * Git hooks * Fix import * Pyparted * Remove custom font setting * flake8 * Remove default preview * Manual partitioning menu * Update structure * Disk configuration * Update filesystem * luks2 encryption * Everything works until installation * Btrfsutil * Btrfs handling * Update btrfs * Save encryption config * Fix pipewire issue * Update mypy version * Update all pre-commit * Update package versions * Revert audio/pipewire * Merge master PRs * Add master changes * Merge master changes * Small renaming * Pull master changes * Reset disk enc after disk config change * Generate locals * Update naming * Fix imports * Fix broken sync * Fix pre selection on table menu * Profile menu * Update profile * Fix post_install * Added python-pyparted to PKGBUILD, this requires [testing] to be enabled in order to run makepkg. Package still works via python -m build etc. * Swaped around some setuptools logic in pyproject Since we define `package-data` and `packages` there should be no need for: ``` [tool.setuptools.packages.find] where = ["archinstall", "archinstall.*"] ``` * Removed pyproject collisions. Duplicate definitions. * Made sure pyproject.toml includes languages * Add example and update README * Fix pyproject issues * Generate locale * Refactor imports * Simplify imports * Add profile description and package examples * Align code * Fix mypy * Simplify imports * Fix saving config * Fix wrong luks merge * Refactor installation * Fix cdrom device loading * Fix wrongly merged code * Fix imports and greeter * Don't terminate on partprobe error * Use specific path on partprobe from luks * Update archinstall/lib/disk/device_model.py Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> * Update archinstall/lib/disk/device_model.py Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> * Update github workflow to test archinstall installation * Update sway merge * Generate locales * Update workflow --------- Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se> Co-authored-by: Anton Hvornum <anton.feeds+github@gmail.com> Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com>
2023-03-26Change exit status indications to exit codes (#1685)codefiles
2022-07-26Cleanup partition (#1333)Daniel Girtler
* Cleanup partition * Update * Remove unused method * Update partitioning * Update * Update * Fix mypy Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
2022-05-26Rework btrfs handling (#1234)Anton Hvornum
* Restructuring btrfs.py into lib/btrfs/*.py * Reworking how BTRFS subvolumes get represented, and worked with. Subvolumes are now their own entity which can be used to access it's information, parents or mount location. * Added BtrfsSubvolume.partition and other stuff. * Reworking the way luks2().unlock and .format() returns device instances. They should now return BTRFSSubvolume where appropriate. * Fixed a missing import * Fixed an issue where mkfs.btrfs wouldn't trigger due to busy disk. * Fixing subvol mounting without creating a fake instance. * Added creation of mountpint for btrfs subvolume * Fixed root detection * Re-worked mounting into a queue system using frozen mounting calls using lambda * Removed old mount_subvolume() function * Removed get_subvolumes_from_findmnt() * Fixed Partition().subvolumes iteration * Adding .root to BtrfsSubvolume * Fixed issue in SysCommandWorker where log output would break and crash execution due to cmd being a string vs list * Changed return-value from MapperDev.mountpoint to pathlib.Path
2022-04-29unlocked luks2 partitions were missing a BlockDevice parameter. It's ↵Anton Hvornum
technically not the true block device, as the mapper dev belongs to a partition, but in this context blockdev means the harddrive/medium that the partition (unlocked or otherwise) lives on. (#1100)
2022-02-07Calling Partition().partprobe() instead of general partprobe. This avoids ↵Anton Hvornum
read-only issues and lets Partition().partprobe() deal with the error checks.
2022-01-06Define an standard locale for all the commands executed (#827)Werner Llácer
* Define an standard locale for all the commands executed inside the application * Allow LC_ALL to be overriden during call * flake8 corrections
2022-01-06Added type annotations to all functions (#845)Anton Hvornum
* Added type annotations for 1/5 of the files. There's bound to be some issues with type miss-match, will sort that out later. * Added type hints for 4/5 of the code * Added type hints for 4.7/5 of the code * Added type hints for 5/5 of the code base * Split the linters into individual files This should help with more clearly show which runner is breaking since they don't share a single common name any longer. Also moved mypy settings into pyproject.toml * Fixed some of the last flake8 issues * Missing parameter * Fixed invalid lookahead types * __future__ had to be at the top * Fixed last flake8 issues
2021-12-31Btrfs2 (#787)Werner Llácer
* All the changes needed to make btrfs subvolumes work. It boils down to two points; the handling of the addressing of subvolumes re. physical partitions, and the small changes at the bootloader level * We added a new script only_hd for testing purposes. It only handles hadrd drive management * restoring an escape hatch during subvolume processing * hipercommented manage_btrfs_subvolumes * Ready to be able to select and process options in subvolume mounting * Separte nodatacow processing * Solving a flake8 complain * Use of bind names @ get_filesystem_type * compress mount option bypass * Preparations for encryption handling * Compatibility to master version re. encrypted btrfs volumes * Now we can create subvolumes and mountpoints inside an encrypted btrfs partition * changes for entries file generation with systemd-bootctl * flake8 corrections plus some comments Co-authored-by: Anton Hvornum <anton@hvornum.se>
2021-11-24Support encrypting multiple partitions (#759)Anton Hvornum
* Added support for storing disk encryption keyfiles and add them to a keyslot. * Added a luks2().add_key() function in order to inject a keyfile into a keyslot on a encrypted volume. * Simplified 'missing encryption password' logic in Filesystem(). Added a call to luks2().add_key() after the root-password is set on the volume, to add the keyfile in slot 2 * Adding in password handling in luks2().add_key(). It's required to enter a previous passphrase to unlock the volume and add a new keyslot. Also simplified the handling of partition in Installer().mount_ordered_layout() * Adding in encryption on all partitions except /boot when encryption is opted in * Removed setting size on Partition() as it's a read only value. No idea how Partition().size = size hasn't caused an issue before. Removed size=X argument to Partition() * Added a uniqueness to the loopdevice name. This should ensure that multiple encrypted volumes can be opened at the same time, except for Partition().detect_inner_filesystem() operations which can only happen one at a time since they share namespace. This should never be an issue since archinstall is single threaded and no concurrent operations can/should happen. * Added partprobe() as part of disk/helpers.py, added a /dev/ -> UUID mapper function called convert_device_to_uuid(path). Added a luks2().crypttab() function that sets up a /etc/crypttab entry. * Moved the responsability for telling archinstall to generate a keyfile from Filesystem() to user_interaction.py. This should in the future be a user-input based value, and not something the Filesystem() automatically dictates. * Added a retry mechanism to luks2().encrypt() to avoid having to re-start the installation when a device simply wasn't up yet. * Swapping UUID= lookup from loopdev to physdev.
2021-11-11Added more partprobe'sAnton Hvornum
2021-11-05Cleaned up all flake8 issues/warnings. Did some code cleaning as well, ↵Anton Hvornum
mostly how we called things in guided.py but also some SysCommand calls
2021-06-13Removed old safety logics for partitions. Partitions will now always be ↵Anton Hvornum
formatted when .format() is called on them. The safety now lay in the code parsing the declerative partition layouts. Also added the encrypt/mount logic for encrypted partitions, which by default will be unencrypted unless a password is specified.
2021-05-18Incorrect variable names being used from copy paste.Anton Hvornum
2021-05-15Perform refactoring to PEP 8 naming conventionsDylan Taylor
2021-05-15More formatting fixes to satisfy PEP 8Dylan Taylor
2021-05-15Many more manual changesDylan Taylor
2021-04-27Moving away from custom log levels, to something that's well defined. (#360)Anton Hvornum
* Moving away from custom log levels, to something that's well defined. * Added backward compability to log() as well. * Added an option to force log messages out on screen even if the level is below the log level threashold. * Added force log messages when wrong notation is used. * Added some more length to the deprecated message * Swapped all log levels to use logging.<level> instead. Co-authored-by: Anton Hvornum <anton.feeds@gmail.com>
2021-04-11Change from argon2i to argon2idDylan M. Taylor
Closes #269
2021-04-10fix typoNicoHood
2021-04-09Fix typo that causes crash when creating encrypted LUKS partition (closes #248)Alexander Seiler
2021-04-08Added a safety check to verify that the encrypted partition exists at least ↵Anton Hvornum
before trying to open it.
2021-04-05Removed a TODO commentAnton Hvornum
2021-04-03This should correct #135. I'll have to investigate other places where this ↵Anton Hvornum
logic might be as well and correct those.
2021-04-02Join cryptsetup args using shlexPyfisch
Ensure that all arguments are properly quoted. Improve readability by using long-form arguments only. Use identical arguments for both cryptsetup calls, to prevent them from accidentally diverging in future commits.
2021-04-01Missing variableAnton Hvornum
This should fix #135
2021-03-29Added support for flushing a BlockDevice() cache after a partition has been ↵Anton Hvornum
formatted. This is to avoid internal confusion of which partitions are encrypted or not when going from Encrypted -> Un-encrypted setups.
2021-03-14Using 'umount -R' rather than just 'umount' since we're going to wipe the ↵Anton Hvornum
partition, we need do unmount anything that's mounted beneeth it to continue.
2021-03-14Removed redundant error handling as well as added some more debug logs.Anton Hvornum
2021-03-14Enhanced the error handling on crypt-devices.Anton Hvornum
2021-03-14Some more error handling.Anton Hvornum
2021-03-14Tweaked SysCallError() exception to include the exit code in a machine ↵Anton Hvornum
readable manner. Since it's useful as an indicator where calls might go wrong and for what reason.
2021-03-14Added a partition.umount() and a check when running cryptsetup if the disk ↵Anton Hvornum
is in use.
2021-03-09Carried over the allow_formatting from the parent device of luks2() devices.Anton Hvornum
2021-03-09Forgot to set a variableAnton Hvornum
2021-03-09Added option to skip autodetection of filesystem. This is so for instance ↵Anton Hvornum
luks2() can override any auto-detection that revers back to the parent device of the mapped device, which would be crypto_LUKS instead of None for the inner partition.
2021-03-09Added some debugging.Anton Hvornum
2021-03-09Fixed luks2().close() to properly detect it's own mapped pathAnton Hvornum
2021-03-09Fixed luks2().close() to properly detect it's own pathAnton Hvornum
2021-03-09Added functions to auto-detect filesystems inside encrypted partitions ↵Anton Hvornum
(given a password)
2021-03-09Adding encryption helpers to the Partition() class, that sets up and ↵Anton Hvornum
utilizes luks2.encrypt() in extension.
2021-03-08Reworked the guided partitioning logic to better match new expectations of ↵Anton Hvornum
flexability. Still some work to be done and features to be implemented, but the structure is taking place
2021-02-11Reworked the way partition formatting works. As well as added some flags to ↵Anton Hvornum
the partition if it's locked/unlocked for partitioning. By defaults partitions will now be in a locked state - prohibiting formatting unless set or overridden in the formatting call. This allows us to selectively format partitions individually later on. There's also a target_mountpoint that is the desired relative mount point inside a installation. This can be pre-pended with the installation base directory during mount. These changes also function as indicators for the installation (and guided installation) for which partitions to use and/or wipe. If an entire drive is selected for wiping, these changes will have no affect in the decision making as all partitions will be new and have formatable set to true.
2021-01-24Added debug output as well as corrected output formatting in log().Anton Hvornum
2021-01-24Trying to centralize the configuration for logging. Phasing out some ↵Anton Hvornum
parameters which also affects the current ability to create multiple log files for multiple runs. This will be re-introduced when logging is made into a class object in a later version
2020-11-04Added multiple log features.Anton Hvornum
* [Reintroduced](https://github.com/Torxed/archinstall/blob/f64a605449f59c677dff39962f1cb46616d893b7/archinstall.py#L57-L71) log levels * Created a global log file definition * Optional support for `python-systemd`'s journald handler. * Optional file output that has a globally configurable definition, that archinstall will honor in `archinstall.storage['logfile']`.
2020-10-19Fix some PEP-8 errors.Varun Madiath
2020-07-08Trying to sort out a boot issueAnton Hvornum