Commit Graph

49 Commits

Author SHA1 Message Date
icequbes1
c25513f930
Fix comments in default qubes-firewall-user-script 2021-01-02 13:11:18 -08:00
Marek Marczykowski-Górecki
519e82b7c0
init/functions: do not guess 'eth0' as Qubes-managed interface
... if it doesn't exist.
The /qubes-mac qubesdb entry is present on Qubes 4.1, but not 4.0. It is
ok to depend on it here, but keep safer fallback if this code would need
to be backported.
2020-12-04 12:30:57 +01:00
Marek Marczykowski-Górecki
8a3cd3db1d
Make init/functions suitable for running with 'set -u'
Initialize local variables.
2020-12-04 03:24:03 +01:00
Marek Marczykowski-Górecki
05a213a7e3
Relax private.img condition for mkfs even further
Check just 10 MiB of the private volume + blkid before considering it
empty and calling mkfs. Avoid reading 1GB of data at the VM boot -
which should speed up startup even further, especially for fresh
DispVMs.

QubesOS/qubes-issues#3758
2020-11-06 16:00:31 +01:00
Amber M. Breslau
22a3346f5d
init/setup-rwdev: don't write a journal in DispVMs 2020-02-14 11:35:05 -05:00
Amber M. Breslau
be9155ef11
init/functions: fix DispVM detection 2020-02-14 11:24:29 -05:00
Marek Marczykowski-Górecki
d2c28d12a2
Remove dead code 2019-07-05 20:35:31 +02:00
Frédéric Pierret (fepitre)
3f5dc53d75
init/functions: better not use ipcalc which is not present on minimal distro 2019-06-23 09:59:37 +02:00
Frédéric Pierret (fepitre)
967060eb32
init/functions: handle non-present /qubes-mac qubesdb and check if iface exists 2019-06-20 16:09:24 +02:00
Frédéric Pierret (fepitre)
325eff2b13
Refactor and handle new network qubesdb configuration 2019-06-18 18:49:42 +02:00
Frédéric Pierret (fepitre)
f7dd41206d
setup-ip: only assign IP configuration of Qubes managed iface 2019-05-21 17:21:51 +02:00
Frédéric Pierret (fepitre)
902da9f837
Handle default value for get_iface_from_mac 2019-05-21 17:21:51 +02:00
Frédéric Pierret (fepitre)
da162d7615
Handle default value for get_qubes_managed_iface 2019-05-21 17:21:51 +02:00
Frédéric Pierret (fepitre)
0ce79d4895
Handle non-default 'eth0' Qubes managed interface 2019-05-16 17:32:50 +02:00
AJ Jordan
593724c05b
Use dumpe2fs for filesystem size calculations
The previous approach used `df` to get usable space and then added a
fixed size to that number in order to account for filesystem
overhead. However, at some point that stopped working for me. It
appears that ext4 filesystem overhead can vary over time or because of
other factors. (Certainly now that I think about it the old code would
only work well for people with the exact same filesystem size as me.)

So the new approach is to just completely ignore what `df` tells us
and instead go directly to the source: the filesystem's internal
notion of exactly how much space it takes up. We use `dumpe2fs` to
retrieve this information and calculate the on-disk size dynamically
from that. Then we add the space that boot data takes up (unchanged),
and we add 5MB padding because when I tested this it didn't quite add
up otherwise. https://unix.stackexchange.com/a/13551/29146 suggests
that this unaccounted-for data may be e.g. additional copies of the
superblock.
2019-02-07 16:04:11 -05:00
Bo Rydberg
c9ec752923
Update spelling in setup-rw.sh 2018-12-14 17:07:28 +01:00
Marek Marczykowski-Górecki
8216e40007
Merge remote-tracking branch 'origin/pr/141'
* origin/pr/141:
  is_protected_file: if no config dir is present, assume the file is _not_ protected
  /rw/config
  Fix logic bug.
  Allow per-VM protected file list
2018-12-06 17:28:45 +01:00
Marek Marczykowski-Górecki
8ce95f0db1
is_protected_file: if no config dir is present, assume the file is _not_ protected 2018-12-06 14:44:42 +01:00
Marek Marczykowski-Górecki
d92204e094
Merge remote-tracking branch 'origin/pr/145'
* origin/pr/145:
  Rephrase comment
2018-12-02 16:10:20 +01:00
AJ Jordan
235d44e632
Add quotes to placate ShellCheck 2018-12-01 19:30:07 -05:00
AJ Jordan
0f3b4985c3
Correct size_margin for rootfs resizes
See
https://github.com/QubesOS/qubes-core-agent-linux/pull/146#discussion_r238080117
for details; but tl;dr:

* Journal size is 64M
* Inode table is 256 bytes * 643376 inodes allocated = ~157M
* Reserved GDT blocks take up 1024 blocks * 4096 byte block size = 4M
* Fixed-size parts of the filesystem probably take up another MB or
  two

These actually adds up to more than the 222M number used in this
commit. But it seems _about_ right, so just Ship It(tm).
2018-12-01 18:46:46 -05:00
AJ Jordan
c05310f61c
Revert "Fix root volume size comparison"
This reverts commit 8000e76d43, because
as @marmarek pointed out, the original was correct and I totally
misread. The check in question is checking whether to _abort_, not
whether to continue. So we want to check if the block device size is
_less_ than the filesystem + margin, not more.

Reopens QubesOS/qubes-issues#4553
2018-12-01 16:19:56 -05:00
AJ Jordan
737a65e5e7
Rename variable to be more clear 2018-12-01 00:01:04 -05:00
AJ Jordan
ce78625bec
Remove weird spaces from script output 2018-12-01 00:01:02 -05:00
AJ Jordan
8000e76d43
Fix root volume size comparison
Fixes QubesOS/qubes-issues#4553
2018-12-01 00:00:57 -05:00
AJ Jordan
98a6b60a49
Remove unnecessary quotes 2018-11-30 23:56:13 -05:00
AJ Jordan
bc6c729a82
Simplify block number calculation 2018-11-30 23:46:09 -05:00
AJ Jordan
b85c1cec75
Rephrase comment 2018-11-28 23:25:09 -05:00
Rudd-O
03883ece96
/rw/config 2018-11-15 19:08:46 +00:00
Rudd-O
3b93db99f8
Fix logic bug. 2018-10-24 08:00:20 +00:00
Rudd-O
1ecb680b44
Allow per-VM protected file list
Hopefully this can be pushed as an update for Qubes 3.2 as well?
2018-10-24 07:32:19 +00:00
Marek Marczykowski-Górecki
581d9c12ed
Fix detection of root device resize
If xvda is not partitioned, checking size of device mounted as root dev
doesn't detect xvda resize - it will have the new size, while the fs on
it not. Change to checking actual filesystem size.

Also, improve log message to include the size.

Fixes QubesOS/qubes-issues#4274
2018-09-04 18:12:07 +02:00
Peter Gerber
8ff9cbe299
setup-rwdev.sh: Only check first 1 GiB for zeros
As described in QubesOS/qubes-issues#3758, a VM may fail to start
if the volume is large. This because the whole volume is read to
ensure it's empty (=all zeros).

This changes limits the check to the first 1 GiB of the private
volume. As additional safety, a scan with blkid is done.

Fixes https://github.com/QubesOS/qubes-issues/issues/3758
2018-07-03 20:07:12 +00:00
Marek Marczykowski-Górecki
82937e129e
Use only /etc/skel to provision user's home directory of new VM
Get rid of non-standard /home.orig handling.

Fixes QubesOS/qubes-issues#3771
2018-04-13 00:35:08 +02:00
Marek Marczykowski-Górecki
1781568d08
Speed up initial /rw setup
On first VM's boot, setup-rwdev.sh script create filesystem on
/dev/xvdb. But it does so only after checking if /dev/xvdb is really
empty, by comparing it to /dev/zero. Speed up reads from /dev/zero bu
using larger blocks (default of head - 8k, instead of explicit 512).
This speed up the check over 5 times.
2018-02-27 05:12:44 +01:00
TomZ
3abc3b1b75
Fix language issues and usability issue 2017-12-13 10:15:20 +01:00
Marek Marczykowski-Górecki
1ed6e614ab
Resize root filesystem at VM startup if needed
Check if root device was enlarged while domain was powered off and
resize the filesystem in such a case.

QubesOS/qubes-issues#3173
QubesOS/qubes-issues#3143
2017-10-18 21:02:15 +02:00
Marek Marczykowski-Górecki
aad6fa6d19
Hint shellcheck where to look for sourced files, if in repository
This will ease running shellcheck from the repository.
2017-09-30 05:05:34 +02:00
Marek Marczykowski-Górecki
8bb152f76e
init: fix issues found by shellcheck in init scripts
Most of them are missing quotes, `` -> $(), and -o/-a usage in
conditions. Also add few directives disabling checks where were too
verbose.
2017-09-30 04:49:21 +02:00
Marek Marczykowski-Górecki
7e608a8bb4
Remove DisposableVM savefile related files
In Qubes 4.0 we no longer use two-stage DisposableVM startup.
2017-06-08 22:11:35 +02:00
Marek Marczykowski-Górecki
9a7dee5b46
dispvm: don't use perl to decode base64-encoded script
This looks like an overkill. And more importantly - required modules are
not installed by default, making it impossible to use in default minimal
template.

Fixes QubesOS/qubes-issues#1610
2017-05-14 23:29:52 +02:00
Marek Marczykowski-Górecki
9f9c3c56fc
Use online resize2fs, and run filesystem check only when needed
When trying offline resize2fs, it require running fsck first, which
takes time, especially on large volumes. And in most cases, resize2fs
will notice that no action is needed - after wasting some time on fsck.
To remedy this, use resize2fs in online mode (on mounted filesystem).
And drop fsck call if it fails (filesystem is already mounted
read-write, running fsck isn't good idea).

But do not remove fsck call completely - still call it, but without '-f'
flag, so it run actual check only when really needed (unclean shutdown,
last check far in the past etc).

Fixes QubesOS/qubes-issues#979
Fixes QubesOS/qubes-issues#2583
2017-02-27 04:21:59 +01:00
Marek Marczykowski-Górecki
a69acdabbf
Merge remote-tracking branch 'qubesos/pr/24'
* qubesos/pr/24:
  Initialize home_volatile for disposable VMs.
2016-11-17 09:33:02 +01:00
Marek Marczykowski-Górecki
dbcd3e5f0a
Write random seed directly to /dev/urandom
Don't store it in some variable, as may contain non-ASCII or control
characters (or starts with '-').
2016-11-17 09:30:49 +01:00
Patrick Schleizer
b1f418ca76 fix reload_random_seed error handling
https://github.com/QubesOS/qubes-core-agent-linux/pull/21#pullrequestreview-8302473
2016-11-13 23:37:49 +01:00
Manuel Amador (Rudd-O)
6ca10b42eb Initialize home_volatile for disposable VMs. 2016-11-13 21:20:46 +00:00
Manuel Amador (Rudd-O)
60adadff73 Invert logic of systemd_version_changed. 2016-10-28 05:02:53 +00:00
Manuel Amador (Rudd-O)
40db82a79f Better private.img size management. 2016-10-26 12:59:50 +00:00
Manuel Amador (Rudd-O)
59aec8e5eb Clean up early initialization and setup of /rw 2016-10-23 20:19:51 +00:00