VirtualBox

10 年 前 建立

10 年 前 結束

10 年 前 更新

#13097 closed defect (invalid)

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

回報者: Andre Robatino 負責人:
元件: other 版本: VirtualBox 4.3.12
關鍵字: 副本:
Guest type: Linux Host type: other

描述

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 ~]#

附加檔案 (1)

VBox.log (184.0 KB ) - 10 年 前, 由 Andre Robatino 新增
VBox.log

下載所有附檔: .zip

更動歷史 (10)

10 年 前Andre Robatino 編輯

附檔: 新增 VBox.log

VBox.log

comment:1 10 年 前Michael Thayer 編輯

摘要: sed: -e expression #1, char 21: unterminated `s' commandsed: -e expression #1, char 21: unterminated `s' command -> operating system issue
狀態: newclosed
處理結果: invalid

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 exercise for someone else.

最後由 Michael Thayer 編輯於 10 年 前 (上一筆) (差異)

comment:2 10 年 前Andre Robatino 編輯

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 <[email protected]> - 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 10 年 前Andre Robatino 編輯

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 10 年 前Andre Robatino 編輯

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 10 年 前Michael Thayer 編輯

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 10 年 前Michael Thayer 編輯

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 10 年 前Michael Thayer 編輯

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

comment:8 10 年 前Andre Robatino 編輯

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.

最後由 Andre Robatino 編輯於 10 年 前 (上一筆) (差異)

comment:9 10 年 前Michael Thayer 編輯

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

注意: 瀏覽 TracTickets 來幫助您使用待辦事項功能

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette