9966 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
bf9005ac48
*: Use action_utils.run instead of subprocess.call
- This is to capture stdout and stderr and transmit that from privileged daemon
back to the service to be displayed in HTML.

Tests:

- Unit tests and code checks pass.

- Some of the modified actions work as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:55 +03:00
Sunil Mohan Adapa
80e6d940a4
*: Use action_utils.run instead of subprocess.check_call
- This is to capture stdout and stderr and transmit that from privileged daemon
back to the service to be displayed in HTML.

Tests:

- Unit tests and code checks pass.

- Some of the modified actions work as expected.

- systemd daemon-reload is performed during infinoted setup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:54 +03:00
Sunil Mohan Adapa
61ff15a04f
*: Use action_utils.run instead of subprocess.run
- This is to capture stdout and stderr and transmit that from privileged daemon
back to the service to be displayed in HTML.

Tests:

- Unit tests and code checks pass.

- Some of the modified actions work as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:53 +03:00
Sunil Mohan Adapa
355812c9f2
actions_utils: Fix issue with collecting stdout/stderr
- When an exception is raised in subprocess.run(), for that call the stdout and
stderr are not being collected. Any previous successful calls are being
collected.

- This also fixes issues with adding an existing backup repository back after
removal. Capturing stderr is essential for raising the proper exceptions and
working correctly.

Tests:

- Remove an existing backup repository and add it back again. It fails with the
patches and succeeds with the patches.

- Remove an existing encrypted backup repository and add it back again with the
wrong password. A proper error message is shown 'Incorrect encryption
passphrase'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:51 +03:00
Sunil Mohan Adapa
f559870d3e
actions: Fix lifetime of thread local storage
- A local storage object must exist globally shared by all threads. Then
object.__dict__ is the thread specific storage. Absent this, when multiple
actions run in parallel, one will erase the thread local object of another.

Tests:

- When an error is raised in a privileged method, then the HTML error shown
contains stdout and stderr of the involved processes.

- Running functional tests on a lot of apps does not show this error anymore.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:50 +03:00
Sunil Mohan Adapa
2fbaea191f
setup: Log full exception traceback when setup fails
- When an error occurs during setup thread execution and the error is not due a
failed privileged action, we are left with very little information about what
went run. On the other than when a privileged action fails, we will be logging
the exception twice. But this is okay.

Tests:

- Increment the setup version of one of installed apps and raise an exception in
setup() method. Notice that exception traceback in the logged message.

- Increment the setup version of one of installed apps and raise an exception in
setup's privileged action. Notice that exception traceback in the logged
message twice.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:49 +03:00
Sunil Mohan Adapa
a43082308d
actions: Log full exception from privileged daemon on error
- This make it easy to find issues when looking at either main service logs or
privileged daemon logs.

Tests:

- Raise an exception in one of the privileged actions. Notice that the exception
is printed along with module name, action_name, stdout, stderr and traceback.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:48 +03:00
Sunil Mohan Adapa
5566f05cad
config: Set home page to FreedomBox for invalid values
- When attempting to set an invalid shortcut ID or invalid user's directory as
home page, set FreedomBox UI as home page.

- Simplify the tests somewhat and avoid failure first time and skipping the test
next time.

Tests:

- Run unit tests as 'root' and 'fbx' users.

- Set home page to apache default, FreedomBox, user home page and a shortcut.
The set value is retained. The change works when visiting / with browser. The
value is as expected in Apache configuration.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:47 +03:00
Sunil Mohan Adapa
647e72516c
backups: Fix robust handling of known errors
During functional tests, it was noticed that getattr() failed at the following
line. The original intent of the code is to ensure that there are no failures
when 'stdout'/'stderr' attribute are not present or when they return None.

    stdout = (getattr(err, 'stdout') or b'').decode()

Tests:

- Make the UI raise incorrect password error. Notice that the error is shown
properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:47 +03:00
Sunil Mohan Adapa
daca4d1d9c
actions: Log method arguments in privileged daemon
- This change means that when invalid module or action name is provided, the log
message is not printed. However, this is acceptable as those cases are rare in
production and are logged properly on the client side.

Tests:

- Run diagnostics for an app and notice that arguments are printed in privileged
daemon's journald logs.

