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 10-21-2018, 04:47 AM   #1
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Rep: Reputation: 101Reputation: 101
Slackpkg inside lxc container


Hello,

I am running Slackware64-14.2 host and using Slackware64-14.2 LXC containers on it. I am having an interesting problem which is hard for me to troubleshoot.

Basically, if I want to install software inside container by using slackpkg, the ncurses dialog window usually (not always) does not respond to keyboard. I can only kill it with CTRL+C.

There is absolutely no 3rd party software packages neither on host or containers. I am using en_US.UTF-8 locale everywhere and I cannot seem to spot any real correlation in case when or how it works or not work.

It does not matter if I run command from host:
# lxc-attach -n container slackpkg install samba

Or from containers shell:
# lxc-attach -n container
# slackpkg install samba

If I close my terminal application and open several times, then it starts to work properly for a while. Or so it seems.

Containers are being created most standard way:
MIRROR=http://mirrors.atviras.lt/slackware release=14.2 lxc-create -n containername -t slackware

Just wondering which end to explore. Can it be something wrong with my bash environment on client? Or Server? Or Container?

But my .bashrc is pretty basic:
Code:
export PS1="[\[\033[1;34m\w\033[0m]\n[\h \u]$ "
export HISTSIZE="" # Unlimited history
export HISTFILESIZE="" # Unlimited history
export HISTCONTROL=ignoredups #don't put duplicate lines in the history.
Maybe some missing package on the container? But it looks like I have only one dependency unmet, which is gd.so for memusagestat
Code:
# ./missing-deps /usr/bin/
The following file in /usr/bin/ depend on a lib and will need to be rebuilt:
-------
memusagestat
	libgd.so.3 => not found
I've checked /bin /lib64 /sbin /usr/bin /usr/lib64 /usr/sbin/

Maybe someone else have encountered a similar problem? Or could offer some clue please?

P.S.
For time being I am using slackpkg in batch mode, for some cases it's great functionality, but can be dangerous:
Code:
slackpkg -batch=on -default_answer=y install samba

Last edited by Totoro-kun; 10-21-2018 at 04:52 AM.
 
Old 10-21-2018, 04:56 AM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,696

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
I also had trouble with slackpkg in a container, not exactly as you describe them though. In my case I could avoid those by using 'lxc-console' to attach to the container. If I use 'lxc-attach' I do not get a proper environment, e.g., $HOME is not set and thus a simple 'cd' leads nowhere instead of switching to my home folder. I also think that '.bashrc' will not get sourced but I am not sure about it. Since I solved it with 'lxc-console' I did not investigate any further. Try it and let me know if the problems persist.

Last edited by crts; 10-21-2018 at 04:57 AM.
 
2 members found this post helpful.
Old 10-21-2018, 05:02 AM   #3
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Original Poster
Rep: Reputation: 101Reputation: 101
Thank you!

lxc-console approach, does work consistently. But is a bit less convenient than lxc-attach. So there must be something with the way lxc-attach handles profile then.
 
Old 10-21-2018, 05:11 AM   #4
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,696

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
It *might* be enough if you just source your '.bashrc' manually, i.e.,
Code:
# source /root/.bashrc
I have not tried it myself since I do not mind the extra step of logging in via 'lxc-console'.

Last edited by crts; 10-24-2018 at 06:32 PM. Reason: typo
 
Old 10-21-2018, 05:30 AM   #5
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Original Poster
Rep: Reputation: 101Reputation: 101
Just tried to use lxc-attach and source /etc/profile by doing . /etc/profile and same thing with .bash_profile and .bashrc, but neither step helped. Slackpkg dialog is still unresponsive.
 
Old 10-21-2018, 05:38 AM   #6
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,696

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
If it is a mere convenience issue you can also login with 'ssh', in my case this works, too. You will have, however, to configure 'ssh' to login with public/private key authentication once, if you want to avoid typing a password in the future.
 
Old 10-21-2018, 10:38 AM   #7
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Original Poster
Rep: Reputation: 101Reputation: 101
Yes, access via ssh would be slightly more convenient than typing passwords each time indeed. And I do run ssh on some containers already (for file sharing purposes mainly). However, it is still much easier to manage numerous containers by using lxc-attach than by adding containers to already lengthy ssh config.

Either way it is still very helpful to know that slackpkg can be used normally via lxc-console or ssh session. It is now possible to investigate further.
 
Old 10-21-2018, 10:42 AM   #8
mralk3
Senior Member
 
Registered: May 2015
Location: Utah, USA
Distribution: Slackware 14.2 || Slackware-current && CentOS
Posts: 1,372

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
The issue has something to do with the environment settings (env). I tried to get it working with something like:

Code:
lxc-attach --keep-env -n container
This fixes the garbled text but the dialog window launched by slackpkg appears to be unresponsive. I am interested in a solution as well. A web search did not yield anything useful, at least for me. It might be more effective to look at what changes other distributions have made to get lxc-attach working with a dialog/ncurses interface.
 
Old 10-21-2018, 10:49 AM   #9
mralk3
Senior Member
 
Registered: May 2015
Location: Utah, USA
Distribution: Slackware 14.2 || Slackware-current && CentOS
Posts: 1,372

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
For the time being, I set DIALOG=off in /etc/slackpkg/slackpkg.conf. This provides a text interface to slackpkg.
 
2 members found this post helpful.
Old 10-21-2018, 11:02 AM   #10
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Original Poster
Rep: Reputation: 101Reputation: 101
Thanks!

Setting DIALOG=off in /etc/slackpkg/slackpkg.conf is actually quite cool workaround! In my case, it seems to serve even nicer than dialog.

Just tried lxc-attach --keep-env thing, but it does not seem to help. So possibly other ncurses/dialog applications could still have issue.

Last edited by Totoro-kun; 10-21-2018 at 12:58 PM.
 
Old 10-21-2018, 11:09 AM   #11
mralk3
Senior Member
 
Registered: May 2015
Location: Utah, USA
Distribution: Slackware 14.2 || Slackware-current && CentOS
Posts: 1,372

Rep: Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736Reputation: 736
Quote:
Originally Posted by Totoro-kun View Post
Thanks!

Setting DIALOG=off in /etc/slackpkg/slackpkg.conf is actually quite cool workaround! In my case, it seems even nicer than dialog.
DEFAULT_ANSWER=y
BATCH=on

Could also be useful depending on what your container is for. The only downside with DIALOG=off is that if you do something like:

Code:
slackpkg reinstall python
You get every package with the word "python" in the results. It doesn't look like regex is viable with slackpkg, so you will likely want to do a:

Code:
slackpkg search python

..package list..

slackpkg reinstall python-2.7.15
The nice part of the dialog window is you can select/deselect packages. Hopefully your use case doesn't need this feature.

Last edited by mralk3; 10-21-2018 at 11:11 AM.
 
Old 10-21-2018, 12:08 PM   #12
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,696

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
Just a heads-up about --keep-env from the manpage:
Code:
       --keep-env
              Keep the current environment for attached programs. This is  the
              current  default behaviour (as of version 0.9), but is is likely
              to change in the future, since this may leak undesirable  infor‐
              mation  into the container. If you rely on the environment being
              available for the attached program, please use this option to be
              future-proof. In addition to current environment variables, con‐
              tainer=lxc will be set.
 
1 members found this post helpful.
Old 06-05-2019, 02:19 AM   #13
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,696

Rep: Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518Reputation: 518
I do not know if this is still an issue for you OP but I recently found a possible solution. After attaching with 'lxc-attach' just run
Code:
# sudo -i
This will log you in as root again but this time with a "proper" environment. I also tried
Code:
# su -
but that did not work. Let me know if this fixes the issue for you, OP.
 
1 members found this post helpful.
Old 06-09-2019, 01:40 PM   #14
Totoro-kun
Member
 
Registered: Nov 2010
Location: Kaunas, Lithuania
Distribution: Slackware
Posts: 219

Original Poster
Rep: Reputation: 101Reputation: 101
Hi,

It's less of an issue now, that I've switched to using slackpkg without dialog interface. It's more convenient to semi-automate this process by the use of scrips

Anyhow, thank you for suggestions. I did try sudo -i method, but it did not had any effect unfortunately.
 
Old 06-10-2019, 02:15 AM   #15
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 567

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Quote:
Originally Posted by Totoro-kun View Post
Hi,

It's less of an issue now, that I've switched to using slackpkg without dialog interface. It's more convenient to semi-automate this process by the use of scrips

Anyhow, thank you for suggestions. I did try sudo -i method, but it did not had any effect unfortunately.
To spot the difference, lxc-attach to your container and (before doing anything else) run the command 'env'; note the details. Now do the 'sudo -i' thing and run 'env' again. Spot the difference? I'll bet there's enough there now to run slackpkg with the dialog interface - it works for me.

Thanks crts for that trick (I mean technique). Previously I used to source a handmade script to set up a sufficient environment but the 'sudo -i' technique is much better.

chris
 
1 members found this post helpful.
  


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] Install additional software inside lxc container crts Linux - Containers 1 10-22-2017 07:44 AM
[SOLVED] DNAT Inside a LXC Container not working Tonio- Linux - Server 3 07-10-2017 11:58 AM
How to check for mounted filesystems inside a lxc container cianfa72 Linux - Containers 11 05-31-2017 03:21 AM
[SOLVED] Outputting X display from inside an LXC Container charlie101 Linux - Virtualization and Cloud 1 02-04-2013 09:41 PM

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

All times are GMT -5. The time now is 12:26 PM.

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