遇到这个问题时运行 ns2 .tcl 文件时出现分段错误 (核心已转储)

huangapple go评论138阅读模式
英文:

faced this problem when runnning ns2 .tcl file Segmentation fault (core dumped)

问题

I understand your request. Here are the translated portions of the text:

  1. 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)""
  2. Configuration options for the NS2 simulation:

    • Various configuration settings are specified for the simulation.
  3. 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"
  4. 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)"

`

  1. `# define options
  2. set val(chan) Channel/WirelessChannel ;# channel type
  3. set val(prop) Propagation/TwoRayGround ;# radio propagation model
  4. set val(netif) Phy/Wireless ;# network interface type
  5. set val(mac) Mac/802_11 ;# MAC type
  6. set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
  7. set val(ll) LL ;#Link layer type
  8. set val(ant) Antenna/OmniAntenna ;# antenna model
  9. set val(ifqlen) 50 ;# max packet in ifq
  10. set val(nn) 50 ;# number of mobile nodes
  1. set val(rp) MDAOMDV ;# Routing protocol
  2. set val(x) 800 ;# X dimension of topography
  3. set val(y) 800 ;# Y dimension of topography
  4. set val(stop) 50 ;# time of simulation end
  5. set val(energymodel) EnergyModel ;
  6. set val(n_ch) chan_1
  7. #------------------------------------------------------------------------------
  8. # ------------------------------------------------------------------------------
  9. #remove-all-packet-headers
  10. #add- packet header IP LL Mac AODV AOMDV ATR DSDV DSR OLSR UDP TCP CBR FTP ;# needed headers
  11. Mac /802_11 set CWMin_31
  12. Mac /802_11 set CWMax_1023
  13. Mac /802_set Slot Time _0.000020 ;# 20us
  14. Mac /802_11 set SIFS_0.000010 ;# 10us
  15. Mac /802_11 set preamble Length_144 ;# 144 bit
  16. Mac /802_11 set short preamble Length _ ;# 72 bit
  17. Mac /802_ set preamble data rate_1.0e6 ;# 1Mbps
  18. Mac /802_11 set PLCP Header Length_ 48 ;# 48 bits
  19. Mac /802_11 set PLCP Data Rate_1.0e6 ;# 1Mbps
  20. Mac /802_11 set Short PLCP Data Rate_2.0e6 ;# 2Mbps
  21. Mac /802_11 set RTS Threshold_3000 ;# bytes
  22. Mac /802_11 set Short Retry Limit_7 ;# retransmissions
  23. Mac /802_11 set Long Retry Limit _4 ;# retransmissions
  24. 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
  25. Mac /802_11 set Data Rate _2Mb ;# 802.11 data transmission rate
  26. Mac/802_11 set basic Rate_1Mb ;# 802.11 basic transmission
  27. Mac /802_11 set aarf_ false
  28. # creating simulation:
  29. set ns [new Simulator]
  30. #use colors to differentiate the traffics
  31. $ns color 1 Green
  32. # creating nam and trace file:
  33. set trace fd[open mdaomdv.tr w]
  34. set namtrace [open mdaomdv.nam w]
  35. $ns trace _ all $ tracefd
  36. $ns nam trace-all-wireless $nam trace $val (x) $ val(y)
  37. #set up topography object
  38. Set topo[new Topography]
  39. $topo load_ flat grid $val(x) $val(y)
  40. Set god_[create-god val(nn)]
  41. #configure the nodes
  42. $ns node-config-ad hoc routing $val (rp) \
  43. -ll Type $val(ll) \
  44. -mac Type $val(mac) \
  45. -ifq Type $ val (ifq) \
  46. -ifq Len $val (ifqlen) \
  47. -ant Type $ val(ant) \
  48. -prop Type $ (prop) \
  49. -phy Type $val(net if) \
  50. -channel Type $ val (chann) \
  51. -topo Instance $topo \
  52. -agent Trace ON \
  53. -router Trace ON \
  54. -mac Trace OFF \
  55. -movement Trace ON
  56. -channel $chan_1 \
  57. -energy Model $ val (energy model) \
  58. #-rx power 0.3 \
  59. #-tx power 0.6 \
  60. #-initial Energy 90
  61. ## creating node object
  62. For {set i 0} {$i < 20} { incr i } {
  63. Set node _ ($i) [$ns node]
  64. } for {set i 0} {$i < 20} {incr i } {
  65. $node _($i) color blue
  66. $ns at 0.0 "$node_($i) color blue"
  67. }
  68. for {set i 20} {$i < 30 } { incr i } {
  69. set node _($) [$ns node]
  70. }
  71. for {set i 20} {$i < 30 } {incr i } {
  72. $node_($i) color cyan
  73. $ns at 1.0 "$node_($i) color cyan"
  74. }
  75. for {set i 30} {$i < 50 } { incr i } {
  76. set node_($i) [$ns node]
  77. }
  78. for {set i 20} {$i < 50 } {incr i } {
  79. $node_($i) color red
  80. $ns at 2.0 "$node_($i) color red"
  81. }
  82. ##provide initial location of mobile nodes.
  83. for {set i 0} {$i < $val(nn) } { incr i } {
  84. set xx [expr rand()*800]
  85. set yy [expr rand()* 800]
  86. $node_($i) set X_ $xx
  87. $node_($i) set Y_ $yy
  88. }
  89. # Define node initial position in nam
  90. for {set i 0} {$i < $val(nn)} { incr i } {
  91. # defines the node size for nam
  92. $ns initial_ node_ pos $node_($i) 30
  93. }
  94. Proc stop {} {
  95. Global ns tracefd nam trace
  96. $ns flush-trace
  97. Close $tracefd
  98. Close $nam trace
  99. Exec nam mdaomdv.nam &
  100. }
  101. $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&amp;usp=share_link"
"参考 https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?resourcekey=0-vrEMHtGTFP3yLoTQz_UAwA&amp;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

Ref. https://drive.google.com/drive/folders/0B7S255p3kFXNSmRYb2lGcDRUdWs?resourcekey=0-vrEMHtGTFP3yLoTQz_UAwA&amp;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


111_aomdv.tcl

  1. # define options
  2. set val(chan) Channel/WirelessChannel ;# channel type
  3. set val(prop) Propagation/TwoRayGround ;# radio propagation model
  4. set val(netif) Phy/WirelessPhy ;# !!!EDITED !!! ;# network interface type
  5. set val(mac) Mac/802_11 ;# MAC type
  6. set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
  7. set val(ll) LL ;#Link layer type
  8. set val(ant) Antenna/OmniAntenna ;# antenna model
  9. set val(ifqlen) 50 ;# max packet in ifq
  10. set val(nn) 50 ;# number of mobile nodes
  11. set val(rp) AOMDV ;# MDAOMDV ;# Routing protocol
  12. set val(x) 800 ;# X dimension of topography
  13. set val(y) 800 ;# Y dimension of topography
  14. set val(stop) 500 ;# time of simulation end
  15. set val(energymodel) EnergyModel ;
  16. set val(n_ch) chan_1
  17. set val(initialenergy) 90 ;# edited/added ########## ;# Initial energy in Joules
  18. #-----------------------------------------
  19. # ----------------------------------------
  20. #remove-all-packet-headers
  21. #add- packet header IP LL Mac AODV AOMDV ATR DSDV DSR OLSR UDP TCP CBR FTP ;# needed headers
  22. Mac /802_11 set CWMin_31
  23. Mac /802_11 set CWMax_1023
  24. Mac /802_set Slot Time _0.000020 ;# 20us
  25. Mac /802_11 set SIFS_0.000010 ;# 10us
  26. Mac /802_11 set preamble Length_144 ;# 144 bit
  27. Mac /802_11 set short preamble Length _ ;# 72 bit
  28. Mac /802_ set preamble data rate_1.0e6 ;# 1Mbps
  29. Mac /802_11 set PLCP Header Length_ 48 ;# 48 bits
  30. Mac /802_11 set PLCP Data Rate_1.0e6 ;# 1Mbps
  31. Mac /802_11 set Short PLCP Data Rate_2.0e6 ;# 2Mbps
  32. Mac /802_11 set RTS Threshold_3000 ;# bytes
  33. Mac /802_11 set Short Retry Limit_7 ;# retransmissions
  34. Mac /802_11 set Long Retry Limit _4 ;# retransmissions
  35. 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
  36. Mac /802_11 set Data Rate _2Mb ;# 802.11 data transmission rate
  37. Mac/802_11 set basic Rate_1Mb ;# 802.11 basic transmission
  38. Mac /802_11 set aarf_ false
  39. # creating simulation:
  40. set ns [new Simulator]
  41. # use colors to differentiate the traffics
  42. $ns color 1 green
  43. # creating nam and trace file:
  44. set tracefd [open mdaomdv.tr w] ;# edited
  45. set namtrace [open mdaomdv.nam w]
  46. $ns trace-all $tracefd ;# edited
  47. $ns namtrace-all-wireless $namtrace $val(x) $val(y) ;# edited
  48. #set up topography object
  49. set topo [new Topography] ;# edited
  50. $topo load_flatgrid $val(x) $val(y) ;# edited
  51. set god_ [create-god val(nn)]
  52. #configure the nodes #### section is edited #################
  53. ## all lines in this section are edited, +added: -initialEnergy $val(initialenergy) #####
  54. $ns node-config -adhocRouting $val(rp) \
  55. -llType $val(ll) \
  56. -macType $val(mac) \
  57. -ifqType $val(ifq) \
  58. -ifqLen $val(ifqlen) \
  59. -antType $val(ant) \
  60. -propType $val(prop) \
  61. -phyType $val(netif) \
  62. -channelType $val(chan) \
  63. -topoInstance $topo \
  64. -agentTrace ON \
  65. -routerTrace ON \
  66. -macTrace OFF \
  67. -movementTrace ON \
  68. -n_chType $val(n_ch) \
  69. -energyModel $val(energymodel) \
  70. #-rx power 0.3 \
  71. #-tx power 0.6 \
  72. -initialEnergy $val(initialenergy)
  73. ## creating node object ### edited section ################
  74. for {set i 0} {$i &lt; $val(nn) } {incr i} {
  75. set node_($i) [$ns node]
  76. # $node_($i) random-motion 0
  77. }
  78. for {set i 0} {$i &lt; 20} {incr i} { ;# edited
  79. $node_($i) color blue
  80. $ns at 0.0 &quot;$node_($i) color blue&quot;
  81. }
  82. for {set i 20} {$i &lt; 30} {incr i} {
  83. set node_($) [$ns node]
  84. }
  85. for {set i 20} {$i &lt; 30} {incr i} {
  86. $node_($i) color cyan
  87. $ns at 1.0 &quot;$node_($i) color cyan&quot;
  88. }
  89. for {set i 30} {$i &lt; 50} {incr i} {
  90. set node_($i) [$ns node]
  91. }
  92. for {set i 20} {$i &lt; 50} {incr i} {
  93. $node_($i) color red
  94. $ns at 2.0 &quot;$node_($i) color red&quot;
  95. }
  96. source cbr-50-20-4-512ns
  97. # provide initial location of mobile nodes
  98. for {set i 0} {$i &lt; $val(nn) } { incr i } {
  99. set xx [expr rand()*800]
  100. set yy [expr rand()* 800]
  101. $node_($i) set X_ $xx
  102. $node_($i) set Y_ $yy
  103. }
  104. # Define node initial position in nam ;# this section is edited #####
  105. for {set i 0} {$i &lt; $val(nn)} {incr i} {
  106. # defines the node size for nam
  107. $ns initial_node_pos $node_($i) 30
  108. }
  109. proc stop {} {
  110. global ns tracefd nam trace
  111. $ns flush-trace
  112. close $tracefd
  113. close $nam trace
  114. }
  115. # Tell all the nodes when the simulation ends ###############
  116. for {set i 0} {$i &lt; $val(nn) } {incr i} {
  117. $ns at $val(stop).000000001 &quot;$node_($i) reset&quot;;
  118. }
  119. $ns at $val(stop).00000001 &quot;puts \&quot;NS EXITING...\&quot; ; $ns halt&quot;
  120. $ns run
  121. exec nam mdaomdv.nam &amp;

huangapple
  • 本文由 发表于 2023年3月3日 22:17:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75628222.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定