unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to install guix system from existing linux with guix package manager?
@ 2022-05-26 22:21 kiasoc5
  2022-05-27 10:03 ` Giovanni Biscuolo
  0 siblings, 1 reply; 5+ messages in thread
From: kiasoc5 @ 2022-05-26 22:21 UTC (permalink / raw)
  To: help-guix

How would I install Guix system from an existing Linux that has the guix package manager on it (aka from a foreign distro)?

Specifically I have Guix installed on Arch Linux on an encrypted btrfs ssd. I have a @home subvolume mounted on /home. Currently /gnu/store is not a subvolume, but I'd like to reuse it for guix system. I also have the efi system partition for uefi boot.

What I'd like to do is install Guix system and boot from a subvolume. Ideally the guix fstab would be like this:

@guix-root is mounted on / on guix system
@gnu-store is mounted on /gnu/store on guix system and shared between arch and guix
@home is mounted on /home and shared between arch and guix

So I think the steps are as follows:
0. backup data (just in case)
1. move /gnu/store to subvolume
2. install Guix system manually with the following file systems:

(mapped-devices
  (list (mapped-device
    (source (uuid "my-uuid"))
    (target "cryptroot")
    (type luks-device-mapping))))

(file-systems (append
               (list (file-system
                      (device (file-system-label "cryptroot"))
                      (mount-point "/")
                      (type "btrfs")
		      (options "subvol=@guix-root")
		      (dependencies mapped-devices))
		     (file-system
                      (device (file-system-label "cryptroot"))
                      (mount-point "/gnu/store")
                      (type "btrfs")
		      (options "subvol=@gnu-store")
		      (dependencies mapped-devices))
                     (file-system
                      (device (file-system-label "efi"))
                      (mount-point "/boot/efi")
                      (type "vfat")))
               %base-file-systems))

3. configure uefi to boot guix grub by default

WDYT? any tips/suggestions?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to install guix system from existing linux with guix package manager?
  2022-05-26 22:21 How to install guix system from existing linux with guix package manager? kiasoc5
@ 2022-05-27 10:03 ` Giovanni Biscuolo
  2022-05-28 10:51   ` Giovanni Biscuolo
  2022-05-28 19:56   ` kiasoc5
  0 siblings, 2 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2022-05-27 10:03 UTC (permalink / raw)
  To: kiasoc5, help-guix

[-- Attachment #1: Type: text/plain, Size: 2880 bytes --]

Hello kiasoc5,

IMHO what you are trying to do is an interesting path to... ascension
:-)

For my desktop and laptop I'm still using Guix on top of a foreign
distro (Debian) because... I'm conservative :-D, so I'd very much like
to have a way to try to slowly switch to Guix System with the "safety
net" to be able to boot my current system if I'm in trouble; this way
also I can spare some cash avoiding to buy a new dedicated machine for
this experiments.

kiasoc5@disroot.org writes:

[...]

> @guix-root is mounted on / on guix system
> @gnu-store is mounted on /gnu/store on guix system and shared between
> arch and guix
> @home is mounted on /home and shared between arch and guix
>
> So I think the steps are as follows:
> 0. backup data (just in case)

Also backup /var/guix so you should be able to restore a working Guix
status (with working I mean in your current foreign distro)

> 1. move /gnu/store to subvolume
> 2. install Guix system manually with the following file systems:
>
> (mapped-devices
>   (list (mapped-device
>     (source (uuid "my-uuid"))
>     (target "cryptroot")
>     (type luks-device-mapping))))
>
> (file-systems (append
>                (list (file-system

[...]

>                %base-file-systems))

In your snippet config you missed to mount /home ;-)
(you also need to configure GRUB for dual boot, but I guess you know)

> 3. configure uefi to boot guix grub by default
>
> WDYT? any tips/suggestions?

I never tried this, but beware that the UID and GID of user(s) in
your new Guix System sould be the very same of the arch system to be
able to access homes, /including/ Guix profiles of users (stored in
/home/$USER...)

Important: if you want to be able to share the store between the two
systems you should also share the /status/ of Guix, stored in
LOCALSTATEDIR/guix/ (usually /var/guix), since it contains a lot of
useful data and AFAIU it must be kept in sync between the foreign distro
and the Guix System [1].  This is the most critical part about being
able to share Guix between two different host operating systems.

Last but not least, once you have installed Guix System you have to
decide what manages your GRUB configuraton: Guix System or arch, you
cannot share the grub config between the two; Guix System have a
stateless GRUB config (and it' good and fair) so I suggest you to use it
for GRUB configuration, but if you decide to keep using arch this is a
good tip: https://yhetil.org/guix/20181031125428.GA814@doom/

There's nothing else it comes to my mind now regarding this "migrate and
share path"

AFAIU with the above caveats, you should be able to "share Guix" between
the two systems in dual boot.

Please let me know your progresses, I'm interested!

Happy Hacking! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to install guix system from existing linux with guix package manager?
  2022-05-27 10:03 ` Giovanni Biscuolo
@ 2022-05-28 10:51   ` Giovanni Biscuolo
  2022-05-28 19:56   ` kiasoc5
  1 sibling, 0 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2022-05-28 10:51 UTC (permalink / raw)
  To: kiasoc5, help-guix

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

Hello kiasoc5,

this morning I realized that...

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

>> WDYT? any tips/suggestions?
>
> I never tried this,

ehrm: it's false :-O

Actually I'm using a shared store AND "LOCALSTATEDIR/guix/" (usually
/var/guix) between my host OS and all my LXC containers, it's something
I learned by adapting Ludo' and Ricardo notes on installing Guix on a
cluster; please see this message (it was Feb 2019, I forgot I wrote
that) for details and pointers to the relevant documentation:

https://yhetil.org/guix/87h8d8dl6d.fsf@roquette.mug.biscuolo.net/

In your case the "store and state sharing" systems are not running and
at the same time like on a cluster, but from a systemistic point of view
it's (almost) the same thing some of us are already doing in their
setup.

Please pay attention: you can skip the setup of guix-daemon on client
(compute) nodes since... you have no clients :-), but you should keep
guix-daemon updated (as root, sudo -E...) on both dual-boot operating
systems to avoid potential problems due to changes in state data format
and/or API.

Obviously also consider all the caveats I mentioned in my previous
message.

As a side note, you could also consider to switch to Guix System and
keep your foreign distro running as an LXC container sharing store and
state with the host, but you have to be familiar with LXC tooling [1]
AND know how to "convert" a "physical" machine to an LXC container [2],
giving the guests acces to the host GPU [3] for graphical applications
or using remote dektop applications like SPICE or VNC... it's a little
bit complex but pure fun!

[...]

Please keep us updated on your progress!

Happy Hacking! Gio'

[1] see info '(guix) Virtualization services'

[2] this is a sort of howto:
https://askubuntu.com/questions/680608/how-to-migrate-physical-12-04-machine-into-lxc

[3] https://bookstack.swigg.net/books/linux/page/lxc-gpu-access


-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to install guix system from existing linux with guix package manager?
  2022-05-27 10:03 ` Giovanni Biscuolo
  2022-05-28 10:51   ` Giovanni Biscuolo
@ 2022-05-28 19:56   ` kiasoc5
  2022-05-30  9:14     ` Giovanni Biscuolo
  1 sibling, 1 reply; 5+ messages in thread
From: kiasoc5 @ 2022-05-28 19:56 UTC (permalink / raw)
  To: Giovanni Biscuolo, help-guix

Hi Giovanni,

May 27, 2022, 10:06 AM, "Giovanni Biscuolo" <g@xelera.eu mailto:g@xelera.eu?to=%22Giovanni%20Biscuolo%22%20%3Cg%40xelera.eu%3E > wrote:

> IMHO what you are trying to do is an interesting path to... ascension

Ascension, that's a great way to put it!

> For my desktop and laptop I'm still using Guix on top of a foreign
> distro (Debian) because... I'm conservative :-D, so I'd very much like
> to have a way to try to slowly switch to Guix System with the "safety
> net" to be able to boot my current system if I'm in trouble; this way
> also I can spare some cash avoiding to buy a new dedicated machine for
> this experiments.
> 

I plan to try it out in a VM first. The new Arch installer sets up btrfs subvolumes automatically so it will be good for testing.

> I never tried this, but beware that the UID and GID of user(s) in
> your new Guix System sould be the very same of the arch system to be
> able to access homes, /including/ Guix profiles of users (stored in
> /home/$USER...)

Yes, I believe most Linuxes set the first created user to a UID and GID of 1000, so hopefully this is not an issue.

> Important: if you want to be able to share the store between the two
> systems you should also share the /status/ of Guix, stored in
> LOCALSTATEDIR/guix/ (usually /var/guix), since it contains a lot of
> useful data and AFAIU it must be kept in sync between the foreign distro
> and the Guix System [1]. This is the most critical part about being
> able to share Guix between two different host operating systems.

Should I make /var/guix a subvolume as well?

ALso the only directory in /gnu is /gnu/store right? So I could just have an @gnu subvolume mounted on /gnu instead of a @gnu-store subvolume mounted on /gnu/store?

> Last but not least, once you have installed Guix System you have to
> decide what manages your GRUB configuraton: Guix System or arch, you
> cannot share the grub config between the two; Guix System have a
> stateless GRUB config (and it' good and fair) so I suggest you to use it
> for GRUB configuration, but if you decide to keep using arch this is a
> good tip: https://yhetil.org/guix/20181031125428.GA814@doom/

Thanks for the tip. What if I install another bootloader on Arch like systemd boot? Then there will not be a bootloader conflict and I can select one with efibootmgr.

May 28, 2022, 10:51 AM, "Giovanni Biscuolo" <g@xelera.eu mailto:g@xelera.eu?to=%22Giovanni%20Biscuolo%22%20%3Cg%40xelera.eu%3E > wrote:

> Actually I'm using a shared store AND "LOCALSTATEDIR/guix/" (usually
> /var/guix) between my host OS and all my LXC containers, it's something
> I learned by adapting Ludo' and Ricardo notes on installing Guix on a
> cluster; please see this message (it was Feb 2019, I forgot I wrote
> that) for details and pointers to the relevant documentation:
> 
> https://yhetil.org/guix/87h8d8dl6d.fsf@roquette.mug.biscuolo.net/
> 
> In your case the "store and state sharing" systems are not running and
> at the same time like on a cluster, but from a systemistic point of view
> it's (almost) the same thing some of us are already doing in their
> setup.

Interesting, this does have some parallels.

> As a side note, you could also consider to switch to Guix System and
> keep your foreign distro running as an LXC container sharing store and
> state with the host, but you have to be familiar with LXC tooling [1]
> AND know how to "convert" a "physical" machine to an LXC container [2],
> giving the guests acces to the host GPU [3] for graphical applications
> or using remote dektop applications like SPICE or VNC... it's a little
> bit complex but pure fun!

Would an LXC approach require two graphics cards? I only have an integrated GPU.

Thanks,
kiasoc5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to install guix system from existing linux with guix package manager?
  2022-05-28 19:56   ` kiasoc5
@ 2022-05-30  9:14     ` Giovanni Biscuolo
  0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2022-05-30  9:14 UTC (permalink / raw)
  To: kiasoc5, help-guix

[-- Attachment #1: Type: text/plain, Size: 3947 bytes --]

Hi kiasoc5,

kiasoc5@disroot.org writes:

[...]

>> I never tried this, but beware that the UID and GID of user(s) in
>> your new Guix System sould be the very same of the arch system to be
>> able to access homes, /including/ Guix profiles of users (stored in
>> /home/$USER...)
>
> Yes, I believe most Linuxes set the first created user to a UID and
> GID of 1000, so hopefully this is not an issue.

Automatic UID and GID assignemt works that way /but/ when
migrating/sharing an OS that's not deterministic and I strongly suggest
you to use the "source system" (arch in your case) UID and GID in your
target system (Guix System in your case)

>> Important: if you want to be able to share the store between the two
>> systems you should also share the /status/ of Guix, stored in
>> LOCALSTATEDIR/guix/ (usually /var/guix), since it contains a lot of
>> useful data and AFAIU it must be kept in sync between the foreign distro
>> and the Guix System [1]. This is the most critical part about being
>> able to share Guix between two different host operating systems.
>
> Should I make /var/guix a subvolume as well?

Oh yes, I forgot to mention this!

Both /gnu/store and /var/guix must be shared so you need a dedicated
block device: partition or LVM/btrfs (sub)volume.  An alternative could
be to bind mount /gnu/store and /var/guix on the "target system" [1]
(Guix System in your case)... but IMHO the dedicated block device is
better for dual (multiple) boot systems like in your case

> ALso the only directory in /gnu is /gnu/store right? So I could just
> have an @gnu subvolume mounted on /gnu instead of a @gnu-store
> subvolume mounted on /gnu/store?

AFAIK /gnu is still not used by any other software to store files, but
it could be in the future... who knows?  For this reason I'd share only
/gnu/store for Guix and nothing more, eventually sharing other
/gnu/folders in the future, IF needed.

>> Last but not least, once you have installed Guix System you have to
>> decide what manages your GRUB configuraton: Guix System or arch, you
>> cannot share the grub config between the two; Guix System have a
>> stateless GRUB config (and it' good and fair) so I suggest you to use it
>> for GRUB configuration, but if you decide to keep using arch this is a
>> good tip: https://yhetil.org/guix/20181031125428.GA814@doom/
>
> Thanks for the tip. What if I install another bootloader on Arch like
> systemd boot? Then there will not be a bootloader conflict and I can
> select one with efibootmgr.

Yes of course you can always select your preferred boot mamager with
efibootmgr, but I'm lazy and I like to have GRUB manage all my OSs :-)

> May 28, 2022, 10:51 AM, "Giovanni Biscuolo" <g@xelera.eu mailto:g@xelera.eu?to=%22Giovanni%20Biscuolo%22%20%3Cg%40xelera.eu%3E > wrote:

[...]

>> As a side note, you could also consider to switch to Guix System and
>> keep your foreign distro running as an LXC container sharing store and
>> state with the host, but you have to be familiar with LXC tooling [1]
>> AND know how to "convert" a "physical" machine to an LXC container [2],
>> giving the guests acces to the host GPU [3] for graphical applications
>> or using remote dektop applications like SPICE or VNC... it's a little
>> bit complex but pure fun!
>
> Would an LXC approach require two graphics cards? I only have an
> integrated GPU.

No, you can share your GPU with guests or connect to guests using remote
desktop, as mentioned above ;-)


Happy hacking! Gio'



[1] I'm using this technique in my LXC containers, excerpt from one
config:

--8<---------------cut here---------------start------------->8---

lxc.mount.entry=/gnu/store gnu/store none ro,bind 0 0
lxc.mount.entry=/var/guix var/guix none bind 0 0

--8<---------------cut here---------------end--------------->8---

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-30  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 22:21 How to install guix system from existing linux with guix package manager? kiasoc5
2022-05-27 10:03 ` Giovanni Biscuolo
2022-05-28 10:51   ` Giovanni Biscuolo
2022-05-28 19:56   ` kiasoc5
2022-05-30  9:14     ` Giovanni Biscuolo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).