터미널을 통해 chroot 모드에서 dconf 설정을 변경하는 방법은 무엇입니까?

터미널을 통해 chroot 모드에서 dconf 설정을 변경하는 방법은 무엇입니까?

나는 부팅 가능한 GUI 데스크탑 시스템을 사용했고 dconf write작동 gsetting set합니다. chroot 환경의 스크립트에서 실행을 시도했지만 오류가 발생했습니다. 웹 검색에서 유사한 잘못된 QA가 발견되었습니다.명령줄 "dbus-launch --autolaunch="xyz" --binary-syntax --close-stderr" 생성 중 오류 발생: 하위 프로세스가 코드 1로 종료되었습니다.,https://www.reddit.com/r/linuxquestions/comments/n90sry/error_spawning_command_line_dbuslaunch/그런데 전자에 대해서는 답변이 없고, 나중에 알고 보니 오류의 원인이 나와 달랐습니다.

man 7 dconf의 매뉴얼 페이지에서 man dconf편집할 특정 데이터베이스를 선택하는 방법을 찾지 못했습니다. 어떤 방법이 있나요?

작업 시스템에서 dconf 데이터베이스를 찾으려고 하는데 dconf write작업 시스템 에서도 $ echo $XDG_CONFIG_HOME빈 출력이 생성되지만 /etc/dconf/profile/존재하지 않습니다 $ echo $DCONF_PROFILE.

$ man 7 dconf
DCONF_PROFILE can specify a relative path to a file in
       /etc/dconf/profile/, or an absolute path (such as in a user's home
       directory).
A "user-db" line specifies a user database. These databases are found
       in $XDG_CONFIG_HOME/dconf/  

1개 추가됨(@aviro의 의견에서 요청한 대로):

# Commands invoked by the script include:
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/name "'Display rotate normal'"

gsettings set org.cinnamon.desktop.keybindings custom-list "['__dummy__', 'custom0', 'custom1', 'custom2', 'custom3']"

# output:
error: Error spawning command line “dbus-launch --autolaunch=XXX --binary-syntax --close-stderr”: Child process exited with code 1

(process:108725): dconf-WARNING **: 15:35:32.574: failed to commit changes to dconf: Error spawning command line “dbus-launch --autolaunch=XXX --binary-syntax --close-stderr”: Child process exited with code 1  

이 스크립트는 sudo chroot fin_sq pathinsidenewroot/nameofscriptLinux Mint Cinnamon 릴리스 iso의 내용을 새 루트 디렉터리에서 실행하여 설치합니다.

mkdir iso to temp fin 
sudo mount $original_iso iso #  -o loop
sudo mount -t overlay -o lowerdir=iso,upperdir=to,workdir=temp overlay fin
mkdir iso_sq to_sq temp_sq fin_sq
sudo mount iso/casper/filesystem.squashfs iso_sq -t squashfs -o loop
sudo mount -t overlay -o lowerdir=iso_sq,upperdir=to_sq,workdir=temp_sq overlay fin_sq  

추가된 2:
"일반" 환경에서는 둘 다 동일한 값(1.0)을 dconf read /org/cinnamon/desktop/interface/text-scaling-factor표시 하지만 gsettings get org.cinnamon.desktop.interface text-scaling-factor거의 동시에 이 PC에서 chrooted에서는 gsettings get 1.0이 표시되지만 dconf read출력은 비어 있습니다. text-scaling-factor키를 변경하면 (일반적으로) gsettings getchrooted의 출력은 변경되지 않습니다( dconf read일반 출력은 새 키 값으로 변경됩니다).

답변1

먼저 dconf구성 설정을 변경합니다.특정 사용자X11 디스플레이가 실행 중입니다. 따라서 첫 번째 문제는 루트로 실행하고 있다는 것입니다. 자신의 사용자로 전환을 시도하더라도 chroot 환경에서는 자신의 사용자와 그룹이 chroot 환경에 존재하지 않기 /etc/{passwd,group}때문에 자신의 사용자에 대해 전혀 익숙하지 않아 사용자 전환도 할 수 없습니다. 전환할 수 있더라도(호스트에서 관련 파일을 바인딩한 후) chroot 환경에 홈 디렉터리가 없습니다. homedir을 chroot 환경에 바인딩하고 su사용자에 바인딩할 수 있더라도 chroot 환경에 X11 소켓이 없을 수 있으며 여전히 DBUS_SESSION_BUS_ADDRESS없습니다 su.

다음 질문에 대한 답변을 확인할 수 있습니다.루트로서 su를 사용하여 다른 사용자의 dconf를 변경할 수 있습니다. 실제로 적용하려면 어떻게 해야 합니까?찾기/설정/사용을 수행하는 방법에 대한 몇 가지 예를 확인하세요 DBUS_SESSION_BUS_ADDRESS.

따라서 루트로 이 작업을 수행하는 것은 매우 복잡하고 chroot 환경에서 수행하는 것은 훨씬 더 복잡하다는 것을 알 수 있습니다. 불가능하지는 않지만 어렵습니다. 시작하기 전에 모든 관련 파일/폴더를 chroot 폴더에 바인드 마운트해야 합니다. 그렇기 때문에 귀하의 사용 사례가 무엇인지 묻고, 이를 일종의 컨테이너로 사용하려고 하는지 묻는 것입니다(예를 들어 일부 컨테이너 도구는 singularity이미 다음과 같은 일부 작업을 수행하기 때문입니다). 관련 passwd/ 생성 group, 홈 디렉토리 설치 등).

다음 댓글에 대해:

같은 시간에 해당 PC의 chroot는 gsettings get1.0을 표시했지만 dconf read출력은 비어 있었습니다.

gsettings(실제로는 사용자의 구성 dconf백엔드를 찾거나 찾습니다. 구성이 거기에서 발견되지 않으면 에서 찾을 수 있습니다.gsettings$HOME/.config/dconf/user$XDG_CACHE_HOME/dconf/usergsettings/usr/share/glib-2.0/schemas/gschemas.compiled

에서 man glib-compile-schemas:

   glib-compile-schemas compiles all the GSettings XML schema files in
   DIRECTORY into a binary file with the name gschemas.compiled that can
   be used by GSettings. The XML schema files must have the filename
   extension .gschema.xml. For a detailed description of the XML file
   format, see the GSettings documentation.

   At runtime, GSettings looks for schemas in the glib-2.0/schemas
   subdirectories of all directories specified in the XDG_DATA_DIRS
   environment variable. The usual location to install schema files is
   /usr/share/glib-2.0/schemas.

관련 정보