[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#590744: Fails to boot if /sbin/init is a symlink



On 30.07.2010 03:57, Michael Prokop wrote:
> * Michael Biebl <biebl@debian.org> [Fri Jul 30, 2010 at 03:53:03AM +0200]:
>> On 29.07.2010 03:01, Michael Prokop wrote:
>>> * Michael Biebl <biebl@debian.org> [Thu Jul 29, 2010 at 02:16:32AM +0200]:
> 
>>> Why is it installing itself to /bin/systemd? Is it supposed to be
>>> executed by non-root users as well?
> 
>> Indeed. The idea is, that systemd is also started by regular users and helps
>> track their user session (replacement/extension for e.g. gnome-session)
> 
> Ok.
> 
>>>> So I moved /sbin/init from upstart to /sbin/upstart and made
>>>> /sbin/init a symlink so I could easily test both systems. Using a relative
>>>> symlink for /sbin/upstart does work, but an absolute symlink /sbin/init ->
>>>> /bin/systemd does not.
>>>> So I'm reopening the bug report and retitling appropriately.
> 
>>> If systemd really uses /bin for a reason we could use something like
>>> the following in initramfs-tools' init:
> 
>>>   # Check init bootarg
>>>   if [ -n "${init}" ] ; then
> 
>>>         # Work around absolute symlinks
>>>         initsymlinktarget="${init}"
>>>         if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${init}" ] ; then
>>>             case $(readlink "${rootmnt}${init}") in /*)
>>>                 initsymlinktarget=$(chroot "${rootmnt}" readlink "${init}")
>>>                 ;;
>>>             esac
>>>         fi
> 
>>>         if [ ! -x "${rootmnt}${init}" ] || [ ! -x "${rootmnt}${initsymlinktarget}" ] ; then
>>>               echo "Target filesystem doesn't have ${init}."
>>>               init=
>>>         fi
>>>   fi
> 
>> Does not work. For one, I guess this check
>> if [ ! -x "${rootmnt}${init}" ] || [ ! -x "${rootmnt}${initsymlinktarget}" ] ;
> 
>> should be using &&.
> 
>> Even after fixing that, we run into the same problem, later again, at:
> 
>> # No init on rootmount
>> if [ ! -x "${rootmnt}${init}" ]; then
>>         panic "No init found. Try passing init= bootarg."
>> fi
> 
> You have to drop the old "No init on rootmount" stuff of course, so
> just replace the "No init on rootmount" part with above code.

I think this check is required if "# Search for valid init" does not find a
valid init?

Besides, I noticed that if no valid init is found, I get a kernel panic, but I
assume I should get a rescue shell.

I also noticed, that initsymlinktarget is set (ie. we run and expensive chroot
call), even if I pass init=/bin/systemd on the kernel command line.

Michael


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: