VirtualBox

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#13097 closed defect (invalid)

sed: -e expression #1, char 21: unterminated `s' command -> operating system issue

Reported by: Andre Robatino Owned by:
Component: other Version: VirtualBox 4.3.12
Keywords: Cc:
Guest type: Linux Host type: other

Description

I get the error in the Summary when doing a kernel update in a Fedora Rawhide guest. I just discovered that doing a dkms install command triggers it, so it's probably a VirtualBox bug. Also see https://bugzilla.redhat.com/show_bug.cgi?id=1104253 where I originally reported the bug.

[root@localhost ~]# dkms status 
vboxguest, 4.3.12, 3.15.0-0.rc7.git0.1.fc21.x86_64, x86_64: installed
vboxguest, 4.3.12, 3.15.0-0.rc8.git0.1.fc21.x86_64, x86_64: installed
[root@localhost ~]# rpm -q kernel
kernel-3.15.0-0.rc7.git0.1.fc21.x86_64
kernel-3.15.0-0.rc7.git4.2.fc21.x86_64
kernel-3.15.0-0.rc8.git0.1.fc21.x86_64
[root@localhost ~]# dkms install vboxguest/4.3.12 -k 3.15.0-0.rc7.git4.2.fc21.x86_64

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.15.0-0.rc7.git4.2.fc21.x86_64 -C /lib/modules/3.15.0-0.rc7.git4.2.fc21.x86_64/build M=/var/lib/dkms/vboxguest/4.3.12/build........................................
cleaning build area....

DKMS: build completed.

vboxguest.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.15.0-0.rc7.git4.2.fc21.x86_64/extra/

vboxsf.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.15.0-0.rc7.git4.2.fc21.x86_64/extra/

vboxvideo.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.15.0-0.rc7.git4.2.fc21.x86_64/extra/
Adding any weak-modules

sed: -e expression #1, char 21: unterminated `s' command
depmod.......

DKMS: install completed.
[root@localhost ~]# dkms status 
vboxguest, 4.3.12, 3.15.0-0.rc7.git0.1.fc21.x86_64, x86_64: installed
vboxguest, 4.3.12, 3.15.0-0.rc7.git4.2.fc21.x86_64, x86_64: installed
vboxguest, 4.3.12, 3.15.0-0.rc8.git0.1.fc21.x86_64, x86_64: installed
[root@localhost ~]#

Attachments (1)

VBox.log (184.0 KB ) - added by Andre Robatino 10 years ago.
VBox.log

Download all attachments as: .zip

Change History (10)

by Andre Robatino, 10 years ago

Attachment: VBox.log added

VBox.log

comment:1 by Michael Thayer, 10 years ago

Resolution: invalid
Status: newclosed
Summary: sed: -e expression #1, char 21: unterminated `s' commandsed: -e expression #1, char 21: unterminated `s' command -> operating system issue

This looks to me like an issue with dkms in rawhide. (Noting that it doesn't happen with Fedora 20.) If you run dkms as "bash -x /sbin/dkms" you will see exactly what is happening. The critical section in the output is here:

+ for file in '"$@"'
+ [[ -n /etc/sysconfig/kernel ]]
+ [[ -w /etc/sysconfig/kernel ]]
+ [[ /etc/sysconfig/kernel = /etc/sysconfig/kernel ]]
+ sed /etc/sysconfig/kernel
sed: -e expression #1, char 21: unterminated `s' command

and it corresponds to these lines in the dkms script, where the variable ${sa_sck_o[@]} in the first sed command is empty:

    # do all the changes at once, record the diffs for posterity
    for file in "$@"; do
        [[ $file && -w $file ]] || continue
        if [[ $file = /etc/sysconfig/kernel ]]; then
            sed "${sa_sck_o[@]}" "$file" > "$temp_dir_name/${file##*/}.new"
        else
            sed "${sa_mc_o[@]}" "$file" > "$temp_dir_name/${file##*/}.new"
        fi
        if ! mod_diff=$(diff -u "$temp_dir_name/${file##*/}.new" "$file"); then
            echo $"$file updated to replace obsoleted module references:"
            echo "$mod_diff"
            cp -fp "$temp_dir_name/${file##*/}.new" "$file"
            rm -f "$temp_dir_name/${file##*/}.new"
        fi
    done

I didn't investigate why the variable is empty; I will leave that as an excercise for someone else.

Version 0, edited 10 years ago by Michael Thayer (next)

comment:2 by Andre Robatino, 10 years ago

Thanks for the details. The versions of dkms in F20 and Fedora Rawhide are 2.2.0.3-20.fc20 and 2.2.0.3-21.fc21, resp. The Rawhide version's changelog has only one additional entry:

* Fri Jan 17 2014 Simone Caronni <negativo17@gmail.com> - 2.2.0.3-21
- Adjust directory extraction due to regenerated tarball upstream.

I've had this Rawhide guest for several months, but probably only started seeing this bug after the reorganization in the 3.15 kernel binary packages (for example, kernel-core is a new package), so that may have triggered it somehow. I reopened the Fedora bug and reassigned it to dkms, at least for now.

comment:3 by Andre Robatino, 10 years ago

I note that in Rawhide, /etc/sysconfig/kernel is empty (0 bytes), unlike in F20, where it's currently a 180-byte text file.

comment:4 by Andre Robatino, 10 years ago

Ignore the previous comment - /etc/sysconfig/kernel was supposed to be populated, and after I fixed it, the sed error still appears. The dkms maintainer closed https://bugzilla.redhat.com/show_bug.cgi?id=1104253 , though I reopened it. I suspect this is actually a VirtualBox error triggered by the changes in the 3.15 kernel packaging. According to kernel.org, 3.15 just went stable, so if this is the case, any linux distro including F20 that uses it will soon start seeing the error.

comment:5 by Michael Thayer, 10 years ago

Since you did not take up my exercise above I will do it. Here is an extract a few lines further up in /sbin/dkms:

moduleconfig_update_obsoletes()
{
    # $@ = files to process
    # do nothing if we have no obsoletes
    [[ ${modules_conf_obsoletes[@]} ]] || return 0
    # generate sed args to remove obsolete modules
    local mod_diff

Observe the old output for this section:

+ moduleconfig_update_obsoletes /etc/modprobe.d/dkms.conf /etc/modprobe.d/dkms /etc/modules.conf /etc/modprobe.conf /etc/modprobe.d/vboxguest.conf /etc/sysconfig/kernel
+ [[ -n    ]]
+ local mod_diff

and note that although "${modules_conf_obsoletes[@]}" is empty return is not getting called. The error in the subject line happens because of the assumption that the function will return. The same section on Fedora 20 has the output:

+ moduleconfig_update_obsoletes /etc/modprobe.d/dkms.conf /etc/modprobe.d/dkms /etc/modules.conf /etc/modprobe.conf /etc/modprobe.d/vboxguest.conf /etc/sysconfig/kernel
+ [[ -n '' ]]
+ return 0

Perhaps a change in behaviour in /bin/bash?

comment:6 by Michael Thayer, 10 years ago

Indeed: try running the following in Fedora 20 and Fedora rawhide and compare the output:

bash -x -c 'arr[0]=; arr[1]=; [[ ${arr[@]} ]] || echo false' 

comment:7 by Michael Thayer, 10 years ago

Note that if only arr[0] is set the output is the same on both Fedora/bash versions.

comment:8 by Andre Robatino, 10 years ago

Here are the recent bash updates in my Rawhide guest. I don't remember exactly when I first started seeing this, thought it was due to the 3.15 kernel, but could be this as well.

Dec 05: bash-4.2.45-6.fc21
Feb 28: bash-4.3.0-1.fc21
Apr 02: bash-4.3.8-1.fc21
Apr 15: bash-4.3.11-1.fc21
May 20: bash-4.3.18-1.fc21
Jun 09: bash-4.3.18-2.fc21

F20 currently has bash-4.2.47-2.fc20. In F20, the output is

+ arr[0]=
+ arr[1]=
+ [[ -n '' ]]
+ echo false
false

and in Rawhide it is

+ arr[0]=
+ arr[1]=
+ [[ -n   ]]

If it's a bash update, probably either the one on Apr. 15 or May 20, more likely the latter.

Last edited 10 years ago by Andre Robatino (previous) (diff)

comment:9 by Michael Thayer, 10 years ago

Closing note: this proved to be a bug in DKMS which was revealed by a bug-fix in bash. See:

https://bugzilla.redhat.com/show_bug.cgi?id=1109736

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use