<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title><![CDATA[Dobrica Pavlinušić's random unstructured stuff: systemd]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?systemd</link>
<description></description>
<pubDate>Wed, 22 Jan 2020 12:22:15 -0000</pubDate>
<webMaster>root@saturn.ffzg.hr</webMaster>
<generator>Socialtext Workspace v2.19.0.2</generator>

<item>
<title><![CDATA[systemd]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?systemd</link>
<description><![CDATA[<div>Creator: Dobrica Pavlinušić</div><hr/><div class="wiki">
<p>
running old distributions under systemd-nspawn</p>
<div class="nlw_phrase"><table class="wafl_container">
  <tr>
    <td>
      <div class="wafl_box">
        
          <div class="wafl_titlebox">
            <div class="wafl_title">
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            </div>
          </div>
          <div class="wafl_items">
            
              <div class="wiki">
<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#install_on_host">Dobrica Pavlinušić's random unstructured stuff (install on host)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] install on host} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#setup_old_distribution">Dobrica Pavlinušić's random unstructured stuff (setup old distribution)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] setup old distribution} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#os_release">Dobrica Pavlinušić's random unstructured stuff (os-release)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] os-=release} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#console">Dobrica Pavlinušić's random unstructured stuff (console)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] console} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#network_config">Dobrica Pavlinušić's random unstructured stuff (network config)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] network config} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#start_it">Dobrica Pavlinušić's random unstructured stuff (start it)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] start it} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#alternative">Dobrica Pavlinušić's random unstructured stuff (alternative)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] alternative} --></span></li>
</ul>
</div>

            
            
          </div>
        
      </div>
    </td>
  </tr>
</table>
<!-- wiki: {toc: }
--></div><br /><br /><h1 id="install_on_host">install on host</h1>
<pre>
apt install systemd-container
</pre>
<br /><h1 id="setup_old_distribution">setup old distribution</h1>
<h2 id="os_release">os-release</h2>
<pre>
root@saturn4:~# cat /saturn/etc/os-release
PRETTY_NAME=&quot;Debian GNU/Linux 4 (etch)&quot;
NAME=&quot;Debian GNU/Linux&quot;
VERSION_ID=&quot;4&quot;
VERSION=&quot;4 (etch)&quot;
VERSION_CODENAME=etch
ID=debian
HOME_URL=&quot;https://www.debian.org/&quot;
SUPPORT_URL=&quot;https://www.debian.org/support&quot;
BUG_REPORT_URL=&quot;https://bugs.debian.org/&quot;
</pre>
<br /><h2 id="console">console</h2>
<pre>
root@saturn4:/saturn/etc# machinectl shell saturn /usr/bin/uptime
Failed to get shell PTY: Protocol error
</pre>
<br /><p>
fix it by adding console to inittab</p>
<pre>
dpavlin@saturn:~$ grep console /etc/inittab
0:2345:respawn:/sbin/getty 38400 console
</pre>
<br /><h2 id="network_config">network config</h2>
<p>
full access to host network, services are configured to listen to localhost</p>
<pre>
root@saturn4:/etc/systemd# mkdir nspawn

root@saturn4:/etc/systemd# cat &gt; nspawn/saturn.nspawn
[Network]
VirtualEthernet=no
</pre>
<br /><h2 id="start_it">start it</h2>
<pre>
root@saturn4:~# mv /saturn/ /var/lib/machines/
root@saturn4:~# machinectl enable saturn
Created symlink /etc/systemd/system/machines.target.wants/systemd-nspawn@saturn.service �/lib/systemd/system/systemd-nspawn@.service.
root@saturn4:~# machinectl start saturn
</pre>
<br /><h1 id="alternative">alternative</h1>
<p>
it seems that I'm unable to get console to work with systemd-nspawn and Debian etch. So alternative approach is just to run services from systemd service file using chroot</p>
<pre>
root@saturn4:/etc/systemd/system# cat saturn\@.service
[Unit]
Description=SocialText saturn services

[Service]
User=root
Type=forking
ExecStart=/etc/systemd/system/saturn.sh /etc/init.d/%i start
ExecStop=/etc/systemd/system/saturn.sh /etc/init.d/%i stop
Restart=on-failure

[Install]
WantedBy=multi-user.target

root@saturn4:/etc/systemd/system# systemctl start saturn@postgresql-8.1
root@saturn4:/etc/systemd/system# systemctl start saturn@ceqlotron
root@saturn4:/etc/systemd/system# systemctl start saturn@st-apache
root@saturn4:/etc/systemd/system# systemctl start saturn@apache2


</pre>
</div>
]]></description>
<author>Dobrica Pavlinu&#x161;i&#x107;</author>
<category></category>
<guid isPermaLink="true">https://saturn.ffzg.hr/rot13/index.cgi?systemd</guid>
<pubDate>Wed, 22 Jan 2020 12:22:15 -0000</pubDate>
</item>
</channel>
</rss>