LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-10-2019, 03:48 PM   #1
PRNG
LQ Newbie
 
Registered: Jul 2016
Distribution: Slackware
Posts: 20

Rep: Reputation: Disabled
LXC 3.0 and Slackware


I saw "new" release of LXC https://discuss.linuxcontainers.org/...-released/1449
Is it possible to upgrade LXC from LTS branch to version 3 on Slackware current? The cgmanager is removed and I don't know if it is possible to use containers without systemd or cgmanager.
 
Old 01-11-2019, 11:18 AM   #2
alex14641
Member
 
Registered: Feb 2016
Distribution: Slackware64_14.1, Slackware64_14.2, Slackware64_current
Posts: 138

Rep: Reputation: Disabled
I've created unprivileged Ubuntu containers, with networking, with LXC 3 on -current. There's some system configuration necessary to make it work, though. I don't think LXC needs cgmanager. Strange thing: removing cgmanager breaks the power manager applet in XFCE.
 
Old 01-12-2019, 04:33 AM   #3
PRNG
LQ Newbie
 
Registered: Jul 2016
Distribution: Slackware
Posts: 20

Original Poster
Rep: Reputation: Disabled
Great! I will try LXC 3 ASAP.
If you can, write up what changes have you made in ored to make it work.
 
Old 01-13-2019, 06:51 PM   #4
alex14641
Member
 
Registered: Feb 2016
Distribution: Slackware64_14.1, Slackware64_14.2, Slackware64_current
Posts: 138

Rep: Reputation: Disabled
Setting up LXC 3.x to run unprivileged containers.

As you:
*) Download the source for lxc-3.0.3.tar.gz and lxcfs-3.0.3.tar.gz.
*) Untar lxc-3.0.3 and lxcfs-3.0.3
*) cd lxc-3.0.3
*) ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --localstatedir=/var --mandir=/usr/man --docdir=/usr/doc/lxc-3.0.3 --infodir=/usr/info --infodir=/usr/info --with-global-conf=/etc/lxc/lxc.conf --with-rootfs-path=/var/lib/rootfs-lxc
*) make -j8
*) cd ../lxcfs-3.0.3
*) ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --localstatedir=/var --mandir=/usr/man --docdir=/usr/doc/lxcfs-3.0.3 --infodir=/usr/info --with-rootfs-path=/var/lib/rootfs-lxc
*) make -j8
*) Create the file $HOME/.config/lxc/default.conf with the following contents:
Code:
lxc.idmap = u 0 131072 65536
lxc.idmap = g 0 131072 65536
lxc.mount.auto = cgroup
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.name = eth0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
lxc.environment = PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
lxc.environment = HOME=/root
lxc.environment = USER=root
As root:
*) removepkg lxc-2.0.9
*) cd lxc-3.0.3
*) make install
*) cd ../lxcfs-3.0.3
*) make install
*) Create the file /etc/subuid with the following contents:
Code:
root:65536:65536
<your uid>:131072:65536
Replace <your uid> with your user ID.
*) Create the file /etc/subgid with the following contents:
Code:
root:65536:65536
<your gid>:131072:65536
Replace <your gid> with your group ID.
*) cgcreate -g *:lxc -a <your uid>:<your gid> -t <your uid>:<your gid>
Replace <your uid> and <your gid> with your user ID and your group ID, respectively.
*) /usr/libexec/lxc/lxc-net start
*) lxcfs -s -o allow_other /var/lib/lxcfs/ &

As you:
*) cgexec -g *:lxc bash
*) Create a Debian container:
lxc-create -t download -n debian -- -d debian -r stretch -a amd64
*) Start the container:
lxc-start debian
*) Attach to the container:
lxc-attach debian
*) Start networking in the container:
/etc/rcS.d/S01networking start
You should now be able to run 'apt install' to install packages.

Last edited by alex14641; 01-13-2019 at 07:20 PM.
 
6 members found this post helpful.
Old 01-14-2019, 02:16 AM   #5
PRNG
LQ Newbie
 
Registered: Jul 2016
Distribution: Slackware
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thank you Alex!

I have fixed power manager applet in XFCE by recompiling ConsoleKit2 with
Code:
--enable-cgroups=no \
 
Old 01-14-2019, 05:08 AM   #6
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 249

Rep: Reputation: 132Reputation: 132
Quote:
Originally Posted by alex14641 View Post
*) cd ../lxcfs-3.0.3
I didn't test, but it seems lxcfs has become optional even for systemd based containers/guests. From https://linuxcontainers.org/lxcfs/introduction/:
Quote:
The main driver for this[lxcfs] work was the need to run systemd based containers as a regular unprivileged user while still allowing systemd inside the container to interact with cgroups.
Now with the introduction of the cgroup namespace in the Linux kernel, that part is no longer necessary on recent kernels and focus is now on making containers feel more like a real independent system through the proc masking feature.
 
Old 01-14-2019, 07:17 AM   #7
alex14641
Member
 
Registered: Feb 2016
Distribution: Slackware64_14.1, Slackware64_14.2, Slackware64_current
Posts: 138

Rep: Reputation: Disabled
Quote:
Originally Posted by franzen View Post
I didn't test, but it seems lxcfs has become optional even for systemd based containers/guests. From https://linuxcontainers.org/lxcfs/ introduction/:
Lxcfs is still needed for containers to have their own copies of /proc/uptime and some other /proc files. Without lxcfs, running the uptime command in the containers returns the uptime of the host.
 
Old 01-14-2019, 07:39 AM   #8
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 249

Rep: Reputation: 132Reputation: 132
Quote:
Originally Posted by alex14641 View Post
Lxcfs is still needed for containers to have their own copies of /proc/uptime and some other /proc files. Without lxcfs, running the uptime command in the containers returns the uptime of the host.
So it may be useful, but it's not a hard dependency.
 
Old 01-14-2019, 06:09 PM   #9
alex14641
Member
 
Registered: Feb 2016
Distribution: Slackware64_14.1, Slackware64_14.2, Slackware64_current
Posts: 138

Rep: Reputation: Disabled
Quote:
Originally Posted by franzen View Post
So it may be useful, but it's not a hard dependency.
Correct.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Slackware 14.2 lxc-slackware template missing libunistring mralk3 Slackware 5 09-13-2018 01:46 AM
[SOLVED] "lxc list" vs "lxc-ls" yknivag Linux - Virtualization and Cloud 1 03-09-2017 06:53 AM
[SOLVED] [LXC] Slackware 14.1 rc1 - Upgraded host & container Chuck56 Slackware 3 10-16-2013 06:58 AM
slackware lxc / iptables ccie15672 Linux - Virtualization and Cloud 0 02-26-2012 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration