backintime icon indicating copy to clipboard operation
backintime copied to clipboard

Can't modify settings for a backup disk that is not mounted

Open Saroumane opened this issue 5 years ago • 6 comments

Context : I have 2 backup profiles in backintime:

  • one (called "Local") for backups on an internal SATA HDD.
  • one other (called "Remote") for backups on an external USB HDD that I keep off-site.

What is happening : I can't open Remote profile in backintime, modify settings and save them, EXCEPT when the off-site USB HDD is mounted. If I try to that without the disk, I get "mountpoint is not folder !" (mountpoint is where is he USB HDD is usually mounted) when trying to save modified settings.

And I don't want to create a permanent mountpoint folder, as I let Ubuntu handle USB disk mounting/unlocking (they are automounted in /media/user )

Workaround : edit backintime config file by hand, but it's a bit dangerous and tedious.

What I expect : modify settings for a backup disk that is not mounted.

Saroumane avatar Nov 01 '20 12:11 Saroumane

@Saroumane There is a new forming maintaining team and we do review all issues. Is this problem still relevant for you or did you find a solution?

Tag: Feature, Qt, Discussion

buhtz avatar Sep 25 '22 12:09 buhtz

Hello, ~I just checked : it seems that now Ubuntu (22.04) keeps permanent folders for mountpoints~, I have now a permanent moutpoint in /etc/fstab and thus a permanent folder in /media/root : so I don't have the problem anymore. Maybe @ojob @DanieLoche or @aryoda could tell if they are (still) affected ?

Saroumane avatar Sep 25 '22 14:09 Saroumane

This problem still exists. In my case, there is a profile whose snapshot folder resides under a mountpoint which is writable to my user when the drive is mounted, but non-writable (owned by root) when the drive is unmounted.

When trying to edit the settings for that profile with an unmounted drive, the following message appears:

Screenshot_20220925_165508

In consequence, it is not possible to modify the settings through the GUI while the drive is unmounted.

emtiu avatar Sep 25 '22 14:09 emtiu

I was also stumbling over this problem when I just wanted to change the backup schedule for a non-mounted target device.

I have not re-tested it with Ubuntu 22.04 but 20.04 with the current DEV version (and the issue remains the same by blocking to save the changed profile).

I have now a permanent mountpoint in /etc/fstab and thus a permanent folder in /media/root : so I don't have the problem anymore.

The thing is that

  1. starting a backup without the mounted target device would write the snapshots to your mount point instead of to the external device (maybe even without any notice)
  2. BiT can not list the existing snapshots without accessing the target device
  3. some settings may not be changed if the drive is not mounted (eg. since the "where to save snapshots" folder structure is not completely navigable - the same applies if the "include" files were located on a non-mounted device)

@emtiu I personally would not classify this as a bug but as an overly restrictive GUI and this issue as a feature request.

But anyhow: A possibly better solution could be:

  1. If a source or target drive is not mounted for a selected profile the GUI shall still allow to edit all settings that are NOT related to the mount(s). The other settings (and buttons like "restore" or "take snapshot" are disabled/read-only). Show somewhere a hint that some settings cannot be changed due to the missing mount (status bar or once as a pop-up).
  2. If I want to save a changed profile with a non-mounted device I no longer get a blocking pop-up message ("... is not a folder") but a warning and can still save only the changed parts
  3. The list of snapshots shall be empty but instead of "new" display a hint like "device must be mounted to show existing snapshots". Additionally show a similar warning in the status bar...

Open issue(s):

  1. What is the impact of an existing user-callback script that eg. contains "just-in-time" mounts?

aryoda avatar Sep 25 '22 16:09 aryoda

Information from #962 (closed as duplicate of this Issue): This also affects "Local encrypted" backup locations, where the encryption password is prompted every time a setting is changed.

In the same way, I imagine (but have not tested) that "SSH encrypted" locations are also affected, as well as "SSH" locations, if they require an interactively entered password/key passphrase.

emtiu avatar Oct 09 '22 10:10 emtiu

I think I could implement a minimal "no mount-relevant changes" check by comparing the GUI state (values from the Qt widgets) with the current config values and suppress the validations that require an accessible mount.

What I could implement: If no mount-relevant settings have been changed I could ask the user if the settings shall be saved without validating the snapshot target settings (since they are unchanged).

The challenge is that I cannot easily recognize a missing mount without provoking the unwanted error message(s).

This is imperfect because a user could choose "yes, save without snapshot target validation" even though the mount may be available for validation and the validation error is postponed (happens when the next backup starts)

I see no easy implementation without digging deeper so I stop here now to work on higher prioritized issues for the next stabilized BiT release before coming back here...

Current implementation

  1. The config file is always saved when you click OK in the settings button by calling

    https://github.com/bit-team/backintime/blob/b4dd2d1737c5031d264d667c18f6987a1916762b/qt/settingsdialog.py#L1753-L1755 which calls the "validation" of the profile (misnamed, should be named eg. saveProfileAction)

    https://github.com/bit-team/backintime/blob/b4dd2d1737c5031d264d667c18f6987a1916762b/qt/settingsdialog.py#L1497-L1507

    which firstly updates the in-memory config object from the GUI state (Qt widgets) by calling this method (misnamed, should be eg. updateConfigFromGuiState)

    https://github.com/bit-team/backintime/blob/b4dd2d1737c5031d264d667c18f6987a1916762b/qt/settingsdialog.py#L1200

    and is doing then some more checks for invalid paths in self.config.checkConfig and updating the crontab in setupCron.

  2. The validation errors preventing to store the changes are thrown from

    " is not folder !" + "Can't write to: ... Are you sure you have write access ?": -> `settingsdialog.saveProfile() https://github.com/bit-team/backintime/blob/b4dd2d1737c5031d264d667c18f6987a1916762b/qt/settingsdialog.py#L1417

    Ask for password...: -> when mounting in saveProfile() during the preMountCheck:

    https://github.com/bit-team/backintime/blob/b4dd2d1737c5031d264d667c18f6987a1916762b/qt/settingsdialog.py#L1359

aryoda avatar Oct 09 '22 17:10 aryoda