Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard fsck isn't run on VM startup #979

Closed
nrgaway opened this issue Apr 29, 2015 · 7 comments
Closed

Standard fsck isn't run on VM startup #979

nrgaway opened this issue Apr 29, 2015 · 7 comments
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: core eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) P: minor Priority: minor. The lowest priority, below "default." T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.

Comments

@nrgaway
Copy link

nrgaway commented Apr 29, 2015

/rw is not mounted in the standard way from /etc/fstab, because of for example DispVM, which does not have /rw mounted at all. This is also the reason why standard fsck isn't run on VM startup.

Possible solutions:
Add feature to qubes-manager to:

  1. Show if there is disk error
    2 .Check disk
    3 .Repair disk
@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. C: core P: minor Priority: minor. The lowest priority, below "default." labels May 12, 2015
@marmarek marmarek added this to the Release 3.1 milestone May 12, 2015
@marmarek
Copy link
Member

marmarek commented Aug 5, 2015

Currently if one want to run fsck on /rw, it requires:

  1. Adding single parameter to kernel command line (qvm-prefs -s VMNAME kernelopts single)
  2. Starting VM - it would timeout on qrexec connection, but that's ok.
  3. Access VM console using sudo xl console VMNAME
  4. Get shell access (just press enter when prompted for root password)
  5. Run fsck on /dev/xvdb (/rw): fsck -f /dev/xvdb
  6. Shutdown the VM - poweroff from that shell
  7. Restore default kernel command line: qvm-prefs -s VMNAME kernelopts default

@marmarek
Copy link
Member

We should go with running standard fsck on VM startup. If it isn't desirable for some VM (which doesn't have /rw at all - DispVM), this could be addressed in .mount unit file with some condition.

@cfcs
Copy link

cfcs commented Aug 27, 2015

Alternatively you can run fsck on private.img from dom0 (if you trust fsck to not have security flaws, which is grantedly a risky assumption). Either way it's a required step for shrinking/compacting appvm filesystems to free up space.

@Rudd-O
Copy link

Rudd-O commented Oct 23, 2016

The agent really should detect if there is an error in the kernel ringbuffer or journald log, and submit that error for dom0 to display it in qubes-manager or with a notification.

But this will not cover the case of a system entirely failing to boot. In that case, it's possible that monitoring the console log in dom0 can provide a mechanism that lets the user know (qubes-manager or notification) that the VM is not booting properly, MUCH, much faster than just waiting for a timeout and then just dying.

@v6ak
Copy link

v6ak commented Jul 30, 2019

Hello,
I am not sure if we should reopen this issue or create a new one. This issue does not seem to be fully fixed. There is some interesting part of journalctl output:

Jul 30 07:48:53 localhost mount-dirs.sh[294]: Private device management: checking /dev/xvdb
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Private device management: checking /dev/xvdb
Jul 30 07:48:53 localhost systemd[1]: Started udev Kernel Device Manager.
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Private device management: fsck.ext4 /dev/xvdb failed:
Jul 30 07:48:53 localhost mount-dirs.sh[294]: /dev/xvdb contains a file system with errors, check forced.
Jul 30 07:48:53 localhost mount-dirs.sh[294]: /dev/xvdb: Inodes that were part of a corrupted orphan linked list found.
Jul 30 07:48:53 localhost mount-dirs.sh[294]: /dev/xvdb: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Jul 30 07:48:53 localhost mount-dirs.sh[294]:         (i.e., without -a or -p options)
Jul 30 07:48:53 localhost resize-rootfs-if-needed.sh[293]: dumpe2fs 1.44.5 (15-Dec-2018)
Jul 30 07:48:53 localhost kernel: EXT4-fs (xvdb): warning: mounting fs with errors, running e2fsck is recommended
Jul 30 07:48:53 localhost kernel: EXT4-fs (xvdb): mounted filesystem with ordered data mode. Opts: discard
Jul 30 07:48:53 localhost resize-rootfs-if-needed.sh[293]: root filesystem already at 31041496 blocks
Jul 30 07:48:53 localhost systemd[1]: Started Adjust root filesystem size.
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Checking /rw
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Private device size management: enlarging /dev/xvdb
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Private device size management: resize2fs /dev/xvdb failed:
Jul 30 07:48:53 localhost mount-dirs.sh[294]: resize2fs 1.44.5 (15-Dec-2018)
Jul 30 07:48:53 localhost mount-dirs.sh[294]: resize2fs: Permission denied to resize filesystem
Jul 30 07:48:53 localhost mount-dirs.sh[294]: Filesystem at /dev/xvdb is mounted on /rw; on-line resizing required
Jul 30 07:48:53 localhost mount-dirs.sh[294]: old_desc_blocks = 2, new_desc_blocks = 2
Jul 30 07:48:53 localhost kernel: EXT4-fs warning (device xvdb): ext4_resize_begin:46: There are errors in the filesystem, so online resizing is not allowed

So, the automatic way has failed. I am not notified (unless I read journalctl after every boot) and I am not sure how to do it manually:

$ qvm-block attach disp2095 dom0:/dev/qubes_dom0/vm-XXXXX-private
qvm-block: error: backend vm 'dom0' doesn't expose device '/dev/qubes_dom0/vm-XXXXX-private'

How has this happened? I guess this is related to having a full LVM thin provisioned pool in the past.

@andrewdavidwong andrewdavidwong modified the milestones: Release 4.0 updates, Release TBD Apr 7, 2023
@andrewdavidwong andrewdavidwong added T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. and removed T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. labels Apr 7, 2023
@andrewdavidwong andrewdavidwong modified the milestones: Release TBD, Release 4.1 updates Apr 7, 2023
@andrewdavidwong
Copy link
Member

@v6ak, @nrgaway: Is this still a problem on 4.1?

@andrewdavidwong andrewdavidwong added the affects-4.1 This issue affects Qubes OS 4.1. label Aug 8, 2023
@andrewdavidwong andrewdavidwong removed this from the Release 4.1 updates milestone Aug 13, 2023
@andrewdavidwong andrewdavidwong added the eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) label Dec 7, 2024
Copy link

github-actions bot commented Dec 7, 2024

This issue is being closed because:

If anyone believes that this issue should be reopened, please leave a comment saying so.
(For example, if a bug still affects Qubes OS 4.2, then the comment "Affects 4.2" will suffice.)

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.1 This issue affects Qubes OS 4.1. C: core eol-4.1 Closed because Qubes 4.1 has reached end-of-life (EOL) P: minor Priority: minor. The lowest priority, below "default." T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.
Projects
None yet
Development

No branches or pull requests

6 participants