Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2021-02-20 Thread aitor

Hi,

On 20/2/21 22:28, Lorenz wrote:


And Lorenzo Puliti, maybe?

That would be me


:)

As far as I know, there is no runit-Debian specific list; however, if 
you are interested in runit and similar tools, there is the 
Supervision mailing list.

https://skarnet.org/lists.html 
It's not specific about Debian/Devuan, and much of the talk is about 
s6 nowadays, but many topics are still relevant for runit.


Thanks a lot for the link, i'll be there. Skarnet, yes... I talked with 
him in Amsterdam.


Cheers,

Aitor.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2021-02-20 Thread Lorenz via Dng
Il giorno mer 10 feb 2021 alle ore 23:25 aitor  ha
scritto:

>
>
> Il giorno dom 3 gen 2021 alle ore 10:41 aitor  ha
> scritto:
>
>> I don't know. But, as far as i know, this question arises from the
>> developers of runit.
>>
>
> Side question: where/who are the developers of runit?
>
> The original author of runit seems to be Gerrit Pape:
>
> http://smarden.org/runit/
> but other people like Dmitry Bogatov or Britney might be involved somehow
> in the project, at least as debian package mantainers.
>

Sadly Dmitry is no longer active as packager in Debian, he left after the
last GR :(

>
> And Lorenzo Puliti, maybe?
>

That would be me

> I'm planning extensive development for the next cycle (Debian/Bookworm) so
> we probably should coordinate at least to make sure that we don't step on
> each other foot
>
> Regards,
> Lorenzo
>
> Quoting Svante Signell:
>
>
>
>
> *> I'm trying to solve the problem of detecting if you are within a
> container, like > docker or LXC when running the eudev init script. If true
> udevd should not be > cstarted. The current version of eudev (3.2.9-4) has
> a buggy check for > containers, and people running runit as init have
> problems, see #392.*
>
> Maybe i misunderstood him and made up my mind that developers of runit
> were beyond this issue, while Svante was clearly referring to the users.
> Whatever the case, i also would like to know about a possible mailing list
> and we would meet each other there for sure :)
>

As far as I know, there is no runit-Debian specific list; however, if you
are interested in runit and similar tools, there is the Supervision mailing
list.
https://skarnet.org/lists.html
It's not specific about Debian/Devuan, and much of the talk is about s6
nowadays, but many topics are still relevant for runit.

> Cheers,
>
> Aitor.
>
Cheers,
Lorenzo
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2021-02-10 Thread aitor

Hi Lorentz,

On 9/2/21 13:48, Lorenz wrote:
Few months ago I sent a patch for needrestart, and there is a function 
(line 66) there to detect if it's running in a container; i'm not sure 
that is something that was not already mentioned and discarded here, 
but maybe it's worth checking.


I see..., it's written in perl and verifies the existence of 
/proc/1/environ:


if (-r "/proc/1/environ") {
    # check if we are inside of a container (fallback)
    local $/;
    open(HENV, '<', '/proc/1/environ');
    $is_container = scalar(grep {/^container=/;} unpack("(Z*)*", ));
    close(HENV)
}

In fact, there are several methods for detecting whether or not we are 
within a container depending on the type of the container (for instance, 
docker creates a |.dockerenv|||file in the root directory of the hosted 
system),
and some of the scripts available on the web evaluate each possibility 
separately for increased robustness. I think that VM are where things 
get more complicated. I have some vague ideas for that,
being one of them related to the ram memory, but i still didn't spend 
time on that.


Il giorno dom 3 gen 2021 alle ore 10:41 aitor > ha scritto:


I don't know. But, as far as i know, this question arises from the
developers of runit.


Side question: where/who are the developers of runit?


The original author of runit seems to be Gerrit Pape:

http://smarden.org/runit/ 

but other people like Dmitry Bogatov or Britney might be involved 
somehow in the project, at least as debian package mantainers.

And Lorenzo Puliti, maybe?
I'm planning extensive development for the next cycle 
(Debian/Bookworm) so we probably should coordinate at least to make 
sure that we don't step on each other foot


Regards,
Lorenzo


Quoting Svante Signell:

/> I'm trying to solve the problem of detecting if you are within a 
container, like
> docker or LXC when running the eudev init script. If true udevd 
should not be

> cstarted. The current version of eudev (3.2.9-4) has a buggy check for
> containers, and people running runit as init have problems, see #392./


Maybe i misunderstood him and made up my mind that developers of runit 
were beyond this issue, while Svante was clearly referring to the users.
Whatever the case, i also would like to know about a possible mailing 
list and we would meet each other there for sure :)


Cheers,

Aitor.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2021-02-10 Thread Lorenz via Dng
Few months ago I sent a patch for needrestart, and there is a function
(line 66) there to detect if it's running in a container; i'm not sure that
is something that was not already mentioned and discarded here, but maybe
it's worth checking.


Il giorno dom 3 gen 2021 alle ore 10:41 aitor  ha
scritto:

> I don't know. But, as far as i know, this question arises from the
> developers of runit.
>

Side question: where/who are the developers of runit?
I'm planning extensive development for the next cycle (Debian/Bookworm) so
we probably should coordinate at least to make sure that we don't step on
each other foot

Regards,
Lorenzo
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2021-01-03 Thread aitor

Hi Daniel,

On 1/4/20 9:07, Daniel Abrecht via Dng wrote:

Hi,

What's the point of trying to detect if eudev is run in a container?
Is it just to not start it in that case?
Would it just fail to start in them otherwise?
Is that actually a problem?
And could eudev not just be uninstalled in a container?


I don't know. But, as far as i know, this question arises from the 
developers of runit.



In any case, I don't like the idea of doing hacks like looking at 
inode numbers or trying to determine if there is a container or not. 
In addition to this don't like the Idea of checking for being in a 
container in general.


Instead, I would check for reasons why it doesn't work in a container, 
choose a sensible thing to check for out of those reasons, and then 
check for that.


In this case, I would assume the following, although I haven't checked:
 1) the container hypervisor (lxc/lxc, docker, libvirt-lxc, etc.) is 
responsible for managing/creating device files
 2) eudev exists for managing/creating device files in other kinds of 
systems

 3) device files can't be created in a container
 4) 3. is due to the container hypervisor removing the cap_mknod 
capability from containers


Given those assumptions, I think the sensible thing would be to either 
check for the mknod capability, or check if device nodes can't be 
created in /dev/ due to a lack of permissions. I think that's closer 
to the reason why one may not want to start eudev than trying to 
checking if we're in a container


Eudev already has a function regarding these funcionalities:

[...]

    if (getpid() == 1) {
    /* If we are PID 1 we can just check our own
 * environment variable */

    e = getenv("container");
    if (isempty(e)) {
    r = 0;
    goto finish;
    }
    } else {

    /* Otherwise, PID 1 dropped this information into a
 * file in UDEV_ROOT_RUN. This is better than accessing
 * /proc/1/environ, since we don't need CAP_SYS_PTRACE
 * for that. */

                 ** THIS PART DEPENDS SOMEHOW ON SYSTEMD ** <\cut>

    }

    /* We only recognize a selected few here, since we want to
 * enforce a redacted namespace */
    if (streq(e, "lxc"))
    _id ="lxc";
    else if (streq(e, "lxc-libvirt"))
    _id = "lxc-libvirt";
    else if (streq(e, "systemd-nspawn"))
    _id = "systemd-nspawn";
    else if (streq(e, "docker"))
    _id = "docker";
    else
    _id = "other";

[...]

Have a look at the code of:

int detect_container(const char **id) { ... }

in the file "virt.c":

https://github.com/gentoo/eudev/blob/master/src/shared/virt.c 



Cheers,

Aitor.









___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-04-01 Thread Daniel Abrecht via Dng

Hi,

What's the point of trying to detect if eudev is run in a container?
Is it just to not start it in that case?
Would it just fail to start in them otherwise?
Is that actually a problem?
And could eudev not just be uninstalled in a container?

In any case, I don't like the idea of doing hacks like looking at inode 
numbers or trying to determine if there is a container or not. In 
addition to this don't like the Idea of checking for being in a 
container in general.


Instead, I would check for reasons why it doesn't work in a container, 
choose a sensible thing to check for out of those reasons, and then 
check for that.


In this case, I would assume the following, although I haven't checked:
 1) the container hypervisor (lxc/lxc, docker, libvirt-lxc, etc.) is 
responsible for managing/creating device files
 2) eudev exists for managing/creating device files in other kinds of 
systems

 3) device files can't be created in a container
 4) 3. is due to the container hypervisor removing the cap_mknod 
capability from containers


Given those assumptions, I think the sensible thing would be to either 
check for the mknod capability, or check if device nodes can't be 
created in /dev/ due to a lack of permissions. I think that's closer to 
the reason why one may not want to start eudev than trying to checking 
if we're in a container.


Regards,
Daniel Abrecht
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-31 Thread Hendrik Boom
On Wed, Apr 01, 2020 at 09:42:56AM +1100, Ralph Ronnquist via Dng wrote:
> Note that the inode number is per file system. If you make a file as an ext4
> image, then its root will have inode=2 as well. You can verify that by 
> mounting
> the file somewhere and then stat that somewhere; or even chroot into that file
> system (if set up), and use "stat /".

Right.  Once when I used inodes to check file identity I also checked what 
file system the file was on.

That ws in a C inplementation where the parser identified include files that 
had the usual #ifdef's to block multiple inclusion, and then proceeded to skip 
them without bothering with the usual search for corrsponding #endif's.  
Having already seen the file, it didn't need to look at it again.

I know I must have forgetten some of the context, but in this specific system 
it caused a significant speedup.  Which seems implausible not that I'm 
reminiscing.

-- hendrik

> 
> Ralph.
> 
> aitor_czr wrote on 2020-03-31 02:18:
> > Hi Svante,
> > 
> > On 19/2/20 15:17, Svante Signell via Dng wrote:
> >> Hello,
> >>
> >> No replies so far from the devuan-dev list. Maybe with a larger audience I 
> >> can
> >> get some help!
> >>
> >> Thanks!
> > Checking  whether the *inode* number of the primary directory in the 
> > standard filesystem hierarchy
> > used in the most unix-like sytems(that is, the root "/" directory) is 
> > *equal* to 2 will help to differentiate
> > if you are within a container or not. eg you can do:
> > 
> > $ ls --inode --directory "/"
> > 
> > 2 /
> > 
> > While in a container the output of this command will return a high inode 
> > number. I tested it in three
> > different scenarios:
> > 
> > a) Using docker bash shell of ubuntu:
> > 
> > # docker run -it ubuntu bash
> > 
> > root@b87da5b70a84:/# ls --inode --directory "/"
> > 
> > 2492863 /
> > 
> > b) Using a qemu qcow2 image of devuan:
> > 
> > $ ls --inode --directory "/"
> > 
> > 9531 /
> > 
> > c) Inside the chroot jail of the live-sdk:
> > 
> > root@devuan:/# ls --inode --directory "/"
> > 
> > 22839335 /
> > 
> > I reckon this approach won't work neither in the case of operating 
> > systems using random inode numbers
> > (but this is not our case),nor in the case of chroot jails rooted on a 
> > mount point, in which case we have
> > the following workaround(at least in debian-based systems):
> > 
> > https://manpages.debian.org/jessie/debianutils/ischroot.1.en.html
> > 
> > Hope this helps,
> > 
> > Aitor.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ___
> > Dng mailing list
> > Dng@lists.dyne.org
> > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
> > 
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-31 Thread Ralph Ronnquist via Dng
Note that the inode number is per file system. If you make a file as an ext4
image, then its root will have inode=2 as well. You can verify that by mounting
the file somewhere and then stat that somewhere; or even chroot into that file
system (if set up), and use "stat /".

Ralph.

aitor_czr wrote on 2020-03-31 02:18:
> Hi Svante,
> 
> On 19/2/20 15:17, Svante Signell via Dng wrote:
>> Hello,
>>
>> No replies so far from the devuan-dev list. Maybe with a larger audience I 
>> can
>> get some help!
>>
>> Thanks!
> Checking  whether the *inode* number of the primary directory in the 
> standard filesystem hierarchy
> used in the most unix-like sytems(that is, the root "/" directory) is 
> *equal* to 2 will help to differentiate
> if you are within a container or not. eg you can do:
> 
> $ ls --inode --directory "/"
> 
> 2 /
> 
> While in a container the output of this command will return a high inode 
> number. I tested it in three
> different scenarios:
> 
> a) Using docker bash shell of ubuntu:
> 
> # docker run -it ubuntu bash
> 
> root@b87da5b70a84:/# ls --inode --directory "/"
> 
> 2492863 /
> 
> b) Using a qemu qcow2 image of devuan:
> 
> $ ls --inode --directory "/"
> 
> 9531 /
> 
> c) Inside the chroot jail of the live-sdk:
> 
> root@devuan:/# ls --inode --directory "/"
> 
> 22839335 /
> 
> I reckon this approach won't work neither in the case of operating 
> systems using random inode numbers
> (but this is not our case),nor in the case of chroot jails rooted on a 
> mount point, in which case we have
> the following workaround(at least in debian-based systems):
> 
> https://manpages.debian.org/jessie/debianutils/ischroot.1.en.html
> 
> Hope this helps,
> 
> Aitor.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
> 
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-30 Thread aitor_czr

On 30/3/20 20:00, tom wrote:

OpenRC natively supports detecting what kind of environment it running
in. Be it baremetal, LXC, etc. Perhaps you could use that or at least
look at the source code for it.


Thanks a lot, tom.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-30 Thread tom
On Mon, 30 Mar 2020 16:37:40 +
aitor_czr  wrote:

> Hi,
> 
> On 30/3/20 14:09, g4sra via Dng wrote:
> > Fails to identify a Devuan Guest which has its own partition
> > running in a VM hosted by Fedora.  
> 
> Are you referring to the *raw* host hard disk from a guest?
> 
> http://www.virtualbox.org/manual/ch09.html#rawdisk
> 
> Aitor.
> 
> 

OpenRC natively supports detecting what kind of environment it running
in. Be it baremetal, LXC, etc. Perhaps you could use that or at least
look at the source code for it.

-- 
  
/ It's illegal in Wilbur, Washington, to \
\ ride an ugly horse./
  
\
 \
   /\   /\   
  //\\_//\\ 
  \_ _//   /
   / * * \/^^^]
   \_\O/_/[   ]
/   \_[   /
\ \_  /  /
 [ [ /  \/ _/
_[ [ \  /_/
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-30 Thread aitor_czr

Hi,

On 30/3/20 14:09, g4sra via Dng wrote:

Fails to identify a Devuan Guest which has its own partition running in a VM 
hosted by Fedora.


Are you referring to the *raw* host hard disk from a guest?

http://www.virtualbox.org/manual/ch09.html#rawdisk

Aitor.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-30 Thread g4sra via Dng
On 30/03/2020 16:18, aitor_czr wrote:
> Hi Svante,
> 
> On 19/2/20 15:17, Svante Signell via Dng wrote:
>> Hello,
>>
>> No replies so far from the devuan-dev list. Maybe with a larger audience I 
>> can
>> get some help!
>>
>> Thanks!
> Checking� whether the *inode* number of the primary directory in the 
> standard filesystem hierarchy
> used in the most unix-like sytems(that is, the root "/" directory) is *equal* 
> to 2 will help to differentiate
> if you are within a container or not. eg you can do:
> 
> $ ls --inode --directory "/"
> 
> 2 /
> 
> While in a container the output of this command will return a high inode 
> number. I tested it in three
> different scenarios:
> 
> a) Using docker bash shell of ubuntu:
> 
> # docker run -it ubuntu bash
> 
> root@b87da5b70a84:/# ls --inode --directory "/"
> 
> 2492863 /
> 
> b) Using a qemu qcow2 image of devuan:
> 
> $ ls --inode --directory "/"
> 
> 9531 /
> 
> c) Inside the chroot jail of the live-sdk:
> 
> root@devuan:/# ls --inode --directory "/"
> 
> 22839335 /
> 
> I reckon this approach won't work neither in the case of operating systems 
> using random inode numbers
> (but this is not our case),nor in the case of chroot jails rooted on a mount 
> point, in which case we have
> the following workaround(at least in debian-based systems):
> 
> https://manpages.debian.org/jessie/debianutils/ischroot.1.en.html
> 
> Hope this helps,
> 
> Aitor.
>
This will likely only work reliably when the Guest is sharing a filesystem in 
some way.
Fails to identify a Devuan Guest which has its own partition running in a VM 
hosted by Fedora.
I reason it will also fail for a Guest with its own Logical Volume, anybody 
like to test ?
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-03-30 Thread aitor_czr

Hi Svante,

On 19/2/20 15:17, Svante Signell via Dng wrote:

Hello,

No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!

Thanks!
Checking  whether the *inode* number of the primary directory in the 
standard filesystem hierarchy
used in the most unix-like sytems(that is, the root "/" directory) is 
*equal* to 2 will help to differentiate

if you are within a container or not. eg you can do:

$ ls --inode --directory "/"

2 /

While in a container the output of this command will return a high inode 
number. I tested it in three

different scenarios:

a) Using docker bash shell of ubuntu:

# docker run -it ubuntu bash

root@b87da5b70a84:/# ls --inode --directory "/"

2492863 /

b) Using a qemu qcow2 image of devuan:

$ ls --inode --directory "/"

9531 /

c) Inside the chroot jail of the live-sdk:

root@devuan:/# ls --inode --directory "/"

22839335 /

I reckon this approach won't work neither in the case of operating 
systems using random inode numbers
(but this is not our case),nor in the case of chroot jails rooted on a 
mount point, in which case we have

the following workaround(at least in debian-based systems):

https://manpages.debian.org/jessie/debianutils/ischroot.1.en.html

Hope this helps,

Aitor.








___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-21 Thread Aitor

Hi again,

On 21/2/20 12:18, aitor wrote:

Hi,

En 19 de febrero de 2020 20:36:31 aitor  escribió:

Sorry, but i haven't any computer to hand so far :(


My system can't start X sessions due to the full /home partition (not 
enough space in my /dev/sda5) and the virtual ttys don't work. Gparted 
cannot mount the partition, and clonezilla coudn't check it due to the 
existen git metadata, i guess. I found a solution in debian-installer, 
keeping tha data of my /home, which allow me to run ash commands 
within the target. I still didn't with test-disk tool.


This weekend i will work on the issue concerning to this thead, Svante :)

Cheers,

Aitor. 


I shall rectify some points. In summary:

- I couldn't start a Xsession due to the busy space, and the virtual 
terminals didn't work.


- Thunar couldn't mount the /home partition during a live session.

- Gparted couldn't resize the partition after reducing the size of the 
swap memory, suggesting at the same time to update the version of e2fsck.


- Clonezilla couldn't check /dev/sda5 due to unsupported features: 
metadata_csum (i must say that i used a very old version of clonezilla).


- After the restoring the system with debian-installer (keeping the data 
of the /home partition, but using it as ext4 and mounting it as /home, 
of course,


it's possible to enter into the target and then you can remove whatever 
you want.


I already have my computer working again. There is no getting around the 
fact that d-i is awesome :)

I wonder whether test-disk would have worked.

Cheers,

Aitor.



___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-21 Thread aitor

Hi,

En 19 de febrero de 2020 20:36:31 aitor  escribió:



Sorry, but i haven't any computer to hand so far :(


My system can't start X sessions due to the full /home partition (not 
enough space in my /dev/sda5) and the virtual ttys don't work. Gparted 
cannot mount the partition, and clonezilla coudn't check it due to the 
existen git metadata, i guess. I found a solution in debian-installer, 
keeping tha data of my /home, which allow me to run ash commands within the 
target. I still didn't with test-disk tool.


This weekend i will work on the issue concerning to this thead, Svante :)

Cheers,

Aitor.



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-19 Thread aitor

Hi again Svante,

En 19 de febrero de 2020 19:48:02 aitor  escribió:


En 19 de febrero de 2020 18:42:34 aitor  escribió:


Hi again,

En 19 de febrero de 2020 17:11:28 aitor  escribió:


Hi Svante,

En 19 de febrero de 2020 16:16:39 Svante Signell via Dng
 escribió:


Hello,




No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!




Thanks!












--
eudev: Methods to detect if running in a container.
De: Svante Signell svante.sign...@gmail.com
Fecha: 18 feb., 12:24
Para: devuan-dev devuan-...@lists.dyne.org




Hello,




I'm trying to solve the problem of detecting if you are within a container,
like
docker or LXC when running the eudev init script. If true udevd should not be
cstarted. The current version of eudev (3.2.9-4) has a buggy check for
containers, and people running runit as init have problems, see #392.




eudev-3.2.7-6 has the following test:
if ! ps --no-headers --format args ax | egrep -q '^\['; then
log_warning_msg "udev does not support containers, not started"
exit 0
fi
I don't know the origin of this test and have not found anything about the
output within a container.




udev-244-3 has the following test:
if [ ! -w /sys ]; then
log_warning_msg "udev does not support containers, not started"
exit 0
fi
This test is buggy since /sys is a directory not a file and /sys is always
writable when running. Any command triggers this test:
/etc/init.d/udev status
udev does not support containers, not started ... (warning).




Googling around the following tests shows:
https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
https://en.wikipedia.org/wiki/Docker_(software)




1) cat /proc/1/sched | head -n 1
# Container: bash (5276, #threads: 1)
# No container: init (1, #threads: 1)




2) grep 'docker\|lxc' /proc/1/cgroup
Note 1: On a beowulf image it is empty??
Note 2: On a systemd-free Debian/bullseye image it shows
1:name=elogind:/1
0::/
Note 3: On a systemd-free Debian/buster image:
 after removing systemd-shim and cgmanager




3) cat /proc/1/environ | tr '\0' '\n' | grep ^container




Any help on this subject is appreciated, especially the output of the above
tests when running in a container.




Thanks!


The short answer from my mobile: maybe i can help you later at home,
because i remember some similar issue related with the chroot jail of the
live-sdk (another type of container after all) and the dev-assistant of the
vdev packaging.

Cheers,

Aitor.








--
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Now i can remember the issue: some script in the vdev.install file trying
to detect if dev-assisntant is running or not, the "ps" throws an empty
output even being it running.


Within the jail, that goes without saying, a sort of container as i said.



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
I forgot: the "suid.cpp" file of simple-netaid contains C code detecting 
the running processes (for kulling dhclient, wpa_suplicant and so...), 
including an exception because time to time some files cannot be opened in 
read mode i seem to remember. Have a look at the code of 
"kill_all_processes" function. It might be useful for your purposses, i hope.


Recently i put a link to the newest sources of simple-netaid, here in the 
mailing list.


Sorry, but i haven't any computer to hand so far :(

Aitor.



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-19 Thread aitor



En 19 de febrero de 2020 18:42:34 aitor  escribió:


Hi again,

En 19 de febrero de 2020 17:11:28 aitor  escribió:


Hi Svante,

En 19 de febrero de 2020 16:16:39 Svante Signell via Dng
 escribió:


Hello,




No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!




Thanks!












--
eudev: Methods to detect if running in a container.
De: Svante Signell svante.sign...@gmail.com
Fecha: 18 feb., 12:24
Para: devuan-dev devuan-...@lists.dyne.org




Hello,




I'm trying to solve the problem of detecting if you are within a container,
like
docker or LXC when running the eudev init script. If true udevd should not be
cstarted. The current version of eudev (3.2.9-4) has a buggy check for
containers, and people running runit as init have problems, see #392.




eudev-3.2.7-6 has the following test:
if ! ps --no-headers --format args ax | egrep -q '^\['; then
log_warning_msg "udev does not support containers, not started"
exit 0
fi
I don't know the origin of this test and have not found anything about the
output within a container.




udev-244-3 has the following test:
if [ ! -w /sys ]; then
log_warning_msg "udev does not support containers, not started"
exit 0
fi
This test is buggy since /sys is a directory not a file and /sys is always
writable when running. Any command triggers this test:
/etc/init.d/udev status
udev does not support containers, not started ... (warning).




Googling around the following tests shows:
https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
https://en.wikipedia.org/wiki/Docker_(software)




1) cat /proc/1/sched | head -n 1
# Container: bash (5276, #threads: 1)
# No container: init (1, #threads: 1)




2) grep 'docker\|lxc' /proc/1/cgroup
Note 1: On a beowulf image it is empty??
Note 2: On a systemd-free Debian/bullseye image it shows
1:name=elogind:/1
0::/
Note 3: On a systemd-free Debian/buster image:
 after removing systemd-shim and cgmanager




3) cat /proc/1/environ | tr '\0' '\n' | grep ^container




Any help on this subject is appreciated, especially the output of the above
tests when running in a container.




Thanks!


The short answer from my mobile: maybe i can help you later at home,
because i remember some similar issue related with the chroot jail of the
live-sdk (another type of container after all) and the dev-assistant of the
vdev packaging.

Cheers,

Aitor.








--
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Now i can remember the issue: some script in the vdev.install file trying
to detect if dev-assisntant is running or not, the "ps" throws an empty
output even being it running.


Within the jail, that goes without saying, a sort of container as i said.



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-19 Thread aitor

Hi again,

En 19 de febrero de 2020 17:11:28 aitor  escribió:


Hi Svante,

En 19 de febrero de 2020 16:16:39 Svante Signell via Dng
 escribió:


Hello,


No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!


Thanks!






--
eudev: Methods to detect if running in a container.
De: Svante Signell svante.sign...@gmail.com
Fecha: 18 feb., 12:24
Para: devuan-dev devuan-...@lists.dyne.org


Hello,


I'm trying to solve the problem of detecting if you are within a container,
like
docker or LXC when running the eudev init script. If true udevd should not be
cstarted. The current version of eudev (3.2.9-4) has a buggy check for
containers, and people running runit as init have problems, see #392.


eudev-3.2.7-6 has the following test:
if ! ps --no-headers --format args ax | egrep -q '^\['; then
 log_warning_msg "udev does not support containers, not started"
 exit 0
fi
I don't know the origin of this test and have not found anything about the
output within a container.


udev-244-3 has the following test:
if [ ! -w /sys ]; then
 log_warning_msg "udev does not support containers, not started"
 exit 0
fi
This test is buggy since /sys is a directory not a file and /sys is always
writable when running. Any command triggers this test:
/etc/init.d/udev status
udev does not support containers, not started ... (warning).


Googling around the following tests shows:
https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
https://en.wikipedia.org/wiki/Docker_(software)


1) cat /proc/1/sched | head -n 1
# Container: bash (5276, #threads: 1)
# No container: init (1, #threads: 1)


2) grep 'docker\|lxc' /proc/1/cgroup
Note 1: On a beowulf image it is empty??
Note 2: On a systemd-free Debian/bullseye image it shows
1:name=elogind:/1
0::/
Note 3: On a systemd-free Debian/buster image:
 after removing systemd-shim and cgmanager


3) cat /proc/1/environ | tr '\0' '\n' | grep ^container


Any help on this subject is appreciated, especially the output of the above
tests when running in a container.


Thanks!


The short answer from my mobile: maybe i can help you later at home,
because i remember some similar issue related with the chroot jail of the
live-sdk (another type of container after all) and the dev-assistant of the
vdev packaging.

Cheers,

Aitor.






--
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Now i can remember the issue: some script in the vdev.install file trying 
to detect if dev-assisntant is running or not, the "ps" throws an empty 
output even being it running. So, i used this behaviour in the 
dev-assistant script; that is if the output of the "ps" command is empty it 
means that we are in the chroot jail of the live-sdk and debconf will not 
ask anything to the user going ahead with the instalation of vdev/udev/eudev.


Hope this helps,

Aitor.


Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-19 Thread aitor


Hi Svante,

En 19 de febrero de 2020 16:16:39 Svante Signell via Dng 
 escribió:



Hello,


No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!


Thanks!






--
eudev: Methods to detect if running in a container.
De: Svante Signell svante.sign...@gmail.com
Fecha: 18 feb., 12:24
Para: devuan-dev devuan-...@lists.dyne.org


Hello,


I'm trying to solve the problem of detecting if you are within a container, 
like

docker or LXC when running the eudev init script. If true udevd should not be
cstarted. The current version of eudev (3.2.9-4) has a buggy check for
containers, and people running runit as init have problems, see #392.


eudev-3.2.7-6 has the following test:
if ! ps --no-headers --format args ax | egrep -q '^\['; then
 log_warning_msg "udev does not support containers, not started"
 exit 0
fi
I don't know the origin of this test and have not found anything about the
output within a container.


udev-244-3 has the following test:
if [ ! -w /sys ]; then
 log_warning_msg "udev does not support containers, not started"
 exit 0
fi
This test is buggy since /sys is a directory not a file and /sys is always
writable when running. Any command triggers this test:
/etc/init.d/udev status
udev does not support containers, not started ... (warning).


Googling around the following tests shows:
https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
https://en.wikipedia.org/wiki/Docker_(software)


1) cat /proc/1/sched | head -n 1
# Container: bash (5276, #threads: 1)
# No container: init (1, #threads: 1)


2) grep 'docker\|lxc' /proc/1/cgroup
Note 1: On a beowulf image it is empty??
Note 2: On a systemd-free Debian/bullseye image it shows
1:name=elogind:/1
0::/
Note 3: On a systemd-free Debian/buster image:
 after removing systemd-shim and cgmanager


3) cat /proc/1/environ | tr '\0' '\n' | grep ^container


Any help on this subject is appreciated, especially the output of the above
tests when running in a container.


Thanks!


The short answer from my mobile: maybe i can help you later at home, 
because i remember some similar issue related with the chroot jail of the 
live-sdk (another type of container after all) and the dev-assistant of the 
vdev packaging.


Cheers,

Aitor.






--
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



Enviado con AquaMail para Android
https://www.mobisystems.com/aqua-mail


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] Help needed:[Fwd: eudev: Methods to detect if running in a container.]

2020-02-19 Thread Svante Signell via Dng
Hello,

No replies so far from the devuan-dev list. Maybe with a larger audience I can
get some help!

Thanks!
--- Begin Message ---
Hello,

I'm trying to solve the problem of detecting if you are within a container, like
docker or LXC when running the eudev init script. If true udevd should not be
cstarted. The current version of eudev (3.2.9-4) has a buggy check for
containers, and people running runit as init have problems, see #392.

eudev-3.2.7-6 has the following test:
if ! ps --no-headers --format args ax | egrep -q '^\['; then
  log_warning_msg "udev does not support containers, not started"
  exit 0
fi
I don't know the origin of this test and have not found anything about the
output within a container.

udev-244-3 has the following test:
if [ ! -w /sys ]; then
  log_warning_msg "udev does not support containers, not started"
  exit 0
fi
This test is buggy since /sys is a directory not a file and /sys is always
writable when running. Any command triggers this test:
/etc/init.d/udev status
udev does not support containers, not started ... (warning).

Googling around the following tests shows:
https://stackoverflow.com/questions/20010199/how-to-determine-if-a-process-runs-inside-lxc-docker
https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
https://en.wikipedia.org/wiki/Docker_(software)

1) cat /proc/1/sched | head -n 1
# Container: bash (5276, #threads: 1)
# No container: init (1, #threads: 1)

2) grep 'docker\|lxc' /proc/1/cgroup
Note 1: On a beowulf image it is empty??
Note 2: On a systemd-free Debian/bullseye image it shows
1:name=elogind:/1
0::/
Note 3: On a systemd-free Debian/buster image:
 after removing systemd-shim and cgmanager

3) cat /proc/1/environ | tr '\0' '\n' | grep ^container

Any help on this subject is appreciated, especially the output of the above
tests when running in a container.

Thanks!


--- End Message ---
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng