Talk:Immutable root with atomic upgrades: Difference between revisions

From Alpine Linux
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 6: Line 6:




[[User:Machinestops|Machinestops]], not sure I follow. The config field <code>volume</code> defines which partition contains the path defined in the fields <code>loader</code> and <code>initrd</code>. If you have btrfs volume with the label other than <code>ROOT</code>, you have to also change <code>volume</code> field in the config. Kernel and initramfs should reside in the btrfs volume, they are the part of the snapshot. [[User:Mvsn|Mvsn]] ([[User talk:Mvsn|talk]]) 23:04, 31 May 2021 (UTC)
[[User:Machinestops|Machinestops]], not sure I follow. The config field <code>volume</code> defines which partition contains the path defined in the fields <code>loader</code> and <code>initrd</code>. If you have btrfs volume with the label other than <code>ROOT</code>, you have to also change <code>volume</code> field in the config. Kernel and initramfs should reside in the btrfs volume, they are the part of the snapshot. [[User:Mvsn|Mvsn]] ([[User talk:Mvsn|talk]])


== System mutation scripts ==
== System mutation scripts ==
Line 13: Line 13:


Documenting the functionality of the scripts with comments might also be useful. The level of piping and nesting in these scripts makes it difficult to follow along for anyone unfamiliar with <code>execline</code>.<!-- Template:Unsigned --><span class="autosigned" style="font-size:85%;">—&nbsp;Preceding unsigned comments added by [[User:Machinestops|Machinestops ]] ([[User talk:Machinestops #top|talk]] • [[Special:Contributions/Machinestops |contribs]]) 12:10, 31 May 2023‎</span>
Documenting the functionality of the scripts with comments might also be useful. The level of piping and nesting in these scripts makes it difficult to follow along for anyone unfamiliar with <code>execline</code>.<!-- Template:Unsigned --><span class="autosigned" style="font-size:85%;">—&nbsp;Preceding unsigned comments added by [[User:Machinestops|Machinestops ]] ([[User talk:Machinestops #top|talk]] • [[Special:Contributions/Machinestops |contribs]]) 12:10, 31 May 2023‎</span>
== rEFInd config does not work (or i'm dumb) ==
The provided rEFInd config seems to not work anymore.
rEFInd say me: Error: Not Found while loading vmlinuz-lts.
rEFInd config:
menuentry "Alpine Linux 2" {
    icon /EFI/refind/icons/os_linux.png
    volume "ROOT"
    loader /current/0/@/boot/vmlinuz-lts
    initrd /current/0/@/boot/initramfs-lts
    options "root=UUID=716209ed-16f5-421a-8580-0c65764b58eb rootfstype=btrfs rootflags=subvol=/current/0/@,ro,noatime quiet splash"
}
FS structure:
/mnt
├── commons
│   ...
├── current -> ./links/20231220142434tzbKGDKF
├── fstab
├── links
│   └── 20231220142434tzbKGDKF
│      ├── 0 -> ../../snapshots/20231220142341XRxLvnIW
│      ...
├── next
└── snapshots
    └── 20231220142341XRxLvnIW
        └── @
            └── <system>
The files exists:
$ ls /mnt/snapshots/20231220142341XRxLvnIW/@/boot/
boot  config-lts  initramfs-lts  System.map-lts  vmlinuz-lts
The label/UUID is good:
/dev/nvme0n1p3: LABEL="ROOT" UUID="716209ed-16f5-421a-8580-0c65764b58eb" ...
For me, it looks like what you did..
<small><span class="autosigned">—&nbsp;Preceding [[Help:Signature|unsigned]] comment added by [[User:Papilinux|Papilinux]] ([[User talk:Papilinux|{{int:talkpagelinktext}}]] • [[Special:Contributions/Papilinux|{{int:contribslink}}]]) 00:59, 21 December 2023‎</span></small>
== I got this to work with some tweaks. ==
There seems to be a bug in rEFInd, it is looking for <code>drivers_x64</code> but it comes with <code>drivers_x86_64</code>. So I added the line <code>scan_driver_dirs EFI/refind/drivers_x86_64</code> into refind.conf (it goes outside of menuentry), which tells it to look for its drivers in the folder they're supplied in. This should only be done on x86_64 systems, and not any other architecture, 64-bit or otherwise. This is what causes the other failures to boot here!
Since I was planning to install GNOME, I also had to:
* Run [[setup-desktop]] in sysmut after reaching the system.
* Run [[setup-timezone]]. This should probably have been done during the setup, but I ran it in sysmut.
* Add {{pkg|networkmanager-wifi}} after running setup-desktop.
* Use {{pkg|wpa_supplicant}}. For some inexplicable reason, {{pkg|iwd}} made all my inputs inoperable when I logged in. Oh well.
* Bind-mount <code>/etc/NetworkManager/system-connections</code> to point to <code>/var/lib/networkmanager-connections</code> (the only part that's important is it's stored in var). If you don't, you can't connect to WiFi networks in GNOME Settings as you normally would.
* For Flatpak: I needed to add a tmpfs for /var/tmp as well, flatpaks won't install without it.
It would be helpful to mention where you should install what types of packages you intend to have on your system, i.e. right before closing the chroot, you should install stuff you want on your system, like flatpak (and flathub).
I'm trying to figure out how to make /etc mutable but still snapshottable, because a lot of things expect /etc to be read-write. This should be factored into any work on sysmut or syscln. (sysmut should also remove the snapshot it generated if it aborts.)
--[[User:Halscode|Halscode]] ([[User talk:Halscode|talk]]) 04:50, 1 October 2024 (UTC)

Latest revision as of 04:50, 1 October 2024

User:Sb1, regarding diskless mode note: thanks for reminding about it, but it's a different setup with its own features, so I reduced the note, but left the links. Similar guide to diskless chroot setup would be really appreciated btw. Mvsn (talk) 23:04, 31 May 2021 (UTC)

rEFInd

The rEFInd configuration provided in this does not appear to work universally, as rEFInd assumes that the loader and initrd parameters in the MenuEntry are located within the ESP partition. To produce a bootable version of this setup, I had to move my kernel and my initramfs to the ESP partition.— Preceding unsigned comments added by Machinestops (talkcontribs) 12:01, 31 May 2023‎


Machinestops, not sure I follow. The config field volume defines which partition contains the path defined in the fields loader and initrd. If you have btrfs volume with the label other than ROOT, you have to also change volume field in the config. Kernel and initramfs should reside in the btrfs volume, they are the part of the snapshot. Mvsn (talk)

System mutation scripts

It might be helpful to note that execline should be included in the list of packages installed while setting up the initial root snapshot, and also that the scripts provided should be downloaded (perhaps provide them as raw files somehow?). Without them, there is no way to modify the system other than manually mounting, creating an RW snapshot, and performing the link migration manually, which might prove bothersome for some (or unclear).

Documenting the functionality of the scripts with comments might also be useful. The level of piping and nesting in these scripts makes it difficult to follow along for anyone unfamiliar with execline.— Preceding unsigned comments added by Machinestops (talkcontribs) 12:10, 31 May 2023‎

rEFInd config does not work (or i'm dumb)

The provided rEFInd config seems to not work anymore. rEFInd say me: Error: Not Found while loading vmlinuz-lts.

rEFInd config:

menuentry "Alpine Linux 2" {
    icon /EFI/refind/icons/os_linux.png
    volume "ROOT"
    loader /current/0/@/boot/vmlinuz-lts
    initrd /current/0/@/boot/initramfs-lts
    options "root=UUID=716209ed-16f5-421a-8580-0c65764b58eb rootfstype=btrfs rootflags=subvol=/current/0/@,ro,noatime quiet splash"
}

FS structure:

/mnt
├── commons
│   ...
├── current -> ./links/20231220142434tzbKGDKF
├── fstab
├── links
│   └── 20231220142434tzbKGDKF
│       ├── 0 -> ../../snapshots/20231220142341XRxLvnIW
│       ...
├── next
└── snapshots
    └── 20231220142341XRxLvnIW
        └── @
            └── <system>

The files exists:

$ ls /mnt/snapshots/20231220142341XRxLvnIW/@/boot/
boot  config-lts  initramfs-lts  System.map-lts  vmlinuz-lts

The label/UUID is good:

/dev/nvme0n1p3: LABEL="ROOT" UUID="716209ed-16f5-421a-8580-0c65764b58eb" ...

For me, it looks like what you did..

— Preceding unsigned comment added by Papilinux (talkcontribs) 00:59, 21 December 2023‎

I got this to work with some tweaks.

There seems to be a bug in rEFInd, it is looking for drivers_x64 but it comes with drivers_x86_64. So I added the line scan_driver_dirs EFI/refind/drivers_x86_64 into refind.conf (it goes outside of menuentry), which tells it to look for its drivers in the folder they're supplied in. This should only be done on x86_64 systems, and not any other architecture, 64-bit or otherwise. This is what causes the other failures to boot here!

Since I was planning to install GNOME, I also had to:

  • Run setup-desktop in sysmut after reaching the system.
  • Run setup-timezone. This should probably have been done during the setup, but I ran it in sysmut.
  • Add networkmanager-wifi after running setup-desktop.
  • Use wpa_supplicant. For some inexplicable reason, iwd made all my inputs inoperable when I logged in. Oh well.
  • Bind-mount /etc/NetworkManager/system-connections to point to /var/lib/networkmanager-connections (the only part that's important is it's stored in var). If you don't, you can't connect to WiFi networks in GNOME Settings as you normally would.
  • For Flatpak: I needed to add a tmpfs for /var/tmp as well, flatpaks won't install without it.

It would be helpful to mention where you should install what types of packages you intend to have on your system, i.e. right before closing the chroot, you should install stuff you want on your system, like flatpak (and flathub).

I'm trying to figure out how to make /etc mutable but still snapshottable, because a lot of things expect /etc to be read-write. This should be factored into any work on sysmut or syscln. (sysmut should also remove the snapshot it generated if it aborts.) --Halscode (talk) 04:50, 1 October 2024 (UTC)