Re: Invoking ‘init’ from an init.d script (Wheezy)
On Fri, 5 Jun 2015 16:25:21 +0200
Alexander Thomas <email@example.com> wrote:
> That would be an option, but it might still cause the same problem of
> apt-get hanging as we currently experience when doing the update
> before runlevel S.
> We looked deeper into this and found out that apt-get always hangs
> while installing a package before the first runlevel switch. An strace
> reveals an endless loop of SIGCONT and ioctl calls. Running other
> commands that use ioctl also results in a hang, so the controlling
> terminal seems to lack certain capabilities at this stage. We have
> found a workaround: we spawn a new terminal with agetty and run the
> update script in there, this allows to perform the apt-get
> dist-upgrade in runlevel S and avoid the init 1 hack.
I would try running apt-get with </dev/null >somelogfile 2>&1
redirections: that should ensure it sees no terminal at all on its stdin
and that should avoid code paths dealing with TTY-related ioctls
altogether. (Well, excluding the isatty(3) call which supposedly uses
fstat(2) and checks to see the device's major number is that of a TTY).