{"id":3238,"date":"2026-05-17T12:00:29","date_gmt":"2026-05-17T03:00:29","guid":{"rendered":"https:\/\/www.next-hop.net\/blog\/hiraga\/?p=3238"},"modified":"2026-05-20T10:47:09","modified_gmt":"2026-05-20T01:47:09","slug":"linux-emulator","status":"publish","type":"post","link":"https:\/\/www.next-hop.net\/blog\/hiraga\/freebsd\/linux-emulator\/","title":{"rendered":"Linux Emulator\u3092\u52d5\u304b\u3059"},"content":{"rendered":"<p>\u4eca\u66f4\u306a\u304c\u3089\u6539\u3081\u3066Linux Emulator\u306b\u6ce8\u76ee\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<h2>\u524d\u63d0<\/h2>\n<ul>\n<li>FreeBSD 15 amd64<\/li>\n<li>RockyLinux 9.7(RHEL 9.7\u4e92\u63db)<\/li>\n<\/ul>\n<h2>\u57fa\u672c\u8a2d\u5b9a<\/h2>\n<h4>roles\/freebsd\/tasks\/linux_emulation.yaml<\/h4>\n<h3>\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u30de\u30a6\u30f3\u30c8<\/h3>\n<pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\r\n---\r\n- name: Add Linux procfs\r\n  lineinfile:\r\n    path: \/etc\/fstab\r\n    regexp: &#039;^linproc&#039;\r\n    line: linproc               \/compat\/linux\/proc      linprocfs       rw      0       0\r\n\r\n- name: Add Linux sysfs\r\n  lineinfile:\r\n    path: \/etc\/fstab\r\n    regexp: &#039;^linsysfs&#039;\r\n    line: linsysfs      \/compat\/linux\/sys       linsysfs        rw      0       0\r\n\r\n- name: Add Linux devfs\r\n  lineinfile:\r\n    path: \/etc\/fstab\r\n    regexp: &#039;^devfs&#039;\r\n    line: devfs         \/compat\/linux\/dev       devfs   rw      0       0\r\n\r\n- name: Add Linux fdescfs\r\n  lineinfile:\r\n    path: \/etc\/fstab\r\n    regexp: &#039;^fdescfs&#039;\r\n    line: fdescfs               \/compat\/linux\/dev\/fd    fdescfs rw,linrdlnk     0       0\r\n\r\n- name: Add Linux tmpfs\r\n  lineinfile:\r\n    path: \/etc\/fstab\r\n    regexp: &#039;^tmpfs&#039;\r\n    line: tmpfs         \/compat\/linux\/dev\/shm   tmpfs   rw,mode=1777    0       0\r\n<\/pre>\n<h3>Linux Emulator\u306e\u6709\u52b9\u5316<\/h3>\n<pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\r\n- name: Enable Linux emulation\r\n  community.general.sysrc:\r\n    name: linux_enable\r\n    value: &quot;YES&quot;\r\n\r\n- name: Enable Linux filesystem mount\r\n  community.general.sysrc:\r\n    name: linux_mounts_enable\r\n    value: &quot;YES&quot;\r\n\r\n- name: Activate Linux emulation\r\n  service:\r\n    name: linux\r\n    state: started\r\n  changed_when: false\r\n<\/pre>\n<h3>RockyLinux9\u30d9\u30fc\u30b9\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\r\n- name: Ensure linux base binary installed\r\n  community.general.pkgng:\r\n    name: linux_base-rl9\r\n    state: present\r\n<\/pre>\n<h3>\u8af8\u8a2d\u5b9a<\/h3>\n<h4>roles\/freebsd\/tasks\/linux_emulation_etc.yaml<\/h4>\n<pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\r\n---\r\n- name: Ensure \/tmp directory exists\r\n  file:\r\n    path: \/compat\/linux\/tmp\r\n    mode: &quot;1777&quot;\r\n    state: directory\r\n\r\n- name: Ensure \/etc directory exists\r\n  file:\r\n    path: \/compat\/linux\/etc\r\n    state: directory\r\n\r\n- name: Deploy \/etc\/passwd\r\n  copy:\r\n    dest: \/compat\/linux\/etc\/passwd\r\n    mode: &quot;0644&quot;\r\n    content: |\r\n      root:x:0:0:root:\/root:\/bin\/bash\r\n      bin:x:1:1:bin:\/bin:\/sbin\/nologin\r\n      daemon:x:2:2:daemon:\/sbin:\/sbin\/nologin\r\n      adm:x:3:4:adm:\/var\/adm:\/sbin\/nologin\r\n      lp:x:4:7:lp:\/var\/spool\/lpd:\/sbin\/nologin\r\n      sync:x:5:0:sync:\/sbin:\/bin\/sync\r\n      shutdown:x:6:0:shutdown:\/sbin:\/sbin\/shutdown\r\n      halt:x:7:0:halt:\/sbin:\/sbin\/halt\r\n      mail:x:8:12:mail:\/var\/spool\/mail:\/sbin\/nologin\r\n      operator:x:11:0:operator:\/root:\/sbin\/nologin\r\n      games:x:12:100:games:\/usr\/games:\/sbin\/nologin\r\n      ftp:x:14:50:FTP User:\/var\/ftp:\/sbin\/nologin\r\n      nobody:x:65534:65534:Kernel Overflow User:\/:\/sbin\/nologin\r\n      tss:x:59:59:Account used for TPM access:\/:\/usr\/sbin\/nologin\r\n\r\n# generated by pwconv\r\n- name: Deploy \/etc\/shadow\r\n  copy:\r\n    dest: \/compat\/linux\/etc\/shadow\r\n    mode: &quot;0600&quot;\r\n    content: |\r\n      root:!locked::0:99999:7:::\r\n      bin:*:19469:0:99999:7:::\r\n      daemon:*:19469:0:99999:7:::\r\n      adm:*:19469:0:99999:7:::\r\n      lp:*:19469:0:99999:7:::\r\n      sync:*:19469:0:99999:7:::\r\n      shutdown:*:19469:0:99999:7:::\r\n      halt:*:19469:0:99999:7:::\r\n      mail:*:19469:0:99999:7:::\r\n      operator:*:19469:0:99999:7:::\r\n      games:*:19469:0:99999:7:::\r\n      ftp:*:19469:0:99999:7:::\r\n      nobody:*:19469:0:99999:7:::\r\n      tss:!!:19680::::::\r\n\r\n- name: Deploy \/etc\/group\r\n  copy:\r\n    dest: \/compat\/linux\/etc\/group\r\n    mode: &quot;0644&quot;\r\n    content: |\r\n      root:x:0:\r\n      bin:x:1:\r\n      daemon:x:2:\r\n      sys:x:3:\r\n      adm:x:4:\r\n      tty:x:5:\r\n      disk:x:6:\r\n      lp:x:7:\r\n      mem:x:8:\r\n      kmem:x:9:\r\n      wheel:x:10:\r\n      cdrom:x:11:\r\n      mail:x:12:\r\n      man:x:15:\r\n      dialout:x:18:\r\n      floppy:x:19:\r\n      games:x:20:\r\n      tape:x:33:\r\n      video:x:39:\r\n      ftp:x:50:\r\n      lock:x:54:\r\n      audio:x:63:\r\n      users:x:100:\r\n      nobody:x:65534:\r\n      utmp:x:22:\r\n      utempter:x:35:\r\n      tss:x:59:\r\n\r\n# generated by grpconv\r\n- name: Deploy \/etc\/gshadow\r\n  copy:\r\n    dest: \/compat\/linux\/etc\/gshadow\r\n    mode: &quot;0600&quot;\r\n    content: |\r\n      root:::\r\n      bin:::\r\n      daemon:::\r\n      sys:::\r\n      adm:::\r\n      tty:::\r\n      disk:::\r\n      lp:::\r\n      mem:::\r\n      kmem:::\r\n      wheel:::\r\n      cdrom:::\r\n      mail:::\r\n      man:::\r\n      dialout:::\r\n      floppy:::\r\n      games:::\r\n      tape:::\r\n      video:::\r\n      ftp:::\r\n      lock:::\r\n      audio:::\r\n      users:::\r\n      nobody:::\r\n      utmp:!::\r\n      utempter:!::\r\n      tss:!::\r\n\r\n- name: Deploy \/etc\/resolv.conf\r\n  copy:\r\n    dest: \/compat\/linux\/etc\/resolv.conf\r\n    mode: &quot;0644&quot;\r\n    content: |\r\n      search {{ dns.domain | default(&#x5B;]) | join(&#039; &#039;) }}\r\n      {% for server in dns.nameserver %}\r\n      nameserver {{ server }}\r\n      {% endfor %}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u66f4\u306a\u304c\u3089\u6539\u3081\u3066Linux Emulator\u306b\u6ce8\u76ee\u3057\u3066\u307f\u307e\u3059\u3002 \u524d\u63d0 FreeBSD 15 amd64 RockyLinux 9.7(RHEL 9.7\u4e92\u63db) \u57fa\u672c\u8a2d\u5b9a roles\/freebsd\/tasks\/linux_\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.next-hop.net\/blog\/hiraga\/freebsd\/linux-emulator\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3238","post","type-post","status-publish","format-standard","hentry","category-freebsd"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/posts\/3238"}],"collection":[{"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/comments?post=3238"}],"version-history":[{"count":8,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/posts\/3238\/revisions"}],"predecessor-version":[{"id":3331,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/posts\/3238\/revisions\/3331"}],"wp:attachment":[{"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/media?parent=3238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/categories?post=3238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.next-hop.net\/blog\/hiraga\/wp-json\/wp\/v2\/tags?post=3238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}