<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
  <title xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić's random unstructured stuff: systemd</title>
  <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/</id>
  <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?systemd"/>
  <link xmlns="http://www.w3.org/2005/Atom" type="application/atom+xml" rel="self" href="https://saturn.ffzg.hr%2C%20saturn.ffzg.hr:443/feed/workspace/rot13?page=systemd;type=Atom"/>
  <updated xmlns="http://www.w3.org/2005/Atom">2020-01-22T12:22:15Z</updated>
  <entry xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml">
    <title xmlns="http://www.w3.org/2005/Atom">systemd</title>
    <link xmlns="http://www.w3.org/2005/Atom" type="text/html" rel="alternate" href="https://saturn.ffzg.hr/rot13/index.cgi?systemd"/>
    <content xmlns="http://www.w3.org/2005/Atom" xmlns:default="http://www.w3.org/1999/xhtml" type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml"><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="Debian GNU/Linux 4 (etch)"
NAME="Debian GNU/Linux"
VERSION_ID="4"
VERSION="4 (etch)"
VERSION_CODENAME=etch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
</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>
</div>
    </content>
    <id xmlns="http://www.w3.org/2005/Atom">https://saturn.ffzg.hr/rot13/index.cgi?systemd</id>
    <author xmlns="http://www.w3.org/2005/Atom">
      <name xmlns="http://www.w3.org/2005/Atom">Dobrica Pavlinušić</name>
    </author>
    <updated xmlns="http://www.w3.org/2005/Atom">2020-01-22T12:22:15Z</updated>
  </entry>
</feed>
