구성

구성

나는 chroot 내부에 Gluster를 배포하기 위해 bash 명령을 작성 중입니다.그로스트겐. 호스트에서 chroot로 파일을 마운트하는 데 문제가 있습니다. Schroot의 매뉴얼 페이지는 다음을 제안합니다.

$ man schroot.conf | grep -A4 setup.fstab=
    setup.fstab=filename
            The filesystem table file to be used to mount filesystems within the chroot.  The format of this file is the same as for /etc/fstab, documented in fstab(5).  The  only  difference  is
            that  the  mountpoint  path fs_dir is relative to the chroot, rather than the root.  Also note that mountpoints are canonicalised on the host, which will ensure that absolute symlinks
            point inside the chroot, but complex paths containing multiple symlinks may be resolved incorrectly; it is inadvisable to use nested symlinks as mountpoints.

그런데 이 구성 값을 에서 사용하려고 하면 /etc/schroot/chroot.d/glusterchroot.conf디렉터리가 마운트되지 않는 것 같습니다. 이 작업을 수행하려면 추가해야 할 것이 있나요?

구성

콘텐츠 /etc/schroot/chroot.d/glusterchroot.conf:

user@computer:~$ cat /etc/schroot/chroot.d/glusterchroot.conf
#
#
[glusterchroot]
description=Gluster server chroot
directory=/srv/glusterchroot
root-users=root
setup.fstab=glusterchroot/fstabfile
root-groups=root

콘텐츠 /etc/schroot/glusterchroot/fstabfile:

user@computer:~$ cat /etc/schroot/glusterchroot/fstabfile 
/run/udev /run/udev none bind,create=file 0 0
sys /sys sysfs defaults 0 1
proc /proc proc defaults 0 0
/dev/ /dev none bind,create=file 0 0
/run/lvm /run/lvm none bind,create=file 0 0
/run/udev /run/udev none bind,create=file 0 0

glusterchroot 정보:

user@computer:~$ schroot -i -c glusterchroot
  ─── Chroot ───
  Name                   glusterchroot
  Description            Gluster server chroot
  Type                   plain
  Message Verbosity      normal
  Users                  
  Groups                 
  Root Users             root
  Root Groups            root
  Aliases                
  Preserve Environment   false
  Default Shell          
  Environment Filter     ^(BASH_ENV|CDPATH|ENV|HOSTALIASES|IFS|KRB5_CONFIG|KRBCONFDIR|KRBTKFILE|KRB_CONF|LD_.*|LOCALDOMAIN|NLSPATH|PATH_LOCALE|RES_OPTIONS|TERMINFO|TERMINFO_DIRS|TERMPATH)$
  Run Setup Scripts      false
  Configuration Profile  default
  Script Configuration   
  Session Managed        false
  Session Cloned         false
  Session Purged         false
  Path                   /srv/glusterchroot
  Directory              /srv/glusterchroot
  Personality            undefined
  User Modifiable Keys   
  Root Modifiable Keys   
  User Data              
    setup.config         default/config
    setup.copyfiles      default/copyfiles
    setup.fstab          glusterchroot/fstabfile
    setup.nssdatabases   default/nssdatabases

setup.fstab또한 아래에 설명된 것과 /etc/schroot/default/fstab동일한 문제가 있는 기본값을 사용해 보았습니다 .

질문

lschroot에 마운트된 디렉토리:

user@computer:~$ sudo schroot -d / -c glusterchroot -- ls /
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
user@computer:~$ sudo schroot -d / -c glusterchroot -- ls /proc
user@computer:~$ sudo schroot -d / -c glusterchroot -- ls /run
lock  mount
user@computer:~$ sudo schroot -d / -c glusterchroot -- ls /sys

이러한 설치가 필요한 명령의 예:

user@computer:~$ sudo schroot -d / -c glusterchroot -- findmnt
findmnt: can't read /proc/mounts: No such file or directory

ls호스트의 동일한 디렉터리에서:

user@computer:~/Documents/gitRepos/generalK8s/glusterchroot$ ls /proc
1     1186  188   233   2541  2719  2864  3548   4     503    76879  903    96          driver         mdstat         thread-self
10    12    19    2334  2551  2720  2909  3549   40    506    777    90370  96493       dynamic_debug  meminfo        timer_list
100   1223  192   2338  2557  2721  2941  3551   404   507    778    904    96522       execdomains    misc           tty
101   124   1942  234   2561  2722  2965  3565   41    508    782    905    96847       fb             modules        uptime
1017  1254  1964  2344  2570  2723  2997  35710  4194  59014  784    906    97          filesystems    mounts         version
1019  1266  197   2362  2579  2724  3     3581   42    59433  787    907    98          fs             mtrr           version_signature
103   127   2     2366  2580  2725  30    3593   43    59435  788    910    99          interrupts     net            vmallocinfo
1032  13    20    24    2589  2726  3049  36     435   59541  8      913    acpi        iomem          pagetypeinfo   vmstat
1047  135   21    2427  26    2728  3052  3613   4358  6      83498  914    asound      ioports        partitions     zoneinfo
105   14    22    2444  2664  2737  3057  3629   4380  60307  86954  915    bootconfig  irq            pressure
106   15    2268  2477  2668  2743  3075  3639   44    60565  87016  91540  buddyinfo   kallsyms       schedstat
109   157   2281  2484  2678  2747  31    3640   4417  60773  87483  916    bus         kcore          scsi
11    16    2282  2487  2683  2748  3124  367    4498  68293  87490  917    cgroups     keys           self
110   1777  2288  25    2699  2785  32    3676   45    68316  87498  919    cmdline     key-users      slabinfo
1110  18    2289  2500  27    28    3220  37     471   70459  877    92     consoles    kmsg           softirqs
1111  1827  2290  2517  2701  2811  3234  3757   4792  75503  880    920    cpuinfo     kpagecgroup    stat
113   1848  2300  2524  2712  2812  3265  3768   4824  76661  881    922    crypto      kpagecount     swaps
114   185   2310  2525  2714  282   33    3784   4835  76738  883    93     devices     kpageflags     sys
115   186   2321  2532  2716  2821  34    38     4842  76855  884    93656  diskstats   loadavg        sysrq-trigger
1184  187   2329  2537  2717  2830  3545  39     5     76873  89805  94     dma         locks          sysvipc
user@computer:~/Documents/gitRepos/generalK8s/glusterchroot$ ls /sys
block  bus  class  dev  devices  firmware  fs  hypervisor  kernel  module  power
user@computer:~/Documents/gitRepos/generalK8s/glusterchroot$ ls /run
acpid.pid      crond.pid        docker.sock  log             openvpn-client  screen             spice-vdagentd    udev
acpid.socket   crond.reboot     fsck         lvm             openvpn-server  sendsigs.omit.d    sshd              udisks2
alsa           cups             gdm3         motd.d          plymouth        shm                sshd.pid          user
avahi-daemon   dbus             gdm3.pid     mount           pppconfig       sm-notify.pid      sudo              utmp
blkid          dmeventd-client  initctl      netns           rpcbind         snapd              systemd           uuidd
console-setup  dmeventd-server  initramfs    network         rpcbind.lock    snapd-snap.socket  thermald          vpnagentd.pid
containerd     docker           irqbalance   NetworkManager  rpcbind.sock    snapd.socket       tmpfiles.d        wpa_supplicant
credentials    docker.pid       lock         openvpn         rpc_pipefs      speech-dispatcher  ubuntu-advantag

답변1

여기서 단서는 Run Setup Scripts false의 출력에 있습니다 schroot -i -c glusterchroot. 읽어보면 man schroot.conf다음과 같은 줄이 보일 것입니다.

type=type
              The type of the chroot.  Valid types are ‘plain’, ‘directory’, ‘file’, ‘loopback’, ‘block-device’, ‘btrfs-snapshot’, ‘zfs-snapshot’ and ‘lvm-snapshot’.  If empty or omitted,  the  de‐
              fault type is ‘plain’.  Note that ‘plain’ chroots do not run setup scripts and mount filesystems; ‘directory’ is recommended for normal use (see “Plain and directory chroots”, below).

다음으로 업데이트하면 /etc/schroot/chroot.d/glusterchroot.conf문제가 해결되었습니다.

[glusterchroot]
description=Gluster server chroot
preserve-environment=true
directory=/srv/glusterchroot
root-users=root
personality=linux
setup.fstab=default/fstab
type=directory
root-groups=root

관련 정보