* Installing Guix System on an OVH VPS (Virtual Private Server)
@ 2024-08-31 12:40 Maxim Cournoyer
2024-08-31 15:56 ` Edouard Klein
0 siblings, 1 reply; 5+ messages in thread
From: Maxim Cournoyer @ 2024-08-31 12:40 UTC (permalink / raw)
To: help-guix
Hi,
I've recently experimented with installing Guix System on a cheap OVH
VPS server, and here are my findings in case it helps someone else:
1. The base images do not include Guix System, so start with something
like Debian 12 or newer.
2. From their web interface, reboot into their rescue mode.
3. Make enough space on the rescue root to have about 500 MiB free,
enough for 'apt install guix' to succeed. I found one unused kernel
image which freed a lot of space, along with 'gcc'.
4. Recreate /dev/sdb1 from 20 GB to 15 GB, and create a new 5 GB
partition after that, as /dev/sdb2. Mount /dev/sdb2 as /gnu in the
rescue. This is because the rescue file system is too small to run
'guix system init'.
I've also opted for Btrfs file system, and made sure to mount the
partitions with 'mount -o compress=zstd ...' to shrink space usage as
much as I could.
5. Run 'guix system init /mnt your-config.scm', where /mnt is the mount
point for /dev/sdb1. For the config, start with the bare-bones.tmpl
config. Use plain GRUB (BIOS, not UEFI), and add the virtio_scsi module
to the initrd:
--8<---------------cut here---------------start------------->8---
(initrd-modules (cons "virtio_scsi" ; Needed to find the disk
%base-initrd-modules))
--8<---------------cut here---------------end--------------->8---
The other important bit to see the kernel messages at boot is this:
--8<---------------cut here---------------start------------->8---
(kernel-arguments (list "console=ttyS0 console=tty0"))
--8<---------------cut here---------------end--------------->8---
Here's what my actual config file looks like, with some parts redacted:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu))
(use-service-modules networking ssh)
(use-package-modules ssh)
(operating-system
(host-name "vps-xxx")
(locale "en_US.utf8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
(targets '("/dev/sdb"))))
(kernel-arguments (list "console=ttyS0 console=tty0"))
(file-systems (cons* (file-system
(device (uuid "bbf61fb4-b6ce-44af-ac57-1850cd708965"))
(mount-point "/")
(type "btrfs")
(options "compress=zstd"))
%base-file-systems))
(initrd-modules (cons "virtio_scsi" ; Needed to find the disk
%base-initrd-modules))
;; This is where user accounts are specified. The "root"
;; account is implicit, and is initially created with the
;; empty password.
(users (cons (user-account
(name "some-user")
(group "users")
;; Adding the account to the "wheel" group
;; makes it a sudoer. Adding it to "audio"
;; and "video" allows the user to play sound
;; and access the webcam.
(supplementary-groups '("wheel")))
%base-user-accounts))
;; Add services to the baseline: a DHCP client and an SSH
;; server. You may wish to add an NTP service here.
(services
(append
(list (service dhcp-client-service-type)
(service openssh-service-type
(openssh-configuration
(openssh openssh-sans-x)
(port-number 2222)
(authorized-keys
`(("some-user" ,(plain-file "maxim-ssh.pub"
"ssh-XXX XXXXXXXX")))))))
%base-services))
(sudoers-file
(plain-file "sudoers"
(string-append (plain-file-content %sudoers-specification)
"some-user ALL = NOPASSWD: ALL\n"))))
--8<---------------cut here---------------end--------------->8---
The sudoers-file part is so that I can 'guix deploy' to it.
Happy hacking!
--
Maxim
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Installing Guix System on an OVH VPS (Virtual Private Server)
2024-08-31 12:40 Installing Guix System on an OVH VPS (Virtual Private Server) Maxim Cournoyer
@ 2024-08-31 15:56 ` Edouard Klein
2024-08-31 16:11 ` Edouard Klein
2024-09-02 1:20 ` Maxim Cournoyer
0 siblings, 2 replies; 5+ messages in thread
From: Edouard Klein @ 2024-08-31 15:56 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: help-guix
Hi Maxim,
Good job ! It must not have been easy to come up with a series of steps
that actually work...
The method I use for https://guix-hosting.com/ is somewhat different and
does not require partitionning the disk but has the disadvantage of
ending up with an ext4 drive instead of btrfs, which now that I have
space problems with the store (mitigated by some aggressive gc-ing see
https://the-dam.org/docs/explanations/GarbageCollection.html), may be
nice to have.
A single pass of btrfs-convert may solve that later problem however.
Here is the method, jottled down quickly, please forgive me if I did not
take the time to publish it properly and sooner.
On your main machine, create an image of the system you want on your
VPS, or use the base install image from the GNU Guix website:
guix system image /tmp/baseGS.scm
Reboot your VPS in rescue mode, then in the rescue system, run:
: apt update
: apt install qemu-utils # Do it first otherwise no space left to do it after
: rm /var/cache/apt/archives/*
: wget $TOTO # The image created earlier, you can also scp it from your
main machine to the rescue.
: qemu-img dd if=gs.qcow2 bs=4M of=/dev/sdb -O raw
Resize the partition
: fdisk /dev/sdb
then d, n, p, w to recreate the partition till the end of the disk
Resize the FS
: resize2fs /dev/sdb2
# I guesse here is where btrfs-convert would be appropriate
From there you can reboot into Guix and it should work.
As for the system I use (minimal-ovh) from my channel as a base:
https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/system.scm?ref_type=heads#L171
which looks mostly like yours.
Again I apologize for not publishing it sooner, I guess it would have
saved you some troubles.
Cheers,
Edouard.
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> Hi,
>
> I've recently experimented with installing Guix System on a cheap OVH
> VPS server, and here are my findings in case it helps someone else:
>
> 1. The base images do not include Guix System, so start with something
> like Debian 12 or newer.
>
> 2. From their web interface, reboot into their rescue mode.
>
> 3. Make enough space on the rescue root to have about 500 MiB free,
> enough for 'apt install guix' to succeed. I found one unused kernel
> image which freed a lot of space, along with 'gcc'.
>
> 4. Recreate /dev/sdb1 from 20 GB to 15 GB, and create a new 5 GB
> partition after that, as /dev/sdb2. Mount /dev/sdb2 as /gnu in the
> rescue. This is because the rescue file system is too small to run
> 'guix system init'.
>
> I've also opted for Btrfs file system, and made sure to mount the
> partitions with 'mount -o compress=zstd ...' to shrink space usage as
> much as I could.
>
> 5. Run 'guix system init /mnt your-config.scm', where /mnt is the mount
> point for /dev/sdb1. For the config, start with the bare-bones.tmpl
> config. Use plain GRUB (BIOS, not UEFI), and add the virtio_scsi module
> to the initrd:
>
> (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
> %base-initrd-modules))
>
>
> The other important bit to see the kernel messages at boot is this:
>
> (kernel-arguments (list "console=ttyS0 console=tty0"))
>
>
>
> Here's what my actual config file looks like, with some parts redacted:
>
> (use-modules (gnu))
> (use-service-modules networking ssh)
> (use-package-modules ssh)
>
> (operating-system
> (host-name "vps-xxx")
> (locale "en_US.utf8")
>
> (bootloader (bootloader-configuration
> (bootloader grub-bootloader)
> (targets '("/dev/sdb"))))
>
> (kernel-arguments (list "console=ttyS0 console=tty0"))
>
> (file-systems (cons* (file-system
> (device (uuid "bbf61fb4-b6ce-44af-ac57-1850cd708965"))
> (mount-point "/")
> (type "btrfs")
> (options "compress=zstd"))
> %base-file-systems))
>
> (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
> %base-initrd-modules))
>
> ;; This is where user accounts are specified. The "root"
> ;; account is implicit, and is initially created with the
> ;; empty password.
> (users (cons (user-account
> (name "some-user")
> (group "users")
> ;; Adding the account to the "wheel" group
> ;; makes it a sudoer. Adding it to "audio"
> ;; and "video" allows the user to play sound
> ;; and access the webcam.
> (supplementary-groups '("wheel")))
> %base-user-accounts))
>
> ;; Add services to the baseline: a DHCP client and an SSH
> ;; server. You may wish to add an NTP service here.
> (services
> (append
> (list (service dhcp-client-service-type)
> (service openssh-service-type
> (openssh-configuration
> (openssh openssh-sans-x)
> (port-number 2222)
> (authorized-keys
> `(("some-user" ,(plain-file "maxim-ssh.pub"
> "ssh-XXX XXXXXXXX")))))))
> %base-services))
>
> (sudoers-file
> (plain-file "sudoers"
> (string-append (plain-file-content %sudoers-specification)
> "some-user ALL = NOPASSWD: ALL\n"))))
>
> The sudoers-file part is so that I can 'guix deploy' to it.
>
> Happy hacking!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Installing Guix System on an OVH VPS (Virtual Private Server)
2024-08-31 15:56 ` Edouard Klein
@ 2024-08-31 16:11 ` Edouard Klein
2024-09-02 1:22 ` Maxim Cournoyer
2024-09-02 1:20 ` Maxim Cournoyer
1 sibling, 1 reply; 5+ messages in thread
From: Edouard Klein @ 2024-08-31 16:11 UTC (permalink / raw)
To: Edouard Klein; +Cc: Maxim Cournoyer, help-guix
Also, here goes my "moat" for guix-hosting.com, but as RMS once sang:
"Hoarders can get piles of money,
That is true, hackers, that is true.
But they cannot help their neighbors;
That's not good, hackers, that's not good."
https://www.gnu.org/music/free-software-song.en.html
Edouard Klein <edou@rdklein.fr> writes:
> Hi Maxim,
>
> Good job ! It must not have been easy to come up with a series of steps
> that actually work...
>
> The method I use for https://guix-hosting.com/ is somewhat different and
> does not require partitionning the disk but has the disadvantage of
> ending up with an ext4 drive instead of btrfs, which now that I have
> space problems with the store (mitigated by some aggressive gc-ing see
> https://the-dam.org/docs/explanations/GarbageCollection.html), may be
> nice to have.
>
> A single pass of btrfs-convert may solve that later problem however.
>
> Here is the method, jottled down quickly, please forgive me if I did not
> take the time to publish it properly and sooner.
>
> On your main machine, create an image of the system you want on your
> VPS, or use the base install image from the GNU Guix website:
>
> guix system image /tmp/baseGS.scm
>
> Reboot your VPS in rescue mode, then in the rescue system, run:
>
> : apt update
> : apt install qemu-utils # Do it first otherwise no space left to do it after
> : rm /var/cache/apt/archives/*
> : wget $TOTO # The image created earlier, you can also scp it from your
> main machine to the rescue.
> : qemu-img dd if=gs.qcow2 bs=4M of=/dev/sdb -O raw
>
>
> Resize the partition
> : fdisk /dev/sdb
> then d, n, p, w to recreate the partition till the end of the disk
> Resize the FS
> : resize2fs /dev/sdb2
>
> # I guesse here is where btrfs-convert would be appropriate
>
> From there you can reboot into Guix and it should work.
>
> As for the system I use (minimal-ovh) from my channel as a base:
>
>
> https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/system.scm?ref_type=heads#L171
>
> which looks mostly like yours.
>
>
> Again I apologize for not publishing it sooner, I guess it would have
> saved you some troubles.
>
> Cheers,
>
> Edouard.
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Hi,
>>
>> I've recently experimented with installing Guix System on a cheap OVH
>> VPS server, and here are my findings in case it helps someone else:
>>
>> 1. The base images do not include Guix System, so start with something
>> like Debian 12 or newer.
>>
>> 2. From their web interface, reboot into their rescue mode.
>>
>> 3. Make enough space on the rescue root to have about 500 MiB free,
>> enough for 'apt install guix' to succeed. I found one unused kernel
>> image which freed a lot of space, along with 'gcc'.
>>
>> 4. Recreate /dev/sdb1 from 20 GB to 15 GB, and create a new 5 GB
>> partition after that, as /dev/sdb2. Mount /dev/sdb2 as /gnu in the
>> rescue. This is because the rescue file system is too small to run
>> 'guix system init'.
>>
>> I've also opted for Btrfs file system, and made sure to mount the
>> partitions with 'mount -o compress=zstd ...' to shrink space usage as
>> much as I could.
>>
>> 5. Run 'guix system init /mnt your-config.scm', where /mnt is the mount
>> point for /dev/sdb1. For the config, start with the bare-bones.tmpl
>> config. Use plain GRUB (BIOS, not UEFI), and add the virtio_scsi module
>> to the initrd:
>>
>> (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
>> %base-initrd-modules))
>>
>>
>> The other important bit to see the kernel messages at boot is this:
>>
>> (kernel-arguments (list "console=ttyS0 console=tty0"))
>>
>>
>>
>> Here's what my actual config file looks like, with some parts redacted:
>>
>> (use-modules (gnu))
>> (use-service-modules networking ssh)
>> (use-package-modules ssh)
>>
>> (operating-system
>> (host-name "vps-xxx")
>> (locale "en_US.utf8")
>>
>> (bootloader (bootloader-configuration
>> (bootloader grub-bootloader)
>> (targets '("/dev/sdb"))))
>>
>> (kernel-arguments (list "console=ttyS0 console=tty0"))
>>
>> (file-systems (cons* (file-system
>> (device (uuid "bbf61fb4-b6ce-44af-ac57-1850cd708965"))
>> (mount-point "/")
>> (type "btrfs")
>> (options "compress=zstd"))
>> %base-file-systems))
>>
>> (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
>> %base-initrd-modules))
>>
>> ;; This is where user accounts are specified. The "root"
>> ;; account is implicit, and is initially created with the
>> ;; empty password.
>> (users (cons (user-account
>> (name "some-user")
>> (group "users")
>> ;; Adding the account to the "wheel" group
>> ;; makes it a sudoer. Adding it to "audio"
>> ;; and "video" allows the user to play sound
>> ;; and access the webcam.
>> (supplementary-groups '("wheel")))
>> %base-user-accounts))
>>
>> ;; Add services to the baseline: a DHCP client and an SSH
>> ;; server. You may wish to add an NTP service here.
>> (services
>> (append
>> (list (service dhcp-client-service-type)
>> (service openssh-service-type
>> (openssh-configuration
>> (openssh openssh-sans-x)
>> (port-number 2222)
>> (authorized-keys
>> `(("some-user" ,(plain-file "maxim-ssh.pub"
>> "ssh-XXX XXXXXXXX")))))))
>> %base-services))
>>
>> (sudoers-file
>> (plain-file "sudoers"
>> (string-append (plain-file-content %sudoers-specification)
>> "some-user ALL = NOPASSWD: ALL\n"))))
>>
>> The sudoers-file part is so that I can 'guix deploy' to it.
>>
>> Happy hacking!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Installing Guix System on an OVH VPS (Virtual Private Server)
2024-08-31 15:56 ` Edouard Klein
2024-08-31 16:11 ` Edouard Klein
@ 2024-09-02 1:20 ` Maxim Cournoyer
1 sibling, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2024-09-02 1:20 UTC (permalink / raw)
To: Edouard Klein; +Cc: help-guix
Hi Edouard,
Edouard Klein <edou@rdklein.fr> writes:
> Hi Maxim,
>
> Good job ! It must not have been easy to come up with a series of steps
> that actually work...
Getting GRUB installed correctly proved a bit challenging; so was
dealing with the limited amount of disk space in the rescue
environment. I tried many things before arriving to the solution I
detailed; thanks for sharing yours!
> The method I use for https://guix-hosting.com/ is somewhat different and
> does not require partitionning the disk but has the disadvantage of
> ending up with an ext4 drive instead of btrfs, which now that I have
> space problems with the store (mitigated by some aggressive gc-ing see
> https://the-dam.org/docs/explanations/GarbageCollection.html), may be
> nice to have.
>
> A single pass of btrfs-convert may solve that later problem however.
This is quick and works, but for some reason GRUB couldn't find the disk
or was erroring out after doing so, so you may have to chroot to
reconfigure the system from there (which would have the GRUB
install/config refreshed).
> Here is the method, jottled down quickly, please forgive me if I did not
> take the time to publish it properly and sooner.
>
> On your main machine, create an image of the system you want on your
> VPS, or use the base install image from the GNU Guix website:
>
> guix system image /tmp/baseGS.scm
>
> Reboot your VPS in rescue mode, then in the rescue system, run:
>
> : apt update
> : apt install qemu-utils # Do it first otherwise no space left to do it after
> : rm /var/cache/apt/archives/*
> : wget $TOTO # The image created earlier, you can also scp it from your
> main machine to the rescue.
> : qemu-img dd if=gs.qcow2 bs=4M of=/dev/sdb -O raw
That's pretty cool; I tried something similar using a mbr-raw image
(compressed with zstd) and had some issues with it (GRUB wouldn't find
the disk or something). I think you may be able to replace the 'rm'
command above with 'apt clean'.
>
> Resize the partition
> : fdisk /dev/sdb
> then d, n, p, w to recreate the partition till the end of the disk
> Resize the FS
> : resize2fs /dev/sdb2
>
> # I guesse here is where btrfs-convert would be appropriate
>
> From there you can reboot into Guix and it should work.
>
> As for the system I use (minimal-ovh) from my channel as a base:
>
>
> https://gitlab.com/edouardklein/guix/-/blob/beaverlabs/beaver/system.scm?ref_type=heads#L171
>
> which looks mostly like yours.
>
>
> Again I apologize for not publishing it sooner, I guess it would have
> saved you some troubles.
No worries, it was "fun" figuring it out myself, and the linode cookbook
entry provided the virtio_scsi missing module solution.
It'd be nicer to have a proper machine type for OVH, I don't know if
their API would allow for it (I see we have a
digital-ocean-machine-type for 'guix deploy', although I have no idea
how that works) .
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Installing Guix System on an OVH VPS (Virtual Private Server)
2024-08-31 16:11 ` Edouard Klein
@ 2024-09-02 1:22 ` Maxim Cournoyer
0 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2024-09-02 1:22 UTC (permalink / raw)
To: Edouard Klein; +Cc: help-guix
Hi Edouard,
Edouard Klein <edou@rdklein.fr> writes:
> Also, here goes my "moat" for guix-hosting.com, but as RMS once sang:
>
> "Hoarders can get piles of money,
> That is true, hackers, that is true.
> But they cannot help their neighbors;
> That's not good, hackers, that's not good."
>
> https://www.gnu.org/music/free-software-song.en.html
Hehe! It's good to have guix-hosting.com as a readily available, easy
to go option for when simplicity is preferred :-).
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-02 1:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-31 12:40 Installing Guix System on an OVH VPS (Virtual Private Server) Maxim Cournoyer
2024-08-31 15:56 ` Edouard Klein
2024-08-31 16:11 ` Edouard Klein
2024-09-02 1:22 ` Maxim Cournoyer
2024-09-02 1:20 ` Maxim Cournoyer
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).