49891 Commits

Author SHA1 Message Date
Michael Vogt
5c9dd06817 release: 2.51.2
Update changelog with the 2.51.2 changes.
2.51.2
2021-07-07 16:38:04 +02:00
Michael Vogt
5103e7b47c snapstate: remove temporary snap file for local revisions early
* overlord: add manager tests for refresh to local revisions

This adds manager tests to test that refresh to the same revision
works and local revisions work.

* snapstate: remove temporary snap file for local revisions early

The SnapSetup.SnapPath is only needed to check/mount the snap. If
the snap is already local we will not mount it again. So we can
remove temporary snap files from e.g. side-loading early.

This fixes the bug that sideloaded snaps that already have local
revisions are not removed. They will get removed eventually via
the snapmgr.go:SnapManager.localInstallCleanup() code. But this
code only runs every 24h and if people install enough side-loaded
snaps the disk may fill-up before the cleanup happens.

* snapstate: move removal of local revisions closer to the "mount" task generation (thanks to Samuele)

* snapstate: fix typo
2021-07-07 14:51:45 +02:00
Sergey Borovkov
c09917c186 interface: allows reading sd cards internal info from block-devices interface
Without this line:
	cat /sys/block/mmcblk0/device/date
results in this denial:
/sys/devices/platform/soc/3f202000.mmc/mmc_host/mmc0/mmc0:aaaa/dateSee: https://forum.snapcraft.io/t/interface-for-read-info-about-sd-card/25202

After adding the line in the commit to my snap apparmor file it works:

root@srly-r7d8mg4oj4eo0go:/home/pi# sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.screenly-client.submit-report
Warning from /var/lib/snapd/apparmor/profiles/snap.screenly-client.submit-report (/var/lib/snapd/apparmor/profiles/snap.screenly-client.submit-report line 1297): Character # was quoted unnecessarily, dropped preceding quote ('') character
root@srly-r7d8mg4oj4eo0go:/home/pi# snap run --shell screenly-client.submit-report
root@srly-r7d8mg4oj4eo0go:/home/pi# cat /sys/block/mmcblk0/device/date
06/2017
2021-07-07 12:34:52 +02:00
Pawel Stolowski
8c0d7ec077 o/ifacestate: do not visit same halt tasks in waitChainSearch to avoid cycles (#10468)
Following #10461, avoid visiting same halt task in waitChainSearch helper in ifacestate to avoid slow convergence where the wait graphs might have an exponential number of paths (or very unlikely cycles).
2021-07-01 15:40:58 +02:00
Michael Vogt
eec7f7f85c corecfg: allow using # snapd-edit: no header to disable pi-config
On some systems the pi config.txt cannot be modified safely. E.g.
on devices that measure boot or similar.

This commit adds a way to disable the system.pi-config.* settings
when adding the following header to the config.txt
```
 # snapd-edit: no
```

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2021-07-01 11:49:12 +02:00
Michael Vogt
66b574cc3a configcore: ignore system.pi-config.* setting on measured kernels
* configcore: ignore system.pi-config.* setting on measured kernels

Some pi devices uses measured boot, e.g. avnet. On these devices
the config.txt is part of the measurements and we cannot modify
config.txt without changing the measurements and breaking the
boot.

So this commit adds a check for kernels that known to use measured
boot and here the configuration is ignored.

* configcore: tweak naming/comments (thanks to Samuele)
2021-06-30 18:12:41 +02:00
Michael Vogt
8d38d213f3 Merge pull request #10456 from mvo5/tell-configcore-about-device-2.51
many: pass device/model info to configcore via sysconfig.Device interface (2.51)
2021-06-29 14:59:40 +02:00
Michael Vogt
bb5646a9d1 Merge pull request #10455 from mvo5/feature/swap-option-2.51
o/configstate/configcore: support snap set system swap.size=... (2.51)
2021-06-29 14:58:58 +02:00
Maciej Borzecki
3adf74e9fd store: make the log with download size a debug one
The log appears is visible in the user's terminal when running `snap download`
command.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-06-28 16:10:35 +02:00
Samuele Pedroni
44df8abe9f o/devicestate: tweak SystemMode doc comment 2021-06-28 09:13:53 +02:00
Samuele Pedroni
0522125bf7 daemon,o/devicestate: have DeviceManager.SystemMode take an expectation on the system
the expectations control whether to report "run" or "" on non-UC20
systems.

this is an idea discussed with @bboozzoo, it avoids having to resort
to use the cached value field directly sometimes which is confusing.
2021-06-28 09:13:47 +02:00
Samuele Pedroni
8abe7004cd sysconfig: clarify s/devinceInfo/configedDevice/ and its RunMode
the functions using configedDevice are not used from run mode

(thanks @mvo)
2021-06-25 09:53:59 +02:00
Samuele Pedroni
78726ff259 o/conficore/configstate: use sysconfig.Device handling pi options
this gives us more information more cleanly than the current approach
reading the kernel command line directly
2021-06-25 09:53:59 +02:00
Samuele Pedroni
ec0075ab3a o/configstate/configcore: stop mocking release.OnClassic
the information is passed via sysconfig.Device now
2021-06-25 09:53:59 +02:00
Samuele Pedroni
2dfc07c9f5 o/configstate/configcore: TODO for later about vitality code 2021-06-25 09:53:59 +02:00
Samuele Pedroni
22c494cdff o/configstate/configcore: provide sysconfig.Device to all fs-only handlers 2021-06-25 09:53:59 +02:00
Samuele Pedroni
59ae91f0ae many: have configcore.Run/Early take a sysconfig.Device
adjust the affected code
2021-06-25 09:53:59 +02:00
Samuele Pedroni
80fe5ca4de many: start configcore taking model/device information
introduce sysconfig.Device (similar to boot.Device)

have sysconfig.ApplyFilesystemOnlyDefaults and
sysconfig.ConfigureTargetSystem take the model and pass down a
sysconfig.Device

for these two we assume that mode is not run
2021-06-25 09:52:35 +02:00
Ian Johnson
3ca3639378 o/configstate/configcore: fix import order
Thanks to Maciej for spotting this.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-25 09:48:45 +02:00
Ian Johnson
02b125043d overlord/configstate/configcore/swap_test.go: add unit tests for swap.size
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-25 09:48:45 +02:00
Ian Johnson
cf70ed22df o/configstate/configcore/swap.go: additional verification for swap size
We want to make sure that the swap size is an even integer number of megabytes
and that it's not too small, and that it's not negative.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-25 09:48:45 +02:00
Ian Johnson
4f7356113d o/configstate/configcore: support snap set system swap.size=...
Add a handler for the system swap option which manipulates /etc/default/swapfile
and swapfile.service. This option works both with systemd around at runtime, and
without during the initrd for example when only the rootfs is available.

In order to properly handle this when the key is not set without running systemd
unnecessarily, we need to use GetPristine to indicate if the value was changed
or not.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-06-25 09:48:45 +02:00
Ethan Hsieh
ff74a39301 interfaces/opengl: add support for Imagination PowerVR
* interfaces/opengl: add support for Imagination PowerVR

* interfaces: update opengl_test.go for new pvr_sync driver

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
2021-06-17 09:04:45 +02:00
Michael Vogt
3e1c72dd2e releasing package snapd version 2.51.1 2.51.1 2021-06-15 14:22:17 +02:00
Ondrej
1608eb90c1 interfaces: add netlink-driver interface
* interfaces/netlink-protocol: add netlink-protocol interface

Some kernel drivers implement custom netlink protocol for the communication with userspace.
Provide interface which allows gadget snap to enable custom protocols.

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* tests: add spread test for netlink-protocol interface

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* interfaces: netlink-protocol -> netlink-driver, other adjustments

Thanks to Samuele for the suggestions

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/policy/basedeclaration_test.go: add netlink-driver as a snowflake

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/netlink-driver: validate family-name plug attr w/ BeforePreparePlug

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/netlink-driver: add additional accesses

This then matches the existing netlink-connector interface.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* interfaces/builtin/netlink_driver: fix unit tests to match current access patterns

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
Co-authored-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-06-15 12:20:04 +02:00