AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[nixos](server)

Martin Hope
nh2
Asked: 2021-04-29 04:33:56 +0800 CST

附加磁盘后,Linux 对不同磁盘上的相同挂载感到困惑

  • -1

在将 EBS 卷附加到正在运行的 Linux(在本例中为 NixOS)实例时,我们遇到了一个奇怪的问题(为了在该附加卷上增加文件系统;它是我们关闭的另一台机器的 NixOS 根文件系统下)。

在 attach 之前,一切正常:

# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  100G  0 disk
└─xvda1 202:1    0  100G  0 part

附加后,lsblk奇怪地声称附加卷的分区包含/当前机器的已安装分区:

# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  100G  0 disk
└─xvda1 202:1    0  100G  0 part /nix/store
xvdf    202:80   0  400G  0 disk
└─xvdf1 202:81   0  200G  0 part /

这根本没有意义:

只需“插入”该磁盘,Linux 就会认为根文件系统挂载只是“翻转”到了新磁盘。(这/nix/store是一个 NixOS 只读绑定挂载)以某种方式保留在正确的磁盘上。

Linux中dmesg/之外没有任何消息指出磁盘已附加:journalctl

Apr 28 11:57:21 mymachine kernel: blkfront: xvdf: barrier or flush: disabled; persistent grants: disabled; indirect descriptors: enabled;
Apr 28 11:57:21 mymachine kernel:  xvdf: xvdf1

在fdisk -l中,两个磁盘看起来很正常,并且有不同Disk identifier的 s。

这是不可能的umount /dev/xvdf1;它说坐骑很忙。

为了增加分区的目标,growpart /dev/xvdf 1无论如何都可以工作,但resize2fs /dev/xvdf1失败了:

Filesystem at /dev/xvdg1 is mounted on /; on-line resizing required
old_desc_blocks = 25, new_desc_blocks = 50
resize2fs: No space left on device While checking for on-line resizing support

这是怎么回事,为什么Linux会混淆这些磁盘?

linux mount nixos
  • 1 个回答
  • 66 Views
Martin Hope
Jean-Paul Calderone
Asked: 2021-02-12 11:41:15 +0800 CST

如何为 GitLab NixOS 服务配置主机名?

  • 1

我正在尝试在 NixOS 20.09.1632.a6a3a368dda (Nightingale) 上部署一个新的 GitLab 实例。

我有这个相当小的configuration.nix:

{ modulesPath, ... }:
let
  host = "example.org";
  adminEmail = "[email protected]";
in
{
  imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
  ec2.hvm = true;

  services.gitlab = rec {
    enable = true;

    inherit host;
    port = 80;

    # You, dear sysadmin, have to make these files exist.
    initialRootPasswordFile = "/tmp/gitlab-secrets/initial-password";

    secrets = rec {
      # A file containing 30 "0" characters.
      secretFile = "/tmp/gitlab-secrets/zeros";
      dbFile = secretFile;
      otpFile = secretFile;
      # openssl genrsa 2048 > jws.rsa
      jwsFile = "/tmp/gitlab-secrets/jws.rsa";
    };
  };

  services.nginx = {
    enable = true;
    user = "gitlab";
    virtualHosts = {
      "${host}" = {
        locations."/" = {
          # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
          proxyPass = "http://unix:/var/gitlab/state/tmp/sockets/gitlab.socket";
        };
      };
    };
  };

  networking.firewall = {
    enable = true;
    allowPing = false;
    allowedTCPPorts = [
      22
      80
    ];
  };
}

激活此配置时,会启动许多进程(redis、postgresql、sidekiq 等)。然而,nginx(感谢,我假设,GitLab 的 Rails HTTP 服务器)用以下方式响应请求/:

* Connected to example.org (X.X.X.X) port 80 (#0)
> GET / HTTP/1.1
> Host: example.org
> User-Agent: curl/7.72.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Server: nginx
< Date: Thu, 11 Feb 2021 19:38:40 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Frame-Options: DENY
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Referrer-Policy: strict-origin-when-cross-origin
< X-UA-Compatible: IE=edge
< Location: http://localhost/users/sign_in
< Cache-Control: no-cache
< Set-Cookie: experimentation_subject_id=eyJfcmFpbHMiOnsibWVzc2FnZSI6IklqZGhabU0zWXpVNExUSmxNR1F0TkdZMlpTMWlZVEkwTFdKak1EVTFaREZoTURJd1ppST0iLCJleHAiOm51bGwsInB1ciI6ImNvb2tpZS5leHBlcmltZW50YXRpb25fc3ViamVjdF9pZCJ9fQ%3D%3D--cbf53392028ed41f7c582a64e643476a5c2aab6b; path=/; expires=Mon, 11 Feb 2041 19:38:40 -0000; HttpOnly
< X-Request-Id: 545cc04e-1689-4351-b5a9-ca171f1a85d4
< X-Runtime: 0.060596
< 
* Connection #0 to host example.org left intact
<html><body>You are being <a href="http://localhost/users/sign_in">redirected</a>.</body></html>

由于localhostis not example.org,因此失败。

如何配置 GitLab 以了解其自己的主机名?

ruby-on-rails configuration gitlab nixos
  • 1 个回答
  • 389 Views
Martin Hope
Mohamed Zouari
Asked: 2021-01-09 05:42:53 +0800 CST

使用 nixOs 从远程存储库中读取文件

  • 1

我正在使用 nixOs 包系统构建一个项目。我有一个包含不同配置文件的远程 git repo。我想使用 nix 访问这些文件,而无需编辑远程仓库。

该项目将使用特定的提交哈希访问远程仓库。谁能帮帮我,谢谢。

nix nixos
  • 1 个回答
  • 402 Views
Martin Hope
aij
Asked: 2018-01-06 06:59:30 +0800 CST

无需重启即可从“nixos-rebuild test”中恢复

  • 5

有没有办法在不重新启动后恢复到以前的(或至少是“当前”)配置nixos-rebuild test?

根据nixos-rebuild手册:

   test
       Build and activate the new configuration, but do not
       add it to the GRUB boot menu. Thus, if you reboot
       the system (or if it crashes), you will
       automatically revert to the default configuration
       (i.e. the configuration resulting from the last call
       to nixos-rebuild switch or nixos-rebuild boot).

显然,重新启动应该让我回到正常工作的系统,但似乎没有必要。

该--rollback选项看起来很有希望:

   --rollback
       Instead of building a new configuration as specified
       by /etc/nixos/configuration.nix, roll back to the
       previous configuration. (The previous configuration
       is defined as the one before the “current”
       generation of the Nix profile /nix/var/nix/profiles/
       system.)

除了我想激活“当前”一代,而不是老一代。

例如。第 18 代是“当前”的一代,稍微过时但可以接受。第 17 代更老。我使用nixos-rebuild test --upgrade了哪个破坏了 Chrome,所以我想在不重新启动的情况下恢复到 18。(直到我可以解决升级问题。)

更新:我试过nixos-rebuild test --rollback了,但文档是准确的:它恢复到 17 而不是 18。

nixos
  • 2 个回答
  • 614 Views
Martin Hope
Ant
Asked: 2017-01-10 21:51:35 +0800 CST

如何在 nixos 中执行 bash 脚本

  • 3

我正在尝试创建一个安装 nvm 的 .nix 文件

首先,我尝试在 configuration.nix 中添加:

system.activationScripts = {

  dotfiles = pkgs.lib.stringAfters [ "users" ]
    ''
    curl NVM_URL | bash
    ''
  }
}

但它抱怨 bash 和 curl 没有定义....

所以我尝试创建一个小的 .nix 包,

{ stdenv, fileurl };
stdenv.mkDerivation {
   name="nvm-0.33.0"
   builder = ./install.sh;
   fileurl{
      url: NVM_GIT_MASTER.zip;
   };
}

但随后它抱怨`不能自动调用一个没有默认值的参数的函数{'stdenv'}

运行 nix-build --dry-run ./text,nix 后

这是怎么回事?我正在阅读 nix 页,并将头撞在墙上。

nix nixos
  • 1 个回答
  • 3630 Views
Martin Hope
Savanni D'Gerinel
Asked: 2016-07-15 10:29:05 +0800 CST

如何为 lua 设置 nix-shell 脚本?

  • 5

我正在尝试设置一个包含 lua 5.2、lua 套接字库和其他一些库的 nix-shell 脚本。但是,当我加载 shell 时,最终只有 Lua 存在。

with import <nixpkgs> {};
stdenv.mkDerivation rec {
  name = "lua-env";
  buildInputs = [ lua52Packages.lua lua52Packages.luasocket lua52Packages.luasec lua52Packages.cjson ];
}

当我运行 shell 时,这就是我得到的:

savanni@lapis:~  $ nix-shell lua.nix 

[nix-shell:~]$ lua
Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> require 'socket'
stdin:1: module 'socket' not found:
    no field package.preload['socket']
    no file '/usr/share/lua/5.2/socket.lua'
    no file '/usr/share/lua/5.2/socket/init.lua'
    no file '/usr/lib/lua/5.2/socket.lua'
    no file '/usr/lib/lua/5.2/socket/init.lua'
    no file './socket.lua'
    no file '/usr/lib/lua/5.2/socket.so'
    no file '/usr/lib/lua/5.2/loadall.so'
    no file './socket.so'
stack traceback:
    [C]: in function 'require'
    stdin:1: in main chunk
    [C]: in ?
> 

[nix-shell:~]$ exit
savanni@lapis:~  $ 
nixos
  • 2 个回答
  • 716 Views
Martin Hope
frlan
Asked: 2016-07-06 05:19:39 +0800 CST

如何在 NixOS 上使用 Osm2pgsql 安装 Postgis

  • 0

在 NixOS 上安装 PostGIS 时使用如下表达式

  services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql94; }).v_2_1_4 ];

如何向其中添加其他扩展,例如 Osm2pgsql?

postgresql nix nixos postgis
  • 1 个回答
  • 334 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve