I assume you are using LXD.
When you have a managed network, LXD arranges for the containers to get an ip address from a 10.x.x.x network.
If you ran sudo lxd init, then you are asked whether you want LXD to manage containers for the networking. Did you enable those?
I made so many trials and had so many errors I decided to re install my system and here’s where I am at
OS - PureOS - based on debian buster/sid
bear in mind PureOS does not have all the debian source lists because it is totally FOSS
This time I installed lxd rather than lxc and installed it via snap
here’s what’s on my screen:
sherab@Sherab-PureOS:~$ snap list
Name Version Rev Tracking Publisher Notes
core 16-2.38 6673 stable canonical✓ core
lxd 3.12 10601 stable canonical✓ -
sherab@Sherab-PureOS:~$ sudo lxd init
sudo: lxd: command not found
sherab@Sherab-PureOS:~$ cd /snap/
sherab@Sherab-PureOS:/snap$ ls
bin core lxd README
sherab@Sherab-PureOS:/snap$ less README
sherab@Sherab-PureOS:/snap$ cd lxd/
sherab@Sherab-PureOS:/snap/lxd$ ls
10601 current
sherab@Sherab-PureOS:/snap/lxd$
on Ubuntu this is done by adding a file under /etc/profile.d containing:
# shellcheck shell=sh
# Expand $PATH to include the directory where snappy applications go.
snap_bin_path="/snap/bin"
if [ -n "${PATH##*${snap_bin_path}}" -a -n "${PATH##*${snap_bin_path}:*}" ]; then
export PATH=$PATH:${snap_bin_path}
fi
# Ensure base distro defaults xdg path are set if nothing filed up some
# defaults yet.
if [ -z "$XDG_DATA_DIRS" ]; then
export XDG_DATA_DIRS="/usr/local/share:/usr/share"
fi
# Desktop files (used by desktop environments within both X11 and Wayland) are
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for
# snappy applications' desktop files.
snap_xdg_path="/var/lib/snapd/desktop"
if [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}}" -a -n "${XDG_DATA_DIRS##*${snap_xdg_path}:*}" ]; then
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${snap_xdg_path}"
fi
if this directory don’t exist in your distro, you can add these lines to .bashrc indeed.
should have modified your path, unless you did not logout/login
Unless your distro don’t use /etc/profile.d. It should use /etc/profile though, I think it’s in the official LSB spec.
Is there something like
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
in your /etc/profile file ? Looking at the Linux Standard Base; the /etc/profile.d is NOT in it, so maybe snap install is creating blindly a app-bin-path.sh expecting it to be picked by /etc/profile, while in your distro the /etc/profile file don’t refer to the profile.d directory. Hope I am clear
Edit: I did look into an old LSB spec, in the last one, profile.d is specified and should be taken in account.
I am not sure what you are saying but /etc/profile
Here is the content of /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr
/games"
export PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
You’d have noticed it is slightly different than the one you posted in as much as it contains the following line at the top
you really should have this /snap/bin in your path :-/
In your place I’d try to copy /etc/profile in your home directory, then in this same directory edit this file to add
echo $PATH
before and after the
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
part, then save and run it with
. ./profile
what is displayed then ?