How to use the fatls command in uboot sandbox? - bootloader

I am working uboot sandbox. here how to see my fatls in sandbox.
=> help fatls
fatls - list files in a directory (default /)
Usage:
fatls <interface> [<dev[:part]>] [directory]
- list files from 'dev' on 'interface' in a 'directory'
here what is interface and what is dev in my system.
i am trying,
=> fatls sda 0
** Bad device sda 0 **

You have to do a bit more work. Assuming you have built sandbox already:
$ dd if=/dev/zero of=fat.img bs=1k count=2048
$ mkfs.vfat ./fat.img
$ ./u-boot
...
=> host bind 0 fat.img
=> fatls host 0:0
0 file(s), 0 dir(s)
=>

Related

Kernel panic after ubi rootfs size increased

I'm currently working with LTIB tool to generate linux kernel 3.0.25, with u-boot-2009-08, for iMX6 solo core board.
I use mfg tool to flash. When I installed new packages, the rootfs size changed from 147 to 162MiB. Since then, I can't boot anymore, the ubi doesn't get attached.
I have a kernel panic with the following logs :
**UBI error: process_eb: bad image sequence number 1588612812 in PEB 720, expected 1344834100**
UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22
UBI error: ubi_init: cannot attach mtd9
UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:root", error -19
VFS: Cannot open root device "ubi0:root" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
UBI error screenshot
Kernel Panic Screenshot
To get rid of this, I changed the u-boot mfg CONFIG_BOOTARGS as follows :
#define CONFIG_BOOTARGS "console=ttymxc1,115200 rdinit=/linuxrc mtdparts=gpmi-
nand:4m(boot),256k(bootenv),2m(splashscreen),10m(ramdisk),5m(kernel),5m(flasherkernel),256k(updater
),256k(flag1),256k(flag2),170m(rootfs),32m(userpart1),32m(userpart2),-(userpart)"\
Here's the ubinize.cfg :
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=170MiB
vol_type=dynamic
vol_name=root
vol_flags=autoresize
And the ubi generation commands :
sudo mkfs.ubifs -r $ROOTFS -m 4096 -e 253952 -c 1184 -o ubifs.img
sudo ubinize -o $BUILT_IMG/ubi.img -m 4096 -p 256KiB ubinize.cfg
And the flash commands :
$ flash_eraseall /dev/mtd9 # Erasing Rootfs partition
$ send" file="files/ubi.img # Sending Root filesystem
$ ubiformat /dev/mtd9 -f $FILE -s 4096 -O 4096 # Flashing Root Filesystem
Any idea ?
Thanks

net-snmp on start says - "Error opening specified endpoint " in Raspberry pi - Jessica

My raspberry pi - jessica has got snmpd --version
NET-SNMP version: 5.7.2.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders#lists.sourceforge.net
Now, I am trying to make a subagent application and running it.
When I try to run this I get the following error -
$ sudo snmpd -f -Lo -C --rwcommunity=public --master=agentx --agentXSocket=tcp:localhost:1705
pcilib: Cannot open /proc/bus/pci
pcilib: Cannot find any working access method.
pcilib: pci_init failed
error on subcontainer 'ia_addr' insert (-1)
Turning on AgentX master support.
Error opening specified endpoint ""
Server Exiting with code 1
Why I get this error? Here is my snmpd.conf file.
###############################################################################
#
# EXAMPLE.conf:
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
# See the 'snmpd.conf(5)' man page for details
#
# Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
# AGENT BEHAVIOUR
#
# Listen for connections from the local system only
agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
#agentAddress udp:161,udp6:[::1]:161
###############################################################################
#
# SNMPv3 AUTHENTICATION
#
# Note that these particular settings don't actually belong here.
# They should be copied to the file /var/lib/snmp/snmpd.conf
# and the passwords changed, before being uncommented in that file *only*.
# Then restart the agent
# createUser authOnlyUser MD5 "remember to change this password"
# createUser authPrivUser SHA "remember to change this one too" DES
# createUser internalUser MD5 "this is only ever used internally, but still change the password"
# If you also change the usernames (which might be sensible),
# then remember to update the other occurances in this example config file to match.
###############################################################################
#
# ACCESS CONTROL
#
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# Full access from the local host
#rocommunity public localhost
# Default access to basic system info
rocommunity public default -V systemonly
# Full access from an example network
# Adjust this network address to match your local
# settings, change the community string,
# and check the 'agentAddress' setting above
#rocommunity secret 10.0.0.0/16
# Full read-only access for SNMPv3
rouser authOnlyUser
# Full write access for encrypted requests
# Remember to activate the 'createUser' lines above
#rwuser authPrivUser priv
# It's no longer typically necessary to use the full 'com2sec/group/access' configuration
# r[ow]user and r[ow]community, together with suitable views, should cover most requirements
###############################################################################
#
# SYSTEM INFORMATION
#
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
# See snmpd.conf(5) for more details
sysLocation Sitting on the Dock of the Bay
sysContact Me <me#example.org>
# Application + End-to-End layers
sysServices 72
#
# Process Monitoring
#
# At least one 'mountd' process
proc mountd
# No more than 4 'ntalkd' processes - 0 is OK
proc ntalkd 4
# At least one 'sendmail' process, but no more than 10
proc sendmail 10 1
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
#
# Disk Monitoring
#
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk / 10000
disk /var 5%
includeAllDisks 10%
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
#
# System Load
#
# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
###############################################################################
#
# ACTIVE MONITORING
#
# send SNMPv1 traps
trapsink localhost public
# send SNMPv2c traps
#trap2sink localhost public
# send SNMPv2c INFORMs
#informsink localhost public
# Note that you typically only want *one* of these three lines
# Uncommenting two (or all three) will result in multiple copies of each notification.
#
# Event MIB - automatically generate alerts
#
# Remember to activate the 'createUser' lines above
iquerySecName internalUser
rouser internalUser
# generate traps on UCD error conditions
defaultMonitors yes
# generate traps on linkUp/Down
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
#
# Arbitrary extension commands
#
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
#extend-sh test3 /bin/sh /tmp/shtest
# Note that this last entry requires the script '/tmp/shtest' to be created first,
# containing the same three shell commands, before the line is uncommented
# Walk the NET-SNMP-EXTEND-MIB tables (nsExtendConfigTable, nsExtendOutput1Table
# and nsExtendOutput2Table) to see the resulting output
# Note that the "extend" directive supercedes the previous "exec" and "sh" directives
# However, walking the UCD-SNMP-MIB::extTable should still returns the same output,
# as well as the fuller results in the above tables.
#
# "Pass-through" MIB extension command
#
#pass .1.3.6.1.4.1.8072.2.255 /bin/sh PREFIX/local/passtest
#pass .1.3.6.1.4.1.8072.2.255 /usr/bin/perl PREFIX/local/passtest.pl
# Note that this requires one of the two 'passtest' scripts to be installed first,
# before the appropriate line is uncommented.
# These scripts can be found in the 'local' directory of the source distribution,
# and are not installed automatically.
# Walk the NET-SNMP-PASS-MIB::netSnmpPassExamples subtree to see the resulting output
#
# AgentX Sub-agents
#
# Run as an AgentX master agent
master agentx
# Listen for network connections (from localhost)
# rather than the default named socket /var/agentx/master
#agentXSocket tcp:localhost:705
It's probably too late for Bali Vinayak, but might help others with like issue.
On an Ubuntu 16.04.5 LTS, NET-SNMP version: 5.7.3 I solved the same error setting snmpd to use TCP instead instead of UDP.
So edit /etc/snmp/snmpd.conf:
agentAddress tcp:127.0.0.1:161
Then I got no error running the startup command:
systemctl start snmpd.service
There is a bug in the /etc/snmp/snmpd.conf file.
Search for
trapsink localhost public
and add :162 after localhost, such as
trapsink localhost:162 public
Reference: https://github.com/net-snmp/net-snmp/issues/34
I resolved it by edit /etc/snmp/snmpd.conf to this:
# agentaddress 127.0.0.1,[::1]
agentaddress 127.0.0.1
There is also another, simpler case which results in the "Error opening specified endpoint" message. Because other posts seem to be referencing to this at least indirectly, I will post it under this topic also. See my case:
root#am335x-evm:~# /etc/init.d/snmpd stop
Stopping network management services: snmpd snmptrapd.
Then trying to start snmpd manually:
root#am335x-evm:~# /usr/sbin/snmpd -Lo -a -f
Error opening specified endpoint "127.0.0.1"
Server Exiting with code 1
But look:
root#am335x-evm:~# ps aux | grep snmp
root 562 0.4 3.7 30944 9168 ? Ssl 18:17 0:00 /usr/sbin/snmpd -Ls0-6d -a -f
root 570 0.0 1.9 8880 4792 ? Ss 18:17 0:00 /usr/sbin/snmptrapd -Lsd -f
root 692 0.0 0.6 2352 1636 pts/0 S+ 18:21 0:00 grep snmp
So, the init script did not actually stop it. Stopping it properly:
root#am335x-evm:~# systemctl stop snmpd
root#am335x-evm:~# ps aux | grep snmp
root 570 0.0 1.9 8880 4792 ? Ss 18:17 0:00 /usr/sbin/snmptrapd -Lsd -f
root 708 0.0 0.6 2352 1520 pts/0 S+ 18:24 0:00 grep snmp
Then trying running:
root#am335x-evm:~# /usr/sbin/snmpd -Lo -a -f
NET-SNMP version 5.8
It works.

How to set the permissions of my driver file using udev rules

I am trying to set the permissions on my device driver file to read/write for all users using udev rules but it does work.
here the udev rules :
SUBSYSTEM=="lpc*", KERNEL=="lpc?*", DRIVER=="lpc", GROUP="users", MODE="0666"
When I test it using :
sudo udevadm test $(udevadm info -q path -n /dev/lpc_peach)2>&1
this is what i get at the bottom lines :
preserve permissions /dev/lpc_peach, 020600, uid=0, gid=0
preserve already existing symlink '/dev/char/248:0' to '../lpc_peach'
I can't identify what is wrong! Any help will be useful.
Edit 1 : When I run udevadm info -q all -n /dev/lpc_peach here is what I get:
P: /devices/virtual/lpc_spartan/lpc_peach
N: lpc_peach
E: DEVNAME=/dev/lpc_peach
E: DEVPATH=/devices/virtual/lpc_spartan/lpc_peach
E: MAJOR=247
E: MINOR=0
E: SUBSYSTEM=lpc_spartan

What is OE+ in Linux?

What is the meaning of (OE+) in the following?
$ sudo cat /proc/modules | grep hello //hello_world is a kernel module created by me.
hello_world 20480 1 - Loading 0xffffffffc0221000 (OE+)
Here is my situation.
I have patched the Linux kernel function load_module(), which is called from finit_module(), the system call used by insmod to insert kernel modules.
The patch looks for a specific module, created by me (called hello_world) being installed, and when it does, it prevents the call to do_init_module(), and returns 0 instead. do_init_call() is responsible for calling a module's init function, and setting the module state to live (MODULE_STATE_LIVE).
When I read /proc/modules, the module state is Loading, which is expected. I do not understand however the meaning of (OE+) at the end of output. This is not displayed against any other module, as is verified by the following command.
$ sudo cat /proc/modules | grep OE
hello_world 20480 1 - Loading 0xffffffffc0221000 (OE+)
I am using Linux kernel v4.7.3.
Update
All this is happening in a Qemu virtual machine. On the host, which is running Linux 4.4.0-36-generic (Ubuntu), I get the following.
$ sudo cat /proc/modules | grep OE
vboxpci 24576 0 - Live 0xffffffffc082a000 (OE)
vboxnetadp 28672 0 - Live 0xffffffffc066e000 (OE)
vboxnetflt 28672 0 - Live 0xffffffffc0635000 (OE)
vboxdrv 454656 3 vboxpci,vboxnetadp,vboxnetflt, Live 0xffffffffc0783000 (OE)
sep4_0 671744 0 - Live 0xffffffffc06de000 (OE)
socperf2_0 36864 1 sep4_0, Live 0xffffffffc0660000 (OE)
pax 16384 0 - Live 0xffffffffc05f9000 (OE)
O means Out-of-tree module has been loaded.
E means Unsigned module has been loaded.
+ means that the module is being loaded.
- means that the module is being unloaded.
The source code for print_modules(), then module_flags(), and then print_tainted() functions may be helpful in figuring out the meaning of these and some other flags. Take a look at the comment just above print_tainted() function. Hope this helps.

SoundRecorder.exe Executed from Ruby on Windows 7

I am trying to run c:\windows\system32\soundrecorder.exe on a Windows 7 Device from Ruby. When I run that application, I get the following error: "No such file or Directory".
I can successfully run CALC.exe without any trouble.
I verified that my computer has the following file:
Directory of c:\windows\system32
07/13/2009 08:39 PM 142,336 SoundRecorder.exe
1 File(s) 142,336 bytes
0 Dir(s) 156,940,525,568 bytes free
I'm using:
#run_command = 'c:\windows\system32\SoundRecorder.exe'
stdin, stdout,stderr =Open3.popen3(#run_command) do |stdin,stdout,stderr,wait_thr|
process_pid = wait_thr[:pid]
p "Process Started for Execute Command: #{process_pid}"
exit_status = wait_thr.value
end
Here are the things I tried:
Ran using Calc.exe (for #run_command), and it worked.
Tried to execute this with Root privileges which failed.
Tried to pass in more environment variables which failed.
Tried to execute this via IRB and that failed.
Tried to execute this via ``` (back ticks) which failed.
** Additional Debugging Results ***
irb(main):006:0> Dir.exist? 'c:/windows/system32'
=> true
irb(main):011:0> File.exist? 'c:/windows/system32/calc.exe'
=> true
irb(main):012:0> File.exist? 'c:/windows/system32/SoundRecorder.exe'
=> false
HOWEVER before anyone says, "XXX, the file doesn't exist look here"
C:\>dir c:\windows\system32\SoundRecorder.exe
Volume in drive C is OS
Volume Serial Number is F099-27F4
Directory of c:\windows\system32
07/13/2009 08:39 PM 142,336 SoundRecorder.exe
1 File(s) 142,336 bytes
0 Dir(s) 156,942,340,096 bytes free
This is 100 % a Windows issue.
Copy the file anywhere else, and run that.
It works. I don't know why.

Resources