I’ve recently bought a VPS from Contabo in order to host my own Nextcloud instance (and maybe vaultwarden and abby later). It’s my first time ever using a VPS but I’ve figured NixOS would be great to host those thanks to the reproducibility and modules, and I’ve been using NixOS on my desktop so I figured it wouldn’t so hard right ? right ???

Well turns out it IS hard, I’ve been trying to install NixOS on my VPS using nixos-anywhere and using this template. The config works but the install seems to fail all the time ? It should output Done when it successfully finished the install, but instead it outputs this:

+ partprobe /dev/sda
+ udevadm trigger --subsystem-match=block
+ udevadm settle --timeout 120
+ device=/dev/disk/by-partlabel/disk-disk1-ESP
+ extraArgs=()
+ declare -a extraArgs
+ format=vfat
+ mountOptions=('defaults')
+ declare -a mountOptions
+ mountpoint=/boot
+ type=filesystem
+ grep -q TYPE=
+ blkid /dev/disk/by-partlabel/disk-disk1-ESP
+ mkfs.vfat /dev/disk/by-partlabel/disk-disk1-ESP
mkfs.fat 4.2 (2021-01-31)
mkfs.vfat: unable to open /dev/disk/by-partlabel/disk-disk1-ESP: No such file or directory
+ rm -rf /tmp/tmp.1dADBpsCkQ
Connection to 185.174.255.56 closed.

I was running the install like so: nix run nixpkgs#nixos-anywhere -- --flake .#generic --generate-hardware-config nixos-generate-config ./hardware-configuration.nix root@<address>

And I can confirm it’s broken cuz when I try to ssh into the VPS afterward it just never let’s me connect.

But that’s not all, it actually did work TWICE and I was able to ssh into the server, but it then I noticed it just didn’t have any network access, couldn’t pull a git repo or even ping an address, and so couldn’t rebuild my config in the VPS. Idk how to fix that either, I imagine this could be related to the nextwork config but I’m not sure For example:

$ ping nixos.org
ping: nixos.org: Name or service not known

I tried all I could find online but nothing really worked, so idk what to do from here

Here’s a link to the config I’m using: https://codeberg.org/claymorwan/nixos-VPS

EDIT: I’ve managed to fix both of those issue it seems, but my nextcloud instance still isn’t reachable. I did create an A record in my domain’s DNS pointing to my VPS’ ip address and I belive I’ve opened the correct ports in the config so idk what’s wrong here

Nextcloud does start correctly too according to the service

Nov 10 20:29:37 nixos systemd[1]: Starting nextcloud-setup.service...
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: No upgrade required.
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: Note: This command triggers the upgrade actions associated with a new version. The new version's updated source files must be deployed in advance.
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: See the upgrade documentation: https://docs.nextcloud.com/server/35/go.php?to=admin-update for more information.
Nov 10 20:29:42 nixos nextcloud-setup-start[687]: System config value trusted_domains deleted
Nov 10 20:29:42 nixos nextcloud-setup-start[691]: calendar already enabled
Nov 10 20:29:42 nixos nextcloud-setup-start[691]: tasks already enabled
Nov 10 20:29:43 nixos nextcloud-setup-start[695]: System config value trusted_domains => 0 set to string nextcloud.deadf.org
Nov 10 20:29:43 nixos systemd[1]: nextcloud-setup.service: Deactivated successfully.
Nov 10 20:29:43 nixos systemd[1]: Finished nextcloud-setup.service.
Nov 10 20:29:43 nixos systemd[1]: nextcloud-setup.service: Consumed 3.423s CPU time over 5.718s wall clock time, 129.1M memory peak, 145.3M read from disk, 8K written to disk.
  • GrapheneOSRuinedMyPixel@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 days ago

    Regarding your second issue: can you reach nextcloud locally, not through cloudflare? Try mapping the 443 port of your VPS to localhost with ssh -L 5555:127.0.0.1:443 your_servers_ip and then connecting to localhost:5555 from your browser. I’m assuming nextcloud runs on 443

    • claymorwan@lemmy.blahaj.zoneOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      Tried running ssh -L 5555:127.0.0.1:443 root@<ip> (the other command tried to ssh with my username and didn’t work) then opened the localhost:5555 in my browser but i got a connection reset error, terminal was outputting this:

      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      channel 3: open failed: connect failed: Connection refused
      

      Tried with the other 2 ports I have opened in the VPS’ firewall config (80 and 3478), but both didn’t work too

  • hallettj@leminal.space
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 days ago

    I did some reading, and I think your problem is there is a race-condition in the timing of that by-partlabel disk device symlink showing up. I found this comment that explains the issue. That repo isn’t related to your situation, but I think the fix is. The comment links to a git change that adds a wait in a disko script to avoid the race condition.

    Looking at the nixos-anywhere docs, it looks like you have a disko.nix configuration in your setup. Try editing it to use that fix.

    • claymorwan@lemmy.blahaj.zoneOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 days ago

      I ended up finding out that it installs it correctly if I run nix run nixpkgs#nixos-anywhere -- --flake .#generic root@<address>, but I think that’s still something worth adding to the config just in case thanks I’ve also fixed the network issue but my nextcloud instance is still unreachable i need to find out why