英文:
faced this problem when runnning ns2 .tcl file Segmentation fault (core dumped)
问题
I understand your request. Here are the translated portions of the text:
-
Error message related to running an NS2 simulation:
- "faced this problem when try to run ns2 simulation.tcl file below this error "Segmentation fault (core dumped)""
-
Configuration options for the NS2 simulation:
- Various configuration settings are specified for the simulation.
-
Command for finding and deleting broken packages:
- "I tried to find the broken packages and delete them forcefully using this command "sudo dpkg -l | grep ^..r | apt-get purge" and again the following error happened"
-
Error message related to permission denied when running the package management command:
- "[sudo] password for derara: E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?"
英文:
faced this problem when try to run ns2 simulation.tcl file below this error "Segmentation fault (core dumped)"
`
`# define options
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio propagation model
set val(netif) Phy/Wireless ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;#Link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 50 ;# number of mobile nodes
set val(rp) MDAOMDV ;# Routing protocol
set val(x) 800 ;# X dimension of topography
set val(y) 800 ;# Y dimension of topography
set val(stop) 50 ;# time of simulation end
set val(energymodel) EnergyModel ;
set val(n_ch) chan_1
#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
#remove-all-packet-headers
#add- packet header IP LL Mac AODV AOMDV ATR DSDV DSR OLSR UDP TCP CBR FTP ;# needed headers
Mac /802_11 set CWMin_31
Mac /802_11 set CWMax_1023
Mac /802_set Slot Time _0.000020 ;# 20us
Mac /802_11 set SIFS_0.000010 ;# 10us
Mac /802_11 set preamble Length_144 ;# 144 bit
Mac /802_11 set short preamble Length _ ;# 72 bit
Mac /802_ set preamble data rate_1.0e6 ;# 1Mbps
Mac /802_11 set PLCP Header Length_ 48 ;# 48 bits
Mac /802_11 set PLCP Data Rate_1.0e6 ;# 1Mbps
Mac /802_11 set Short PLCP Data Rate_2.0e6 ;# 2Mbps
Mac /802_11 set RTS Threshold_3000 ;# bytes
Mac /802_11 set Short Retry Limit_7 ;# retransmissions
Mac /802_11 set Long Retry Limit _4 ;# retransmissions
Mac /802_11 set new chipset_ false ;# use new chipset , allowing a more recent packet to be correctly received in place of the first sensed packet
Mac /802_11 set Data Rate _2Mb ;# 802.11 data transmission rate
Mac/802_11 set basic Rate_1Mb ;# 802.11 basic transmission
Mac /802_11 set aarf_ false
# creating simulation:
set ns [new Simulator]
#use colors to differentiate the traffics
$ns color 1 Green
# creating nam and trace file:
set trace fd[open mdaomdv.tr w]
set namtrace [open mdaomdv.nam w]
$ns trace _ all $ tracefd
$ns nam trace-all-wireless $nam trace $val (x) $ val(y)
#set up topography object
Set topo[new Topography]
$topo load_ flat grid $val(x) $val(y)
Set god_[create-god val(nn)]
#configure the nodes
$ns node-config-ad hoc routing $val (rp) \
-ll Type $val(ll) \
-mac Type $val(mac) \
-ifq Type $ val (ifq) \
-ifq Len $val (ifqlen) \
-ant Type $ val(ant) \
-prop Type $ (prop) \
-phy Type $val(net if) \
-channel Type $ val (chann) \
-topo Instance $topo \
-agent Trace ON \
-router Trace ON \
-mac Trace OFF \
-movement Trace ON
-channel $chan_1 \
-energy Model $ val (energy model) \
#-rx power 0.3 \
#-tx power 0.6 \
#-initial Energy 90
## creating node object
For {set i 0} {$i < 20} { incr i } {
Set node _ ($i) [$ns node]
} for {set i 0} {$i < 20} {incr i } {
$node _($i) color blue
$ns at 0.0 "$node_($i) color blue"
}
for {set i 20} {$i < 30 } { incr i } {
set node _($) [$ns node]
}
for {set i 20} {$i < 30 } {incr i } {
$node_($i) color cyan
$ns at 1.0 "$node_($i) color cyan"
}
for {set i 30} {$i < 50 } { incr i } {
set node_($i) [$ns node]
}
for {set i 20} {$i < 50 } {incr i } {
$node_($i) color red
$ns at 2.0 "$node_($i) color red"
}
##provide initial location of mobile nodes.
for {set i 0} {$i < $val(nn) } { incr i } {
set xx [expr rand()*800]
set yy [expr rand()* 800]
$node_($i) set X_ $xx
$node_($i) set Y_ $yy
}
# Define node initial position in nam
for {set i 0} {$i < $val(nn)} { incr i } {
# defines the node size for nam
$ns initial_ node_ pos $node_($i) 30
}
Proc stop {} {
Global ns tracefd nam trace
$ns flush-trace
Close $tracefd
Close $nam trace
Exec nam mdaomdv.nam &
}
$ns run `
I tried to find the broken packages and delete them forcefully using this command "sudo dpkg -l | grep ^..r | apt-get purge" and again the following error happened
[sudo] password for derara: E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
答案1
得分: 0
以下是翻译好的部分:
"Segmentation fault is not caused by any "broken Ubuntu packages", but by plenty of typos etc. errors in your "mdaomdv.tcl" file."
"分段错误不是由任何“损坏的Ubuntu软件包”引起的,而是由您的“mdaomdv.tcl”文件中的许多拼写错误等错误引起的。"
"Section "ns node-config": <kbd>Space</kbd> after \
is forbidden."
"部分“ns node-config”:在\
后<kbd>Space</kbd>是禁止的。"
"The tcl/otcl code: For is spelled 'for', Set is 'set', Proc is 'proc', Global is 'global', Close is 'close', Exec is 'exec'."
"Tcl/otcl代码:For拼写为'for',Set拼写为'set',Proc拼写为'proc',Global拼写为'global',Close拼写为'close',Exec拼写为'exec'。"
"For correct spelling, please read e.g. EnergyModel-examples-7.tar.gz
https://drive.google.com/file/d/1g8WnlHHHnNXBLc0rwJY4i1z9uieKtl9s/view?usp=sharing"
"正确的拼写,请阅读例如EnergyModel-examples-7.tar.gz
https://drive.google.com/file/d/1g8WnlHHHnNXBLc0rwJY4i1z9uieKtl9s/view?usp=sharing"
"Ref. https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?resourcekey=0-vrEMHtGTFP3yLoTQz_UAwA&usp=share_link"
"参考 https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?resourcekey=0-vrEMHtGTFP3yLoTQz_UAwA&usp=share_link"
"Besides that, traffic is missing in the file. I added a line source cbr-50-20-4-512ns
to include a necessary example of traffic/communication → Your edited file, example "111_aomdv.tcl" + the traffic file : The AOMDV protocol is used, instead of your unknown MDAOMDV. The two files were uploaded to → → https://drive.google.com/drive/folders/14vdJfoIqqKj34clkdxuN0IclHc0o0Oml?usp=share_link"
"除此之外,文件中缺少流量。我添加了一行source cbr-50-20-4-512ns
,以包含必要的流量/通信示例 → 您编辑的文件,示例“111_aomdv.tcl” + 流量文件:使用AOMDV协议,而不是您不知道的MDAOMDV。这两个文件已上传到 → → https://drive.google.com/drive/folders/14vdJfoIqqKj34clkdxuN0IclHc0o0Oml?usp=share_link"
请注意,由于文本中包含了一些HTML转义字符,如",<,&等,这些字符在翻译中保留了原样。
英文:
Segmentation fault is not caused by any "broken Ubuntu packages", but by plenty of typos etc. errors in your "mdaomdv.tcl" file.
Section "ns node-config": <kbd>Space</kbd> after \
is forbidden.
The tcl/otcl code: For is spelled 'for', Set is 'set', Proc is 'proc', Global is 'global', Close is 'close', Exec is 'exec'.
For correct spelling, please read e.g. EnergyModel-examples-7.tar.gz
https://drive.google.com/file/d/1g8WnlHHHnNXBLc0rwJY4i1z9uieKtl9s/view?usp=sharing
Besides that, traffic is missing in the file. I added a line source cbr-50-20-4-512ns
to include a necessary example of traffic/communication → Your edited file, example "111_aomdv.tcl" + the traffic file : The AOMDV protocol is used, instead of your unknown MDAOMDV. The two files were uploaded to → →
https://drive.google.com/drive/folders/14vdJfoIqqKj34clkdxuN0IclHc0o0Oml?usp=share_link
111_aomdv.tcl
# define options
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio propagation model
set val(netif) Phy/WirelessPhy ;# !!!EDITED !!! ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;#Link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 50 ;# number of mobile nodes
set val(rp) AOMDV ;# MDAOMDV ;# Routing protocol
set val(x) 800 ;# X dimension of topography
set val(y) 800 ;# Y dimension of topography
set val(stop) 500 ;# time of simulation end
set val(energymodel) EnergyModel ;
set val(n_ch) chan_1
set val(initialenergy) 90 ;# edited/added ########## ;# Initial energy in Joules
#-----------------------------------------
# ----------------------------------------
#remove-all-packet-headers
#add- packet header IP LL Mac AODV AOMDV ATR DSDV DSR OLSR UDP TCP CBR FTP ;# needed headers
Mac /802_11 set CWMin_31
Mac /802_11 set CWMax_1023
Mac /802_set Slot Time _0.000020 ;# 20us
Mac /802_11 set SIFS_0.000010 ;# 10us
Mac /802_11 set preamble Length_144 ;# 144 bit
Mac /802_11 set short preamble Length _ ;# 72 bit
Mac /802_ set preamble data rate_1.0e6 ;# 1Mbps
Mac /802_11 set PLCP Header Length_ 48 ;# 48 bits
Mac /802_11 set PLCP Data Rate_1.0e6 ;# 1Mbps
Mac /802_11 set Short PLCP Data Rate_2.0e6 ;# 2Mbps
Mac /802_11 set RTS Threshold_3000 ;# bytes
Mac /802_11 set Short Retry Limit_7 ;# retransmissions
Mac /802_11 set Long Retry Limit _4 ;# retransmissions
Mac /802_11 set new chipset_ false ;# use new chipset , allowing a more recent packet to be correctly received in place of the first sensed packet
Mac /802_11 set Data Rate _2Mb ;# 802.11 data transmission rate
Mac/802_11 set basic Rate_1Mb ;# 802.11 basic transmission
Mac /802_11 set aarf_ false
# creating simulation:
set ns [new Simulator]
# use colors to differentiate the traffics
$ns color 1 green
# creating nam and trace file:
set tracefd [open mdaomdv.tr w] ;# edited
set namtrace [open mdaomdv.nam w]
$ns trace-all $tracefd ;# edited
$ns namtrace-all-wireless $namtrace $val(x) $val(y) ;# edited
#set up topography object
set topo [new Topography] ;# edited
$topo load_flatgrid $val(x) $val(y) ;# edited
set god_ [create-god val(nn)]
#configure the nodes #### section is edited #################
## all lines in this section are edited, +added: -initialEnergy $val(initialenergy) #####
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace ON \
-n_chType $val(n_ch) \
-energyModel $val(energymodel) \
#-rx power 0.3 \
#-tx power 0.6 \
-initialEnergy $val(initialenergy)
## creating node object ### edited section ################
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
# $node_($i) random-motion 0
}
for {set i 0} {$i < 20} {incr i} { ;# edited
$node_($i) color blue
$ns at 0.0 "$node_($i) color blue"
}
for {set i 20} {$i < 30} {incr i} {
set node_($) [$ns node]
}
for {set i 20} {$i < 30} {incr i} {
$node_($i) color cyan
$ns at 1.0 "$node_($i) color cyan"
}
for {set i 30} {$i < 50} {incr i} {
set node_($i) [$ns node]
}
for {set i 20} {$i < 50} {incr i} {
$node_($i) color red
$ns at 2.0 "$node_($i) color red"
}
source cbr-50-20-4-512ns
# provide initial location of mobile nodes
for {set i 0} {$i < $val(nn) } { incr i } {
set xx [expr rand()*800]
set yy [expr rand()* 800]
$node_($i) set X_ $xx
$node_($i) set Y_ $yy
}
# Define node initial position in nam ;# this section is edited #####
for {set i 0} {$i < $val(nn)} {incr i} {
# defines the node size for nam
$ns initial_node_pos $node_($i) 30
}
proc stop {} {
global ns tracefd nam trace
$ns flush-trace
close $tracefd
close $nam trace
}
# Tell all the nodes when the simulation ends ###############
for {set i 0} {$i < $val(nn) } {incr i} {
$ns at $val(stop).000000001 "$node_($i) reset";
}
$ns at $val(stop).00000001 "puts \"NS EXITING...\" ; $ns halt"
$ns run
exec nam mdaomdv.nam &
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论