|
1 | 1 | --- |
2 | 2 | title: Manage Moss States and Packages |
3 | | -lastUpdated: 2026-02-20T13:33:00Z |
4 | | -description: Learn how to inspect and switch states, search for software, and keep an AerynOS system up to date with moss. |
| 3 | +lastUpdated: 2026-03-12T10:33:00Z |
| 4 | +description: Learn how to update, install, remove, and search for packages, and how to inspect, switch and clean up states with moss. |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | Moss keeps track of packaging-related operations that change the state of the /usr directory by creating a new filesystem transaction (fstx) for each associated moss operation, be it package installation, removal, or upgrades. |
8 | 8 |
|
9 | | -Use the commands below to inspect and manage those states, discover software, and keep your system current. |
| 9 | +Use the commands below to manage your installed software packages, and keep your system current. |
10 | 10 |
|
11 | | -## Check the current state |
12 | 11 |
|
13 | | -1. List the active state to confirm what is running right now. |
| 12 | +## Update the system |
| 13 | + |
| 14 | +Keep the entire system current with a sync operation. |
14 | 15 |
|
15 | 16 | ```bash |
16 | | -moss state active |
| 17 | +sudo moss sync --update |
17 | 18 | ``` |
18 | 19 |
|
19 | | -2. Review the state history when you need context for a rollback. |
| 20 | +`--update` (`-u`) pulls fresh repository metadata before applying upgrades. Moss records the result as a new state, so you can roll back if something goes wrong. |
| 21 | + |
| 22 | + |
| 23 | +## Search for packages |
| 24 | + |
| 25 | +Use keyword searches to discover software by name or summary. |
20 | 26 |
|
21 | 27 | ```bash |
22 | | -moss state list |
| 28 | +sudo moss search something |
23 | 29 | ``` |
24 | 30 |
|
25 | | -Use the state ID (the number after `State #`) when you need to query or activate a specific snapshot. |
| 31 | +Add `--installed` (`-i`) if you only want to search software that is already present on the system. |
26 | 32 |
|
27 | | -## Activate a different state |
28 | 33 |
|
29 | | -Follow these steps to roll back or advance to another state safely. |
| 34 | +## Search for installed files |
30 | 35 |
|
31 | | -1. Identify the target state ID with `moss state list`. |
32 | | -2. Activate that state. |
| 36 | +Look up which package delivered a specific file when you troubleshoot or audit an installation. |
33 | 37 |
|
34 | 38 | ```bash |
35 | | -sudo moss state activate 128 |
| 39 | +sudo moss search-file filename |
36 | 40 | ``` |
37 | 41 |
|
38 | | -3. Verify the change. |
| 42 | +`moss search-file` scans files from installed packages only. |
| 43 | + |
| 44 | + |
| 45 | +## Install new software packages |
| 46 | + |
| 47 | +1. Refresh repository metadata when needed. |
39 | 48 |
|
40 | 49 | ```bash |
41 | | -moss state active |
| 50 | +sudo moss repo update |
42 | 51 | ``` |
43 | 52 |
|
44 | | -Activating a state atomically swaps the currently active state's /usr directory with the new state's /usr directory, using the Linux kernel [`renameat2` syscall](https://www.man7.org/linux/man-pages/man2/rename.2.html). |
| 53 | +2. Install one or more packages. |
45 | 54 |
|
46 | | -On successful activation of the new state, it is recommended to reboot the system, so that long-running services start with the expected binaries, libraries, and configurations. |
| 55 | +```bash |
| 56 | +sudo moss install somepackage |
| 57 | +``` |
47 | 58 |
|
48 | | -## Search for packages |
| 59 | +Moss creates a new state automatically. Confirm success with `moss state active`. |
49 | 60 |
|
50 | | -Use keyword searches to discover software by name or summary. |
| 61 | + |
| 62 | +## Remove software packages |
| 63 | + |
| 64 | +Uninstall packages you no longer need. |
51 | 65 |
|
52 | 66 | ```bash |
53 | | -sudo moss search fractional |
| 67 | +sudo moss remove somepackage |
54 | 68 | ``` |
55 | 69 |
|
56 | | -Add `--installed` (`-i`) if you only want to search software that is already present on the system. |
| 70 | +Moss snapshots the removal in a new state. Use `moss state list` to find the previous state if you have to recover. |
57 | 71 |
|
58 | | -## Search for installed files |
59 | 72 |
|
60 | | -Look up which package delivered a specific file when you troubleshoot or audit an installation. |
| 73 | +## List currently installed software packages |
| 74 | + |
61 | 75 |
|
62 | 76 | ```bash |
63 | | -sudo moss search-file libEGL.so |
| 77 | +moss list installed |
64 | 78 | ``` |
65 | 79 |
|
66 | | -`moss search-file` scans files from installed packages only. |
67 | 80 |
|
68 | | -## Fetch package stones |
| 81 | +## Atomic and independent states |
69 | 82 |
|
70 | | -Use `moss fetch` to download one or more package `.stone` files by name without installing them on the current system. |
| 83 | +In the preceding examples, it was briefly mentioned that moss creates new "states". |
| 84 | + |
| 85 | +When using moss, state management is an important concept. This section details the fundamentals of moss state management. |
| 86 | + |
| 87 | +Moss is based on the concept of atomic updates. Atomic in this context means "independent units". Each time the user instructs moss to change the state of the system, moss creates a new, independent state. Because each state is independent, it allows moss to roll back to an earlier state, and roll forward to a later state. |
| 88 | + |
| 89 | + |
| 90 | +### Check the current active state |
| 91 | + |
| 92 | +1. List the active state to confirm what is running right now. |
71 | 93 |
|
72 | 94 | ```bash |
73 | | -moss fetch howdy-git |
| 95 | +moss state active |
74 | 96 | ``` |
75 | 97 |
|
76 | | -Fetch multiple packages into a custom output directory: |
| 98 | +2. Review the state history when you need context for a rollback. |
77 | 99 |
|
78 | 100 | ```bash |
79 | | -moss fetch howdy-git fractional --output-dir ~/stones |
| 101 | +moss state list |
80 | 102 | ``` |
81 | 103 |
|
82 | | -`moss fetch` writes downloaded files to the current directory by default. Add `--verbose` when you need more detailed progress output. |
83 | | -If a package cannot be resolved, refresh repository metadata and try again: |
| 104 | +Use the state ID (the number after `State #`) when you need to query, activate, or remove a specific state. |
84 | 105 |
|
85 | | -## Install software |
86 | 106 |
|
87 | | -1. Refresh repository metadata when needed. |
| 107 | +### Activate a different state |
| 108 | + |
| 109 | +Follow these steps to roll back or advance to another state safely. |
| 110 | + |
| 111 | +1. Identify the target state ID with `moss state list`. |
| 112 | +2. Activate that state. |
88 | 113 |
|
89 | 114 | ```bash |
90 | | -sudo moss repo update |
| 115 | +sudo moss state activate 128 |
91 | 116 | ``` |
92 | 117 |
|
93 | | -2. Install one or more packages. |
| 118 | +3. Verify the change. |
94 | 119 |
|
95 | 120 | ```bash |
96 | | -sudo moss install howdy-git |
| 121 | +moss state active |
97 | 122 | ``` |
98 | 123 |
|
99 | | -Moss creates a new state automatically. Confirm success with `moss state active`. |
| 124 | +Activating a state atomically swaps the currently active state's /usr directory with the new state's /usr directory, using the Linux kernel [`renameat2` syscall](https://www.man7.org/linux/man-pages/man2/rename.2.html). |
100 | 125 |
|
101 | | -## Update the system |
| 126 | +On successful activation of the new state, it is recommended to reboot the system, so that long-running services start with the expected binaries, libraries, and configurations. |
102 | 127 |
|
103 | | -Keep the entire system current with a sync operation. |
| 128 | + |
| 129 | +### Clean up retained states |
| 130 | + |
| 131 | +Over time, a system managed by moss will accumulate more and more states. Each state takes up space that is equivalent to the difference in packages between one state to another. If two states share a lot of package versions, the storage needed to keep the difference between states will be small. |
| 132 | + |
| 133 | +There are two ways to clean up retained states: |
| 134 | + |
| 135 | +- Prune, which removes all states except the N latest states |
| 136 | +- Remove, which is capable of removing individual states and ranges of states. |
| 137 | + |
| 138 | +### Prune states |
| 139 | + |
| 140 | +This will prune state history to keep only the 10 latest states, including the current active state: |
104 | 141 |
|
105 | 142 | ```bash |
106 | | -sudo moss sync --update |
| 143 | +sudo moss state prune |
107 | 144 | ``` |
108 | 145 |
|
109 | | -`--update` (`-u`) pulls fresh repository metadata before applying upgrades. Moss records the result as a new state, so you can roll back if something goes wrong. |
| 146 | +If you want to keep a different number of states, the `-k` / `--keep` parameter will let you specify the number of states you wish to keep: |
| 147 | + |
| 148 | +```bash |
| 149 | +# Keep the five latest states, including the active state |
| 150 | +sudo moss state prune --keep 5 |
| 151 | +# or |
| 152 | +sudo moss state prune -k 5 |
| 153 | +``` |
110 | 154 |
|
111 | | -## Remove software |
| 155 | +### Remove specific states |
112 | 156 |
|
113 | | -Uninstall packages you no longer need. |
| 157 | +Sometimes, it is useful to be able to remove one or more specific states. This can be accomplished with the `state remove` operation. |
114 | 158 |
|
115 | 159 | ```bash |
116 | | -sudo moss remove howdy-git |
| 160 | +moss state remove 2 8-12 15 17-21 |
117 | 161 | ``` |
118 | 162 |
|
119 | | -Moss snapshots the removal in a new state. Use `moss state list` to find the previous state if you have to recover. |
| 163 | +As you can see, `state remove` enables you to remove both individual states and ranges of states. Ranges are inclusive, meaning the start and end states of the specified range are also removed. |
120 | 164 |
|
121 | | -## List currently installed software |
122 | 165 |
|
| 166 | +## Fetch package .stone files for backup purposes |
| 167 | + |
| 168 | +If you would like to keep an archive of stones, moss supports a fetch operation. |
| 169 | + |
| 170 | +Use `moss fetch` to download one or more package `.stone` files by name without installing them on the current system. |
123 | 171 |
|
124 | 172 | ```bash |
125 | | -moss list installed |
| 173 | +moss fetch somepackage |
| 174 | +``` |
| 175 | + |
| 176 | +Fetch multiple packages into a custom output directory: |
| 177 | + |
| 178 | +```bash |
| 179 | +moss fetch package1 package2 --output-dir ~/stones |
126 | 180 | ``` |
| 181 | + |
| 182 | +`moss fetch` writes downloaded files to the current directory by default. Add `--verbose` when you need more detailed progress output. If a package cannot be resolved, refresh repository metadata and try again. |
| 183 | + |
| 184 | +Note also that moss fetches .stones against currently active repository `stone.index` files. |
| 185 | + |
| 186 | +You can list your currently active repository index with `moss repo list`. |
0 commit comments