- Remove a password from bepasty app and notice that the password argument is
not logged.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:46 +03:00
Sunil Mohan Adapa
1ad48ecad8
d/rules: Drop a workaround for dh_installsytemd needed for /usr/lib
Since debhelper 13.11.6, we don't need this hack as dh_installsystemd recognizes
the files in /usr/lib/systemd/ directory in addition to /lib/systemd/.

Tests:

- After build package with gbp. Notice that postinst script has code inserted by
dh_installsystemd for starting/restarting the service.

- Install the deb package starts service. Reinstalling the package restarts the
service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:45 +03:00
Sunil Mohan Adapa
0fdf59b9f0
privileged_daemon: Implement handling termination signal
- And gracefully terminate the process after finishing the current requests
underway.

Tests:

- Trigger a long operation such as an app installation. While the operation is
underway, run 'systemctl stop freedombox-privilved.service'. Journal will show
that the SIGTERM is handled and shutdown is more or less immediately complete.
However, the whole process will wait until the ongoing request is complete and
then exit.

- During the wait period, no new requests are accepted as experienced with
'freedombox-cmd plinth is_package_manager_busy --no-args' command.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:44 +03:00
Sunil Mohan Adapa
636b4cabd8
actions: Work with older privileged daemon
- Older privileged daemon before 25.10 did not return the stdout/stderr
properties as part of an exception. During upgrade, there is a 5 minute time
window (longer if the privileged daemon is continuously used) when privileged
daemon is the old version and the service is the newer version. During this time
any exception in the privileged task will cause this problem.

- Our goal is not to always provide backward compatibility to old version of
privileged daemon as the web interface and privileged daemon are expected to be
upgraded at the same time. However, this one is easy and is complementary to a
separate fix that addresses the core problem.

Tests:

- Perform an operation that raises an Exception in a privileged method. The
error is properly shown as an HTML message but without stdout and stderr.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:43 +03:00
Sunil Mohan Adapa
288b58e0b5
storage: Fix disk usage checking with disconnected SSH mounts
- When disconnected sshfs mounts are present, then df command prints the disk
usage for the remaining disks but prints a warning to the stderr and return a
non-zero return code. Accommodate this case and parse the information for all
the available disks.

Tests:

- Create a remote backup location and mount it. When the SSH process is killed,
it leaves a mount point that is not properly connected. View the storage page to
see that disk usage for other partitions is shown properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:42 +03:00
Sunil Mohan Adapa
7c0fa00536
doc: Add manual page for freedombox-cmd
Tests:

- 'make -C doc' succeeds. 'man doc/freedombox-cmd.1' shows the manual page.

- Building and install .deb package installs the manual page to appropriate
location.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:42 +03:00
Sunil Mohan Adapa
c2d5d1d3c8
privileged_daemon: Fix showing errors for freedombox-cmd command
Tests:

- When arguments are not provided to freedombox-cmd it shows errors on the
console.

- When a command is successfully executed, the output is printed on the console.

- The output of the privileged daemon goes to the journald.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:41 +03:00
Sunil Mohan Adapa
c8f89e3ca5
action_utils: Handle capture_output argument in run wrapper
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:40 +03:00
Sunil Mohan Adapa
e227e9a919
Makefile: Move privileged daemon to /usr/lib/freedombox
Tests:

- Running make install installs to /usr/lib/freedombox. Non-privileged users
don't find it in the path. root user does.

- New service file contains path to /usr/lib/freedombox/. Actions works as
expected.

- Build and install the debian package. Privileged daemon runs as expected and
first setup steps complete as expected. First wizard works as expected.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:40 +03:00
Sunil Mohan Adapa
904e5935cb
backups: Ignore a typing error with mypy
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:39 +03:00
Sunil Mohan Adapa
d512a8b645
diagnostics: In development mode, run diagnostics more rarely
Due the frequency and length of execution of diagnostics, the service does not
restart when files are modified. The operation also makes other testing tasks
wait until completed. It also makes functional tests slower. So, reduce the
frequency of execution. It can always be temporarily changed when debugging
diagnostics operations is necessary.

Tests:

- Change the development interval to 18 seconds and notice that new interval is
effective in development mode but not in production mode.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:39 +03:00
Sunil Mohan Adapa
996596ddc0
glib: Add schedule parameter for setting interval in develop mode
Tests:

- In development mode, diagnostics task runs after about 180 seconds (with
jitter).

- In production mode, diagnostics task does not run after 180 seconds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-29 16:58:38 +03:00
Jiří Podhorecký
9c3776b03d
Translated using Weblate (Czech)
Currently translated at 100.0% (1879 of 1879 strings)
2025-09-28 07:02:01 +00:00
109247019824
84a79d923d
Translated using Weblate (Bulgarian)
Currently translated at 56.1% (1055 of 1879 strings)
2025-09-24 05:02:05 +02:00
Максим Горпиніч
c69e870420
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (1879 of 1879 strings)
2025-09-24 05:02:04 +02:00
大王叫我来巡山
4fe7a72cc1
Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 61.4% (1155 of 1879 strings)
2025-09-24 05:02:02 +02:00
Burak Yavuz
f548bafcfb
Translated using Weblate (Turkish)
Currently translated at 100.0% (1879 of 1879 strings)
2025-09-24 05:02:00 +02:00
James Valleroy
028e3b1b96
Release v25.12 to unstable
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
v25.12
2025-09-22 20:23:37 -04:00
James Valleroy
695cd44010
doc: Fetch latest manual
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 20:22:44 -04:00
James Valleroy
b2827946c4
locale: Update translation strings
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 20:06:02 -04:00
Sunil Mohan Adapa
9ddb83a741
views: Fix 'internal server error' when showing 404 page
Closes: #2517.

Tests:

- Without the patch, run without --develop option and visit a non-exiting page
like /plinth/foo/. It results in '500 internal server error' instead of 404
non-found error.

- With the patch, the '404' page is shown. Breadcrumbs show only a link to the
home page with home icon.

- Accessing a page like /plinth/apps/bepasty/add?foo redirects it to
/plinth/apps/bepasty/add/?foo.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 19:44:39 -04:00
Sunil Mohan Adapa
2862862161
api: Fix showing icons for custom shortcuts
Tests:

- Add a custom shortcut and provide a custom icon for it in
/var/www/plinth/custom/static/icons/. Visit the page /plinth/api/1/shortcuts/.
The icon path for the custom shortcut is correct and accessible from browser.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 19:43:06 -04:00
Sunil Mohan Adapa
729690792f
index: Generalize showing custom shortcut icons
Instead of detecting 'custom' in the name of the icons (which can happen if the
icon basename itself contains the word 'custom'), check if the icon is already
an absolute URL path.

Tests:

- Add a custom shortcut and provide a custom icon for it in
/var/www/plinth/custom/static/icons/. Visit the frontpage and ensure that the
icon is visible.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-22 19:42:53 -04:00
Sunil Mohan Adapa
ced83a31e9
zoph: Fix cases when CLI user is set to "autodetect"
Closes: #2538

Tests:

- Without the patch, set the Zoph CLI User to "autodetect" and notice the
failure to load Zoph page.

- With the patch, set user to "autodetect" and access the app page. It is
updated to the first admin user in Zoph DB.

- Try with updating Zoph configuration.

- Try with re-running Zoph setup.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 13:25:58 -04:00
Sunil Mohan Adapa
5758bdba2a
upgrades: Overwrite apt sources lens with bug fixes
Fixes: #2251
Fixes: #2426

- Temporarily add a bug fix for the one-line style apt sources format. Upstream
submission: https://github.com/hercules-team/augeas/pull/865 .

- Currently, only two options with keys arch= or trusted= are allowed. However,
as documented in apt manual page[1], there are many different options possible.
Apt itself parses these options in a much more generic way[2][3].

- Fixes allow parsing all the different options allowed by apt. A practical
example (accepted by apt) is also provided as a test case.

Tests:

- Add the following line to one of the apt sources file in
/etc/apt/sources.list.d: "deb
[signed-by=/usr/share/keyrings/debian-archive-trixie-stable.gpg]
https://deb.debian.org/debian trixie main". In augtool, print
/augeas/files/etc/apt/sources.list.d//error.

- With the patch, run 'make build install' and errors in augtool disappear.

- In tor proxy app, enabling/disabling apt through tor works. The files in
/etc/apt/ are updated as expected.

Link: https://manpages.debian.org/trixie/apt/sources.list.5.en.html
Link: 3c9399e643/apt-pkg/sourcelist.cc (L215)
Link: 3c9399e643/apt-pkg/contrib/strutl.cc (L245)
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:50 -04:00
Sunil Mohan Adapa
a98e6f7563
upgrades: Multiple fixes for parsing Apt's Deb822 style sources
- Allow DOS style line endings

- Allow preceding, trailing, and repeating empty lines

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:48 -04:00
Sunil Mohan Adapa
795bd1fd9e
torproxy: When disabling apt over tor fails, report error properly
- It is not possible to disable apt over tor for as many files as possible with
the current code because even an error in a single file will result in entire
process failing. Instead, implement a way to disable the exception.

Tests:

- Add an unparsable line into the one of the apt sources files. Disabling apt
over tor works and all file but the error file are modified.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2025-09-21 08:11:44 -04:00
Jiří Podhorecký
0e78cfb8c7
Translated using Weblate (Czech)
Currently translated at 100.0% (1878 of 1878 strings)
2025-09-20 21:02:02 +02:00
Sunil Mohan Adapa
f7fff4d980
ci: functional: Provision the privileged daemon properly
- These is no need to set sudo related configuration for running actions.

- We need to enable and start freedombox-privileged daemon.

- Use 'make provision-dev' to simplify all setup.

- Update the check for 'setup finished' message.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-19 15:40:56 -07:00
Sunil Mohan Adapa
567e34d467
bepasty: tests: Fix functional test failure to missing / in URL
Helps: #2517.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-19 11:13:12 -07:00
Sunil Mohan Adapa
5a55b59939
diagnostics, help: Link to diagnostics page logs in 500 error page
Closes: #2414.

- Remove separate implementation for showing logs in help page.

- Add link to the page in diagnostics app so that FreedomBox logs can more
easily be discovered by users.

Tests:

- Raise an exception in the common error middleware to cause a 500 internal
server error. Run FreedomBox service with the --develop option and notice that
500 error page is served. There, the link to logs page works. It shows the logs
for Diagnostics app.

- Diagnostics page description is update. Link to logs page works.

- Diagnostics page shows logs for plinth.service and freedombox-develop.service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-18 16:35:23 +03:00
Sunil Mohan Adapa
e82d959c85
views: Add a menu entry and view for showing logs of an app
Tests:

- View logs menu entry is shown only for apps with daemons. It is now shown for
others such as Backups. It does not add menu for apps such as power.

- View logs entry for Date & Time shows show logs for multiple units. View logs
entry for Nextcloud shows many units.

- The textarea occupies full width. It is not editable. It is always scrolled to
the bottom. Control-A and Control-C selects all the text in it. It is re-sizable
vertically.

- The header shows unit name and unit description correctly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-18 16:35:23 +03:00
Sunil Mohan Adapa
0661d7da7c
app: Add ability to retrieve logs from all systemd units of an app
Tests:

- Upto 200 lines are shown in the logs. The description and unit name of the app
is correct.

- Apps without systemd units don't have 'View Logs' menu item.

- Nextcloud container logs are shown.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-18 16:35:23 +03:00
Roman Akimov
b3d5ee30ed
Translated using Weblate (Russian)
Currently translated at 99.0% (1860 of 1878 strings)
2025-09-18 10:02:01 +00:00
Roman Akimov
ba2ec2db07
Translated using Weblate (Russian)
Currently translated at 98.7% (1854 of 1878 strings)
2025-09-17 11:02:02 +02:00
ikmaak
e6bf7fe68a
Translated using Weblate (Dutch)
Currently translated at 97.6% (1833 of 1878 strings)
2025-09-17 11:02:01 +02:00
Sunil Mohan Adapa
aee81477bd
ci: Don't include defunct extract-source job
- According to a recent change in Salsa CI[1], this job does nothing.

- There is a syntax error that causes entire pipeline file from becoming valid.

Link: 2dd7850308
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-15 15:31:45 +03:00
Sunil Mohan Adapa
46da3db69d
ci: Update container for functional tests from bookworm to trixie
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-12 14:53:51 -07:00
Sunil Mohan Adapa
c95ee766aa
bepasty: tests: Override backup/restore test properly
- The current name does not the match the base class method it intends to
override.

Tests:

- Run functional tests for bepasty -v option and notice that only one backup and
restore test runs.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-09-12 11:24:19 -07:00
Dietmar
a2668b405b
Translated using Weblate (Italian)
Currently translated at 47.1% (886 of 1878 strings)
2025-09-11 18:02:03 +00:00
Dietmar
2355e52d21
Translated using Weblate (German)
Currently translated at 98.4% (1849 of 1878 strings)
2025-09-11 18:02:00 +00:00