OpenWrt Forum Archive

Topic: Package added: fdisk

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

A new package, fdisk from util-linux, is available for testing. You can find it in my testing repository.

Thanks to Philipp Kewisch for his contribution.

Only the fdisk utility is packaged at this time, not the cfdisk / sfdisk. Does anyone have a need to the later two ?

Please report success / failure / comments / problems in this thread. Thanks for your help !

I think fdisk is ok.
But maybe mk2fs for make ext2 ext3 partitions is very important too smile
Thanks

wl-hdd-user wrote:

But maybe mk2fs for make ext2 ext3 partitions is very important too smile

It's already there, look for e2fsprogs in my testing repository.

It's already there, look for e2fsprogs in my testing repository.

...so all we need now is swapon Nico ;-)

macsat wrote:

...so all we need now is swapon...

Done, see "Package added: swap-utils" thread.

Nico wrote:
wl-hdd-user wrote:

But maybe mk2fs for make ext2 ext3 partitions is very important too smile

It's already there, look for e2fsprogs in my testing repository.

mke2fs is not working. Any idea what's wrong?

EDIT:
Okay, it seems like "formatting" doesn't work (with mke2fs from e2fsprogs). I could not format the "SunDisk Cruzer Mini 512 MB" correctly from the Asus WL-500G deluxe. "Formatting" another different stick works. When I try to mount it I get:

root@OpenWrt:/# mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
SQUASHFS error: Can't find a SQUASHFS superblock on sd(8,1)
VFS: Can't find ext2 filesystem on dev sd(8,1).
VFS: Can't find ext3 filesystem on dev sd(8,1).
FAT: bogus logical sector size 0
VFS: Can't find a valid FAT filesystem on dev 08:01.
mount: Mounting /dev/scsi/host0/bus0/target0/lun0/part1 on /mnt failed: Invalid argument
root@OpenWrt:/#

When I "format" the USB stick with mke2fs on my desktop Linux PC mounting works without errors.

(Last edited by olli_04 on 28 Oct 2005, 16:55)

So you've checked the device file major/minor numbers are the same, yes?

Yes, I double checked that. No way to get the Cruzer Mini "formatted" on the router it self.

"Formatting" and mounting other USB sticks directly on the router works perfect.

(Last edited by olli_04 on 28 Oct 2005, 17:22)

No problems running fdisk though?

I have a WRT54G with the SD card mod, and a 128MB card installed.
I've previously been using it with the FAT filesystem it came with (using the vfat kernel module), but I've just successfully used fdisk and mke2fs to create an ext2 partition on the SD card, and I'm now using that instead.

I've done the same.  The ext2 file system allows me to install packages into the SD card without having to worry about how I would handle links.  Now, with the addition of the LD_LIBRARY_PATH environment variable, I am able to install and use any package on the SD card.  This makes the SD mod a really useful addition to the router.

-Duffin

How does the  LD_LIBRARY_PATH environment variable work? Is it enabled by default in RC3?

Thanks

The LD_LIBRARY_PATH points to the locations of the libs folder.  For instance, if I just wanted to use the default lib folders of /lib and /usr/lib I would use this line of code

export LD_LIBRARY_PATH=/lib:/usr/lib

I used it to point to libraries loaded on my SD card like this (/mnt/sd was my SD moint-point)

export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/sd/lib:/mnt/sd/usr/lib

I made a Wiki HowTo describing how I got my SD card formatted and ready to install packages on here.

-Duffin

Hi Duffin

Thanks for helping. If you have stuff in /etc/init.d/ that needs libraries,  where can you define LD_LIBRARY_PATH to be loaded before all the S.... stuff in /etc/init.d?

Once again, thanks

Now it kinda gets complicated.  Do you need the libraries before ALL of the scripts in  /etc/init.d?  If not then you can just put the declaration of LD_LIBRARY_PATH in one of the low-numbered scripts.  If indeed you need to execute it before all of the scripts then you have to worry about the path that you are going to declare being mounted or not.  I doubt that the library paths are validated when you declare LD_LIBRARY_PATH, but the paths must exist when you try and load a library from them.

Long answer short, you can declare LD_LIBRARY_PATH in the same spot that the PATH variable is declared, in /etc/preinit, though I would place the export line in the "else" section of the if block that checks to see if failsafe is activated.

-Duffin

I have a S11mount that mounts my USB HD. I tryed placing LD_LIBRARY_PATH but I don't think it worked out.

I'll try to place it in the preinit as you suggested.

Thanks for your help

I would declare the new lib path when you mount your external drive in S11mount.  Try that and see if it works.  You can see if the new path worked by running the following line at your prompt:

echo "$LD_LIBRARY_PATH"

-Duffin

Putting the declaration of LD_LIBRARY_PATH in one of the /etc/init.d/S* scripts won't persist beyond that particular script and the programs it runs - that is, it won't be available in subsequent /etc/init.d/S* scripts.  These scripts are all called in sequence as a sub-shell of /etc/init.d/rcS and modifications to environment variables do not survive beyond the life of any given sub-shell (and its children).  Environment variables are propagated DOWN the process tree if they are exported, but never propagated back UP the process tree.

(Last edited by Scytmo on 18 Nov 2005, 10:12)

Scytmo wrote:

Putting the declaration of LD_LIBRARY_PATH in one of the /etc/init.d/S* scripts won't persist beyond that particular script and the programs it runs - that is, it won't be available in subsequent /etc/init.d/S* scripts.  These scripts are all called in sequence as a sub-shell of /etc/init.d/rcS and modifications to environment variables do not survive beyond the life of any given sub-shell (and its children).  Environment variables are propagated DOWN the process tree if they are exported, but never propagated back UP the process tree.

That explains why it didn't work when I tryed it.

Any suggestions where to define LD_LIBRARY_PATH to be available during boot and afterwards?

Thanks

Well, if you're running a squashfs install I would not recommend putting it in preinit, because preinit is run from the squashfs filesystem before the jffs filesystem (the one containing the files you edit) is remounted as the root partition, so you'd have to change the ROM image and reflash to make the appropriate changes in preinit.

You could put it in each individual /etc/init.d/S* script that you want it in (i.e. the startup scripts for the programs that you want to run from the SD card).  Or, if you want it automatically everywhere, you can put it in /etc/init.d/rcS somewhere before the 'for' loop that runs the rest of the init scripts.  If you do this, though, any errors in your modification could prevent all the services from starting (including telnet/ssh) so you'd have to reboot in failsafe mode and fix your changes (see the Wiki on how to do this).

Remember to also do 'export LD_LIBRARY_PATH' in the init script, otherwise the variable will not be made available to any programs/scripts that the init script runs.

Also note that if you choose to put it in each individual /etc/init.d/S* script that you need it in, you won't be able to confirm this setting by logging in and testing it in the shell... because the shell itself is launched from either the telnet or ssh daemons, which are themselves run from one of the init scripts.  But if you put it in rcS, you will see the setting in the shell when you log in, because the telnet/ssh daemons will inherit the exported variable from rcS.

Thanks a lot for your help.

I'll give it a try

I learn something new everyday.  Thanks Scytmo!

-Duffin

The discussion might have continued from here.